OSDN Git Service

bfd/ChangeLog:
authorEric Christopher <echristo@apple.com>
Thu, 24 Mar 2005 01:30:44 +0000 (01:30 +0000)
committerEric Christopher <echristo@apple.com>
Thu, 24 Mar 2005 01:30:44 +0000 (01:30 +0000)
2005-03-23  Eric Christopher  <echristo@redhat.com>

* elfxx-mips.c (MIPS_ELF_READONLY_SECTION): New.
(mips_elf_calculate_relocation): Use. Define DF_TEXTREL
after emitting relocation.
(_bfd_mips_elf_adjust_dynamic_symbol): Ditto.
(_bfd_mips_elf_check_relocs): Remove code to set DF_TEXTREL
and readonly_reloc.

ld/testsuite/ChangeLog:

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

* ld-mips-elf/textrel-1.s, ld-mips-elf/textrel-1.d: New
test.
* ld-mips-elf/mips-elf.exp: Call it.
* ld-mips-elf/rel32-n32.d: Update for DF_TEXTREL removal.
* ld-mips-elf/rel32-o32.d: Ditto.
* ld-mips-elf/rel64.d: Ditto.

bfd/ChangeLog
bfd/elfxx-mips.c

index 9ee10a9..b15a3d5 100644 (file)
@@ -1,3 +1,12 @@
+2005-03-23  Eric Christopher  <echristo@redhat.com>
+
+       * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): New.
+       (mips_elf_calculate_relocation): Use. Define DF_TEXTREL
+       after emitting relocation.
+       (_bfd_mips_elf_adjust_dynamic_symbol): Ditto.
+       (_bfd_mips_elf_check_relocs): Remove code to set DF_TEXTREL
+       and readonly_reloc.
+
 2005-03-23  Mike Frysinger  <vapier@gentoo.org>
            Nick Clifton  <nickc@redhat.com>
 
index a4baea9..951d1a7 100644 (file)
@@ -478,6 +478,11 @@ 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"
 
@@ -4005,6 +4010,10 @@ 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
        {
@@ -6101,33 +6110,21 @@ _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);
-                 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;
-               }
+               /* 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);
              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
@@ -6423,9 +6420,12 @@ _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 (hmips->readonly_reloc)
+
+      if (MIPS_ELF_READONLY_SECTION (sec))
        /* We tell the dynamic linker that there are relocations
           against the text segment.  */
        info->flags |= DF_TEXTREL;