* elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references
authorAndreas Schwab <schwab@linux-m68k.org>
Thu, 26 Apr 2012 14:38:45 +0000 (14:38 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Thu, 26 Apr 2012 14:38:45 +0000 (14:38 +0000)
also when generating PIE.
(elf_m68k_discard_copies): Mark undefined weak symbols referenced
by relocations as dynamic.

bfd/ChangeLog
bfd/elf32-m68k.c

index 115cd7c0ebac59cf53adc39ebbf74210c4be8773..a85cee116f2a684de0cc079d22bde0f1acdf69aa 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-26  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references
+       also when generating PIE.
+       (elf_m68k_discard_copies): Mark undefined weak symbols referenced
+       by relocations as dynamic.
+
 2012-04-26  Hans-Peter Nilsson  <hp@axis.com>
 
        Provide a way for programs to recognize BFD_ASSERT calls.
index 47dece2c4e02e8b52c556933189a1c14bda0ba87..78d7464f427c0e7561e5104b9da93d3b07d624cf 100644 (file)
@@ -2827,7 +2827,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
                 turns out to be a function defined by a dynamic object.  */
              h->plt.refcount++;
 
-             if (!info->shared)
+             if (info->executable)
                /* This symbol needs a non-GOT reference.  */
                h->non_got_ref = 1;
            }
@@ -3479,6 +3479,18 @@ elf_m68k_discard_copies (h, inf)
              }
        }
 
+      /* Make sure undefined weak symbols are output as a dynamic symbol
+        in PIEs.  */
+      if (h->non_got_ref
+         && h->root.type == bfd_link_hash_undefweak
+         && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+         && h->dynindx == -1
+         && !h->forced_local)
+       {
+         if (! bfd_elf_link_record_dynamic_symbol (info, h))
+           return FALSE;
+       }
+
       return TRUE;
     }
 
This page took 0.036529 seconds and 4 git commands to generate.