From: Richard Sandiford Date: Mon, 13 Oct 2003 19:51:10 +0000 (+0000) Subject: * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98a8deaf8aa362c0c49f660a12558e43d19218f6;p=binutils-gdb.git * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add DT_MIPS_LIBLIST or DT_MIPS_CONFLICT entries. (_bfd_mips_elf_finish_dynamic_symbol): Don't handle them. Don't handle DT_MIPS_MSYM. Set DT_RELSZ based on the number of relocations that were needed. (_bfd_mips_elf_modify_segment_map): Fix placement of PT_MIPS_OPTIONS. (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_UCODE. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 08f2411de5d..33dd4d67a02 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2003-10-13 Richard Sandiford + + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add + DT_MIPS_LIBLIST or DT_MIPS_CONFLICT entries. + (_bfd_mips_elf_finish_dynamic_symbol): Don't handle them. Don't + handle DT_MIPS_MSYM. Set DT_RELSZ based on the number of relocations + that were needed. + (_bfd_mips_elf_modify_segment_map): Fix placement of PT_MIPS_OPTIONS. + (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_UCODE. + 2003-10-13 H.J. Lu * bfd-in.h (bfd_elf32_ia64_after_parse): New prototype. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index d28b537c211..2bff5a0570b 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -6088,30 +6088,6 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) return FALSE; } - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0)) - return FALSE; - } - - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0)) - return FALSE; - } - - if (bfd_get_section_by_name (dynobj, ".conflict") != NULL) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0)) - return FALSE; - - s = bfd_get_section_by_name (dynobj, ".liblist"); - BFD_ASSERT (s != NULL); - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0)) - return FALSE; - } - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0)) return FALSE; @@ -6881,13 +6857,6 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) case DT_PLTGOT: name = ".got"; - goto get_vma; - case DT_MIPS_CONFLICT: - name = ".conflict"; - goto get_vma; - case DT_MIPS_LIBLIST: - name = ".liblist"; - get_vma: s = bfd_get_section_by_name (output_bfd, name); BFD_ASSERT (s != NULL); dyn.d_un.d_ptr = s->vma; @@ -6901,27 +6870,6 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) dyn.d_un.d_val = RHF_NOTPOT; /* XXX */ break; - case DT_MIPS_CONFLICTNO: - name = ".conflict"; - elemsize = sizeof (Elf32_Conflict); - goto set_elemno; - - case DT_MIPS_LIBLISTNO: - name = ".liblist"; - elemsize = sizeof (Elf32_Lib); - set_elemno: - s = bfd_get_section_by_name (output_bfd, name); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - } - else - dyn.d_un.d_val = 0; - break; - case DT_MIPS_TIME_STAMP: time ((time_t *) &dyn.d_un.d_val); break; @@ -6989,9 +6937,16 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) dyn.d_un.d_ptr = s->vma; break; - case DT_MIPS_MSYM: - s = (bfd_get_section_by_name (output_bfd, ".msym")); - dyn.d_un.d_ptr = s->vma; + case DT_RELSZ: + /* Reduce DT_RELSZ to account for any relocations we + decided not to make. This is for the n64 irix rld, + which doesn't seem to apply any relocations if there + are trailing null entries. */ + s = mips_elf_rel_dyn_section (dynobj, FALSE); + dyn.d_un.d_val = (s->reloc_count + * (ABI_64_P (output_bfd) + ? sizeof (Elf64_Mips_External_Rel) + : sizeof (Elf32_External_Rel))); break; default: @@ -7372,7 +7327,7 @@ _bfd_mips_elf_modify_segment_map (abfd) /* For IRIX 6, we don't have .mdebug sections, nor does anything but .dynamic end up in PT_DYNAMIC. However, we do have to insert a - PT_OPTIONS segment immediately following the program header + PT_MIPS_OPTIONS segment immediately following the program header table. */ if (NEWABI_P (abfd) /* On non-IRIX6 new abi, we'll have already created a segment @@ -7389,15 +7344,11 @@ _bfd_mips_elf_modify_segment_map (abfd) { struct elf_segment_map *options_segment; - /* Usually, there's a program header table. But, sometimes - there's not (like when running the `ld' testsuite). So, - if there's no program header table, we just put the - options segment at the end. */ - for (pm = &elf_tdata (abfd)->segment_map; - *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_PHDR) - break; + pm = &elf_tdata (abfd)->segment_map; + while (*pm != NULL + && ((*pm)->p_type == PT_PHDR + || (*pm)->p_type == PT_INTERP)) + pm = &(*pm)->next; amt = sizeof (struct elf_segment_map); options_segment = bfd_zalloc (abfd, amt); @@ -9088,6 +9039,11 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) new_flags &= ~EF_MIPS_XGOT; old_flags &= ~EF_MIPS_XGOT; + /* MIPSpro generates ucode info in n64 objects. Again, we should + just be able to ignore this. */ + new_flags &= ~EF_MIPS_UCODE; + old_flags &= ~EF_MIPS_UCODE; + if (new_flags == old_flags) return TRUE; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 4d42f7efe1d..fd38f473c67 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-10-13 Richard Sandiford + + * ld-mips-elf/multi-got-1.d (RELSZ): Don't include the size of the + trailing null relocs. + 2003-10-12 Kaz Kojima * ld-sh/rd-sh.exp (LDFLAGS): Define appropriately for each diff --git a/ld/testsuite/ld-mips-elf/multi-got-1.d b/ld/testsuite/ld-mips-elf/multi-got-1.d index 45a904b0778..c70d022dc6d 100644 --- a/ld/testsuite/ld-mips-elf/multi-got-1.d +++ b/ld/testsuite/ld-mips-elf/multi-got-1.d @@ -15,7 +15,7 @@ Dynamic segment at offset 0xcc contains 18 entries: 0x00000015 \(DEBUG\) 0x0 0x00000003 \(PLTGOT\) 0xe3ba0 0x00000011 \(REL\) 0x83b34 - 0x00000012 \(RELSZ\) 65624 \(bytes\) + 0x00000012 \(RELSZ\) 65544 \(bytes\) 0x00000013 \(RELENT\) 8 \(bytes\) 0x70000001 \(MIPS_RLD_VERSION\) 1 0x70000005 \(MIPS_FLAGS\) NOTPOT