2005-03-24 Eric Christopher <echristo@redhat.com>
authorEric Christopher <echristo@gmail.com>
Thu, 24 Mar 2005 22:47:52 +0000 (22:47 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 24 Mar 2005 22:47:52 +0000 (22:47 +0000)
* elfxx-mips.c: Revert previous patch.

2005-03-24  Eric Christopher  <echristo@redhat.com>

* ld-mips-elf/rel32-n32.d: Revert changes.
* ld-mips-elf/rel32-o32.d: Ditto.
* ld-mips-elf/rel64.d: Ditto.

bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/rel32-n32.d
ld/testsuite/ld-mips-elf/rel32-o32.d
ld/testsuite/ld-mips-elf/rel64.d

index 7d83b6d..c6cf9a0 100644 (file)
@@ -1,3 +1,7 @@
+2005-03-24  Eric Christopher  <echristo@redhat.com>
+
+       * elfxx-mips.c: Revert previous patch.
+
 2005-03-24  Nick Clifton  <nickc@redhat.com>
 
        * targets.c (_bfd_target_vector): Only include the
index 951d1a7..a4baea9 100644 (file)
@@ -478,11 +478,6 @@ static bfd *reldyn_sorting_bfd;
 #define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \
   (NEWABI_P (abfd) ? ".MIPS.options" : ".options")
 
-/* Whether the section is readonly.  */
-#define MIPS_ELF_READONLY_SECTION(sec)                 \
-  ((sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))        \
-   == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
-
 /* The name of the stub section.  */
 #define MIPS_ELF_STUB_SECTION_NAME(abfd) ".MIPS.stubs"
 
@@ -4010,10 +4005,6 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
                                                   &value,
                                                   input_section))
            return bfd_reloc_undefined;
-
-         /* If we've written this we need to set DF_TEXTREL here.  */
-         if (MIPS_ELF_READONLY_SECTION (input_section))
-           info->flags |= DF_TEXTREL;
        }
       else
        {
@@ -6110,21 +6101,33 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
                  if (sreloc == NULL)
                    return FALSE;
                }
-
+#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
              if (info->shared)
-               /* When creating a shared object, we must copy these
-                  reloc types into the output file as R_MIPS_REL32
-                  relocs.  We make room for this reloc in the
-                  .rel.dyn reloc section.  */
-               mips_elf_allocate_dynamic_relocations (dynobj, 1);
+               {
+                 /* When creating a shared object, we must copy these
+                    reloc types into the output file as R_MIPS_REL32
+                    relocs.  We make room for this reloc in the
+                    .rel.dyn reloc section.  */
+                 mips_elf_allocate_dynamic_relocations (dynobj, 1);
+                 if ((sec->flags & MIPS_READONLY_SECTION)
+                     == MIPS_READONLY_SECTION)
+                   /* We tell the dynamic linker that there are
+                      relocations against the text segment.  */
+                   info->flags |= DF_TEXTREL;
+               }
              else
                {
                  struct mips_elf_link_hash_entry *hmips;
-                 
+
                  /* We only need to copy this reloc if the symbol is
                      defined in a dynamic object.  */
                  hmips = (struct mips_elf_link_hash_entry *) h;
                  ++hmips->possibly_dynamic_relocs;
+                 if ((sec->flags & MIPS_READONLY_SECTION)
+                     == MIPS_READONLY_SECTION)
+                   /* We need it to tell the dynamic linker if there
+                      are relocations against the text segment.  */
+                   hmips->readonly_reloc = TRUE;
                }
 
              /* Even though we don't directly need a GOT entry for
@@ -6420,12 +6423,9 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       && (h->root.type == bfd_link_hash_defweak
          || !h->def_regular))
     {
-      asection *sec;
-      sec = mips_elf_rel_dyn_section (dynobj, FALSE);
       mips_elf_allocate_dynamic_relocations (dynobj,
                                             hmips->possibly_dynamic_relocs);
-
-      if (MIPS_ELF_READONLY_SECTION (sec))
+      if (hmips->readonly_reloc)
        /* We tell the dynamic linker that there are relocations
           against the text segment.  */
        info->flags |= DF_TEXTREL;
index 8e8c09d..8b1c497 100644 (file)
@@ -1,3 +1,9 @@
+2005-03-24  Eric Christopher  <echristo@redhat.com>
+
+       * ld-mips-elf/rel32-n32.d: Revert changes.
+       * ld-mips-elf/rel32-o32.d: Ditto.
+       * ld-mips-elf/rel64.d: Ditto.
+
 2005-03-23  Eric Christopher  <echristo@redhat.com>
 
        * ld-mips-elf/textrel-1.s, ld-mips-elf/textrel-1.d: New
index 565742a..cff8b36 100644 (file)
@@ -4,12 +4,12 @@
 #readelf: -x 5 -r
 #ld: -shared -melf32btsmipn32
 
-Relocation section '.rel.dyn' at offset 0x2fc contains 2 entries:
+Relocation section '.rel.dyn' at offset 0x304 contains 2 entries:
  Offset     Info    Type            Sym.Value  Sym. Name
 00000000  00000000 R_MIPS_NONE      
-00000320  00000003 R_MIPS_REL32     
+00000330  00000003 R_MIPS_REL32     
 
 Hex dump of section '.text':
-  0x00000310 00000000 00000000 00000000 00000000 ................
-  0x00000320 00000320 00000000 00000000 00000000 ................
-  0x00000330 00000000 00000000 00000000 00000000 ................
+  0x00000320 00000000 00000000 00000000 00000000 ................
+  0x00000330 00000330 00000000 00000000 00000000 ................
+  0x00000340 00000000 00000000 00000000 00000000 ................
index d89b87a..982758a 100644 (file)
@@ -4,7 +4,7 @@
 #readelf: -x 6 -r
 #ld: -shared -melf32btsmip
 
-Relocation section '.rel.dyn' at offset 0x314 contains 2 entries:
+Relocation section '.rel.dyn' at offset 0x31c contains 2 entries:
  Offset     Info    Type            Sym.Value  Sym. Name
 00000000  00000000 R_MIPS_NONE      
 00000340  00000003 R_MIPS_REL32     
index 8663f14..ead15f0 100644 (file)
@@ -4,16 +4,16 @@
 #readelf: -x 6 -r
 #ld: -shared -melf64btsmip
 
-Relocation section '.rel.dyn' at offset 0x488 contains 2 entries:
+Relocation section '.rel.dyn' at offset 0x498 contains 2 entries:
   Offset          Info           Type           Sym. Value    Sym. Name
 000000000000  000000000000 R_MIPS_NONE      
                     Type2: R_MIPS_NONE      
                     Type3: R_MIPS_NONE      
-0000000004c0  000000001203 R_MIPS_REL32     
+0000000004d0  000000001203 R_MIPS_REL32     
                     Type2: R_MIPS_64        
                     Type3: R_MIPS_NONE      
 
 Hex dump of section '.text':
-  0x000004b0 00000000 00000000 00000000 00000000 ................
-  0x000004c0 00000000 000004c0 00000000 00000000 ................
-  0x000004d0 00000000 00000000 00000000 00000000 ................
+  0x000004c0 00000000 00000000 00000000 00000000 ................
+  0x000004d0 00000000 000004d0 00000000 00000000 ................
+  0x000004e0 00000000 00000000 00000000 00000000 ................