summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2012-04-26 14:38:42 +0000
committerAndreas Schwab <schwab@suse.de>2012-04-26 14:38:42 +0000
commitcc36e7cb6e70b73876c2bd6b6925c0a51231f003 (patch)
tree87b44e04c2295eccc2ae6ad37f1ef1f28c8b2d70 /bfd
parentd91cfd9efc32c4017b35ec737c886fb4da8bdcec (diff)
downloadgdb-cc36e7cb6e70b73876c2bd6b6925c0a51231f003.tar.gz
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-m68k.c14
2 files changed, 20 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 115cd7c0eba..a85cee116f2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 47dece2c4e0..78d7464f427 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -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;
}