[ bfd/ChangeLog ]

2004-04-23  Chris Demetriou  <cgd@broadcom.com>

        * coff-mips.c (mips_relhi_reloc, mips_rello_reloc)
        (mips_switch_reloc, mips_read_relocs, mips_relax_section)
        (mips_relax_pcrel16, PCREL16_EXPANSION_ADJUSTMENT): Remove.
        (mips_relocate_hi): Remove now-unused 'adjust' and 'pcrel' arguments,
        and update comments to reflect current usage.
        (mips_howto_table): Remove entries for MIPS_R_RELHI, MIPS_R_RELLO,
        and MIPS_R_SWITCH, as well as several empty entries.  Update comment
        for MIPS_R_PCREL16.
        (mips_ecoff_swap_reloc_in, mips_ecoff_swap_reloc_out)
        (mips_adjust_reloc_out, mips_bfd_reloc_type_lookup): Remove support
        for MIPS_R_SWITCH, MIPS_R_RELLO, and MIPS_R_RELHI relocations.
        (mips_adjust_reloc_in): Likewise, adjust maximum accepted relocation
        type number to be MIPS_R_PCREL16.
        (mips_relocate_section): Remove support for link-time relaxation
        of branches used by embedded-PIC.  Remove support for MIPS_R_SWITCH,
        MIPS_R_RELLO, and MIPS_R_RELHI relocations.
        (_bfd_ecoff_bfd_relax_section): Redefine to bfd_generic_relax_section.
        * ecoff.c (ecoff_indirect_link_order): Remove support for link-time
        relaxation of branches used by embedded-PIC.
        * ecofflink.c (bfd_ecoff_debug_accumulate): Likewise.
        * libecoff.h (struct ecoff_section_tdata): Remove embedded-PIC
        related members, update comment.
        * pe-mips.c: Remove disabled (commented-out and #if 0'd)
        code related to embedded-PIC.
        * elfxx-mips.c (_bfd_mips_elf_read_ecoff_info): Remove
        initialization of now-removed 'adjust' member of
        'struct ecoff_debug_info'.

[ include/coff/ChangeLog ]
2004-04-23  Chris Demetriou  <cgd@broadcom.com>

        * mips.h (MIPS_R_RELHI, MIPS_R_RELLO, MIPS_R_SWITCH): Remove
        (MIPS_R_PCREL16): Update comment.
        * ecoff.h (struct ecoff_value_adjust): Remove structure.
        (struct ecoff_debug_info): Remove 'adjust' member.
This commit is contained in:
Chris Demetriou 2004-04-24 06:12:25 +00:00
parent 9f7194c374
commit 3e27568fe9
10 changed files with 93 additions and 1269 deletions

View File

@ -1,3 +1,33 @@
2004-04-23 Chris Demetriou <cgd@broadcom.com>
* coff-mips.c (mips_relhi_reloc, mips_rello_reloc)
(mips_switch_reloc, mips_read_relocs, mips_relax_section)
(mips_relax_pcrel16, PCREL16_EXPANSION_ADJUSTMENT): Remove.
(mips_relocate_hi): Remove now-unused 'adjust' and 'pcrel' arguments,
and update comments to reflect current usage.
(mips_howto_table): Remove entries for MIPS_R_RELHI, MIPS_R_RELLO,
and MIPS_R_SWITCH, as well as several empty entries. Update comment
for MIPS_R_PCREL16.
(mips_ecoff_swap_reloc_in, mips_ecoff_swap_reloc_out)
(mips_adjust_reloc_out, mips_bfd_reloc_type_lookup): Remove support
for MIPS_R_SWITCH, MIPS_R_RELLO, and MIPS_R_RELHI relocations.
(mips_adjust_reloc_in): Likewise, adjust maximum accepted relocation
type number to be MIPS_R_PCREL16.
(mips_relocate_section): Remove support for link-time relaxation
of branches used by embedded-PIC. Remove support for MIPS_R_SWITCH,
MIPS_R_RELLO, and MIPS_R_RELHI relocations.
(_bfd_ecoff_bfd_relax_section): Redefine to bfd_generic_relax_section.
* ecoff.c (ecoff_indirect_link_order): Remove support for link-time
relaxation of branches used by embedded-PIC.
* ecofflink.c (bfd_ecoff_debug_accumulate): Likewise.
* libecoff.h (struct ecoff_section_tdata): Remove embedded-PIC
related members, update comment.
* pe-mips.c: Remove disabled (commented-out and #if 0'd)
code related to embedded-PIC.
* elfxx-mips.c (_bfd_mips_elf_read_ecoff_info): Remove
initialization of now-removed 'adjust' member of
'struct ecoff_debug_info'.
2004-04-23 Chris Demetriou <cgd@broadcom.com>
* elfxx-mips.c (mips_elf_get_global_gotsym_index): Remove.

File diff suppressed because it is too large Load Diff

View File

@ -4526,7 +4526,6 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
{
asection *input_section;
bfd *input_bfd;
struct ecoff_section_tdata *section_tdata;
bfd_size_type raw_size;
bfd_size_type cooked_size;
bfd_byte *contents = NULL;
@ -4542,7 +4541,6 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
section_tdata = ecoff_section_data (input_bfd, input_section);
raw_size = input_section->_raw_size;
cooked_size = input_section->_cooked_size;
@ -4560,39 +4558,24 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
if (contents == NULL && amt != 0)
goto error_return;
/* If we are relaxing, the contents may have already been read into
memory, in which case we copy them into our new buffer. We don't
simply reuse the old buffer in case cooked_size > raw_size. */
if (section_tdata != (struct ecoff_section_tdata *) NULL
&& section_tdata->contents != (bfd_byte *) NULL)
memcpy (contents, section_tdata->contents, (size_t) raw_size);
else
{
if (! bfd_get_section_contents (input_bfd, input_section,
(PTR) contents,
(file_ptr) 0, raw_size))
goto error_return;
}
if (! bfd_get_section_contents (input_bfd, input_section,
(PTR) contents,
(file_ptr) 0, raw_size))
goto error_return;
/* Get the relocs. If we are relaxing MIPS code, they will already
have been read in. Otherwise, we read them in now. */
external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size;
external_relocs_size = external_reloc_size * input_section->reloc_count;
if (section_tdata != (struct ecoff_section_tdata *) NULL
&& section_tdata->external_relocs != NULL)
external_relocs = section_tdata->external_relocs;
else
{
external_relocs = (PTR) bfd_malloc (external_relocs_size);
if (external_relocs == NULL && external_relocs_size != 0)
goto error_return;
external_relocs = (PTR) bfd_malloc (external_relocs_size);
if (external_relocs == NULL && external_relocs_size != 0)
goto error_return;
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
|| (bfd_bread (external_relocs, external_relocs_size, input_bfd)
!= external_relocs_size))
goto error_return;
}
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
|| (bfd_bread (external_relocs, external_relocs_size, input_bfd)
!= external_relocs_size))
goto error_return;
/* Relocate the section contents. */
if (! ((*ecoff_backend (input_bfd)->relocate_section)
@ -4625,14 +4608,14 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
if (contents != NULL)
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
if (external_relocs != NULL)
free (external_relocs);
return TRUE;
error_return:
if (contents != NULL)
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
if (external_relocs != NULL)
free (external_relocs);
return FALSE;
}

View File

@ -800,20 +800,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
fdr_adr = fdr.adr;
/* Adjust the FDR address for any changes that may have been
made by relaxing. */
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
struct ecoff_value_adjust *adjust;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (fdr_adr >= adjust->start
&& fdr_adr < adjust->end)
fdr.adr += adjust->adjust;
}
/* FIXME: It is conceivable that this FDR points to the .init or
.fini section, in which case this will not do the right
thing. */
@ -856,19 +842,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
case stLabel:
case stProc:
case stStaticProc:
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
bfd_vma value;
struct ecoff_value_adjust *adjust;
value = internal_sym.value;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (value >= adjust->start
&& value < adjust->end)
internal_sym.value += adjust->adjust;
}
internal_sym.value += section_adjust[internal_sym.sc];
break;
@ -978,9 +951,8 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
output_symhdr->issMax += fdr.cbSs;
}
if ((output_bfd->xvec->header_byteorder
== input_bfd->xvec->header_byteorder)
&& input_debug->adjust == (struct ecoff_value_adjust *) NULL)
if (output_bfd->xvec->header_byteorder
== input_bfd->xvec->header_byteorder)
{
/* The two BFD's have the same endianness, and we don't have
to adjust the PDR addresses, so simply copying the
@ -1036,23 +1008,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
PDR pdr;
(*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr);
/* If we have been relaxing, we may have to adjust the
address. */
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
bfd_vma adr;
struct ecoff_value_adjust *adjust;
adr = fdr_adr + pdr.adr;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (adr >= adjust->start
&& adr < adjust->end)
pdr.adr += adjust->adjust;
}
(*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out);
}

View File

@ -809,7 +809,6 @@ _bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section,
#undef READ
debug->fdr = NULL;
debug->adjust = NULL;
return TRUE;

View File

@ -176,41 +176,13 @@ typedef struct ecoff_symbol_struct
#define ecoff_get_sym_index(symbol) ((symbol)->udata.i)
#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx))
/* When generating MIPS embedded PIC code, the linker relaxes the code
to turn PC relative branches into longer code sequences when the PC
relative branch is out of range. This involves reading the relocs
in bfd_relax_section as well as in bfd_final_link, and requires the
code to keep track of which relocs have been expanded. A pointer
to this structure is put in the used_by_bfd pointer of a section to
keep track of this information. The user_by_bfd pointer will be
NULL if the information was not needed. */
/* A pointer to this structure is put in the used_by_bfd pointer of
a section to keep track of any per-section data.
The user_by_bfd pointer will be NULL if the information was not
needed. */
struct ecoff_section_tdata
{
/* The unswapped relocs for this section. These are stored in
memory so the input file does not have to be read twice. */
PTR external_relocs;
/* The contents of the section. These bytes may or may not be saved
in memory, but if it is this is a pointer to them. */
bfd_byte *contents;
/* Offset adjustments for PC relative branches. A number other than
1 is an addend for a PC relative branch, or a switch table entry
which is the difference of two .text locations; this addend
arises because the branch or difference crosses one or more
branches which were expanded into a larger code sequence. A 1
means that this branch was itself expanded into a larger code
sequence. 1 is not a possible offset, since all offsets must be
multiples of the instruction size, which is 4; also, the only
relocs with non-zero offsets will be PC relative branches or
switch table entries within the same object file. If this field
is NULL, no branches were expanded and no offsets are required.
Otherwise there are as many entries as there are relocs in the
section, and the entry for any reloc that is not PC relative is
zero. */
long *offsets;
/* When producing an executable (i.e., final, non-relocatable link)
on the Alpha, we may need to use multiple global pointer values
to span the entire .lita section. In essence, we allow each

View File

@ -41,16 +41,6 @@ static reloc_howto_type *coff_mips_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
#if 0
static void mips_ecoff_swap_reloc_in
PARAMS ((bfd *, PTR, struct internal_reloc *));
static void mips_ecoff_swap_reloc_out
PARAMS ((bfd *, const struct internal_reloc *, PTR));
static void mips_adjust_reloc_in
PARAMS ((bfd *, const struct internal_reloc *, arelent *));
static void mips_adjust_reloc_out
PARAMS ((bfd *, const arelent *, struct internal_reloc *));
#endif
static bfd_boolean in_reloc_p
PARAMS ((bfd *, reloc_howto_type *));
@ -534,20 +524,6 @@ coff_mips_reloc_type_lookup (abfd, code)
case BFD_RELOC_MIPS_LITERAL:
mips_type = MIPS_R_LITERAL;
break;
/* FIXME?
case BFD_RELOC_16_PCREL_S2:
mips_type = MIPS_R_PCREL16;
break;
case BFD_RELOC_PCREL_HI16_S:
mips_type = MIPS_R_RELHI;
break;
case BFD_RELOC_PCREL_LO16:
mips_type = MIPS_R_RELLO;
break;
case BFD_RELOC_GPREL32:
mips_type = MIPS_R_SWITCH;
break;
*/
case BFD_RELOC_RVA:
mips_type = MIPS_R_RVA;
break;

View File

@ -1,3 +1,10 @@
2004-04-23 Chris Demetriou <cgd@broadcom.com>
* mips.h (MIPS_R_RELHI, MIPS_R_RELLO, MIPS_R_SWITCH): Remove
(MIPS_R_PCREL16): Update comment.
* ecoff.h (struct ecoff_value_adjust): Remove structure.
(struct ecoff_debug_info): Remove 'adjust' member.
2004-04-20 DJ Delorie <dj@redhat.com>
* internal.h (R_SECREL32): Add.

View File

@ -322,34 +322,6 @@ struct ecoff_debug_info
this changes in the future. This is a pointer to an array, not a
single structure. */
FDR *fdr;
/* When relaxing MIPS embedded PIC code, we may need to adjust
symbol values when they are output. This is a linked list of
structures indicating how values should be adjusted. There is no
requirement that the entries be in any order, or that they not
overlap. This field is normally NULL, in which case no
adjustments need to be made. */
struct ecoff_value_adjust *adjust;
};
/* This structure describes how to adjust symbol values when
outputting MIPS embedded PIC code. These adjustments only apply to
the internal symbols, as the external symbol values will come from
the hash table and have already been adjusted. */
struct ecoff_value_adjust
{
/* Next entry on adjustment list. */
struct ecoff_value_adjust *next;
/* Starting VMA of adjustment. This is the VMA in the ECOFF file,
not the offset from the start of the section. Thus it should
indicate a particular section. */
bfd_vma start;
/* Ending VMA of adjustment. */
bfd_vma end;
/* Adjustment. This should be added to the value of the symbol, or
FDR. This is zero for the last entry in the array. */
long adjust;
};
/* These structures are used by the ECOFF find_nearest_line function. */

View File

@ -105,34 +105,10 @@ struct external_reloc
#define MIPS_R_GPREL 6
#define MIPS_R_LITERAL 7
/* These reloc types are a Cygnus extension used when generating
position independent code for embedded systems. The numbers are
taken from Irix 4, but at least for internal relocs Irix 5 does not
give them the same meaning. For an internal reloc the symbol index
of RELHI and RELLO is modified as described below for
MIPS_R_SWITCH. */
/* FIXME: This relocation is used (internally only) to represent branches
when assembling. It should never appear in output files, and
be removed. (It used to be used for embedded-PIC support.) */
#define MIPS_R_PCREL16 12
#define MIPS_R_RELHI 13
#define MIPS_R_RELLO 14
/* This reloc type is a Cygnus extension used when generating position
independent code for embedded systems. It is used for an entry in
a switch table, which looks like this:
.word $L3-$LS12
The object file will contain the correct difference, and does not
require adjustment. However, when the linker is relaxing PC
relative calls, it is possible for $L3 to move farther away. This
reloc always appears in the .text section, and is always against
the .text section. However, the symbol index is not
RELOC_SECTION_TEXT. It is, instead, the distance between this
switch table entry and $LS12. Thus, the original value of $L12 is
vaddr - symndx
and the original value of $L3 is
vaddr - symndx + addend
where addend is the value in the object file. Knowing this, the
linker can know whether the addend in the object file must be
adjusted. */
#define MIPS_R_SWITCH 22
/********************** STABS **********************/