* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 13 Oct 2003 19:51:10 +0000 (19:51 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 13 Oct 2003 19:51:10 +0000 (19:51 +0000)
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.

bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/multi-got-1.d

index 08f2411de5d05f56f0d13f82ebeb63ed70a130d2..33dd4d67a0246eb11ca912d92e0ff8e0daae23e8 100644 (file)
@@ -1,3 +1,13 @@
+2003-10-13  Richard Sandiford  <rsandifo@redht.com>
+
+       * 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  <hongjiu.lu@intel.com>
 
        * bfd-in.h (bfd_elf32_ia64_after_parse): New prototype.
index d28b537c211920ecef676d1ab5a767634eb7d81f..2bff5a0570be90d9214ef87d87105a624b58ce11 100644 (file)
@@ -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;
 
index 4d42f7efe1dd454b0940055871a85b2dbfca3163..fd38f473c67224c2b44877d3266b5d3ce11df2a0 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-13  Richard Sandiford  <rsandifo@redht.com>
+
+       * ld-mips-elf/multi-got-1.d (RELSZ): Don't include the size of the
+       trailing null relocs.
+
 2003-10-12  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
 
        * ld-sh/rd-sh.exp (LDFLAGS): Define appropriately for each
index 45a904b0778deb6f7481fb7c95984d7026de45c5..c70d022dc6d4c29738163ee7c33ee8d851cf34a6 100644 (file)
@@ -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