Ben Elliston wrote: > Here's a whole raft of cleanups. Again, please speak up if anything > should be kept! Tested with a binutils --enable-targets=all build. [snip] > Index: elf64-mips.c > =================================================================== > RCS file: /home/bje/src-cvs/src/bfd/elf64-mips.c,v > retrieving revision 1.62 > diff -u -p -u -r1.62 elf64-mips.c > --- elf64-mips.c 7 Oct 2004 19:15:28 -0000 1.62 > +++ elf64-mips.c 31 Jan 2005 05:25:08 -0000 > @@ -1367,9 +1367,6 @@ mips_elf64_be_swap_reloc_out (bfd *abfd, > > mirel.r_offset = src[0].r_offset; > BFD_ASSERT(src[0].r_offset == src[1].r_offset); > -#if 0 > - BFD_ASSERT(src[0].r_offset == src[2].r_offset); > -#endif This looks wrong, the r_offset has to be the same for all three. I wonder why it is ifdef'ed out. [snip] > Index: elfxx-mips.c > =================================================================== > RCS file: /home/bje/src-cvs/src/bfd/elfxx-mips.c,v > retrieving revision 1.117 > diff -u -p -u -r1.117 elfxx-mips.c > --- elfxx-mips.c 14 Dec 2004 09:48:10 -0000 1.117 > +++ elfxx-mips.c 31 Jan 2005 05:25:08 -0000 [snip] > @@ -4617,10 +4582,6 @@ _bfd_mips_elf_fake_sections (bfd *abfd, > { > if (SGI_COMPAT (abfd)) > hdr->sh_entsize = 0; > -#if 0 > - /* This isn't how the IRIX6 linker behaves. */ > - hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES; > -#endif This should be retained (and probably changed for !IRIX ?). [snip] > @@ -7521,41 +7466,6 @@ _bfd_mips_elf_gc_sweep_hook (bfd *abfd A > asection *sec ATTRIBUTE_UNUSED, > const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) > { > -#if 0 > - Elf_Internal_Shdr *symtab_hdr; > - struct elf_link_hash_entry **sym_hashes; > - bfd_signed_vma *local_got_refcounts; > - const Elf_Internal_Rela *rel, *relend; > - unsigned long r_symndx; > - struct elf_link_hash_entry *h; > - > - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; > - sym_hashes = elf_sym_hashes (abfd); > - local_got_refcounts = elf_local_got_refcounts (abfd); > - > - relend = relocs + sec->reloc_count; > - for (rel = relocs; rel < relend; rel++) > - switch (ELF_R_TYPE (abfd, rel->r_info)) > - { > - case R_MIPS_GOT16: > - case R_MIPS_CALL16: > - case R_MIPS_CALL_HI16: > - case R_MIPS_CALL_LO16: > - case R_MIPS_GOT_HI16: > - case R_MIPS_GOT_LO16: > - case R_MIPS_GOT_DISP: > - case R_MIPS_GOT_PAGE: > - case R_MIPS_GOT_OFST: > - /* ??? It would seem that the existing MIPS code does no sort > - of reference counting or whatnot on its GOT and PLT entries, > - so it is not possible to garbage collect them at this time. */ > - break; > - > - default: > - break; > - } > -#endif > - This should also stay, (and still waits for implementation... ). [snip] > @@ -8187,47 +8092,6 @@ _bfd_mips_elf_final_link (bfd *abfd, str > - g->global_gotsym->dynindx) > <= g->global_gotno); > } > - > -#if 0 > - /* We want to set the GP value for ld -r. */ > - /* On IRIX5, we omit the .options section. On IRIX6, however, we > - include it, even though we don't process it quite right. (Some > - entries are supposed to be merged.) Empirically, we seem to be > - better off including it then not. */ > - if (IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none) > - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) > - { > - if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) > - { > - for (p = (*secpp)->link_order_head; p != NULL; p = p->next) > - if (p->type == bfd_indirect_link_order) > - p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS; > - (*secpp)->link_order_head = NULL; > - bfd_section_list_remove (abfd, secpp); > - --abfd->section_count; > - > - break; > - } > - } > - > - /* We include .MIPS.options, even though we don't process it quite right. > - (Some entries are supposed to be merged.) At IRIX6 empirically we seem > - to be better off including it than not. */ > - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) > - { > - if (strcmp ((*secpp)->name, ".MIPS.options") == 0) > - { > - for (p = (*secpp)->link_order_head; p != NULL; p = p->next) > - if (p->type == bfd_indirect_link_order) > - p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS; > - (*secpp)->link_order_head = NULL; > - bfd_section_list_remove (abfd, secpp); > - --abfd->section_count; > - > - break; > - } > - } > -#endif Richard, is this code obsolete for IRIX? Thiemo