summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils-2.17
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-08-28 08:31:34 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-08-28 08:31:34 +0000
commitbdf31969e4339adff3182b77a7eac14a3a99df7c (patch)
tree0a6977d3418160c3dc5fbef27b3e8c2009aa5c6c /gnu/usr.bin/binutils-2.17
parentb60ffcfd2e3df9903870b3b3d10b0e13a9e4dc00 (diff)
Do proper GOT slot accounting for symbols that were forced to be local.
This fix first appeared in FSF binutils after the switch to GPLv3. However Daniel Jacobowitz, who wrote the fix, confirms he worked for CodeSourcery at the time (as suggested by the ChangeLog entry), and CodeSourcery included this fix in the 4.1-176 version of their toolchain that was distributed under GPLv2. ok guenther@, ok deraadt@
Diffstat (limited to 'gnu/usr.bin/binutils-2.17')
-rw-r--r--gnu/usr.bin/binutils-2.17/bfd/elfxx-mips.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils-2.17/bfd/elfxx-mips.c b/gnu/usr.bin/binutils-2.17/bfd/elfxx-mips.c
index 7e0ed884546..e6d909eb0ec 100644
--- a/gnu/usr.bin/binutils-2.17/bfd/elfxx-mips.c
+++ b/gnu/usr.bin/binutils-2.17/bfd/elfxx-mips.c
@@ -2782,7 +2782,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
/* Global symbols that need GOT entries that are not explicitly
referenced are marked with got offset 2. Those that are
referenced get a 1, and those that don't need GOT entries get
- -1. */
+ -1. Forced local symbols may also be marked with got offset 1,
+ but are never given global GOT entries. */
if (h->root.got.offset == 2)
{
BFD_ASSERT (h->tls_type == GOT_NORMAL);
@@ -2791,7 +2792,7 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
hsd->low = (struct elf_link_hash_entry *) h;
h->root.dynindx = hsd->max_unref_got_dynindx++;
}
- else if (h->root.got.offset != 1)
+ else if (h->root.got.offset != 1 || h->forced_local)
h->root.dynindx = hsd->max_non_got_dynindx++;
else
{
@@ -3248,6 +3249,7 @@ mips_elf_set_global_got_offset (void **entryp, void *p)
if (entry->abfd != NULL && entry->symndx == -1
&& entry->d.h->root.dynindx != -1
+ && !entry->d.h->forced_local
&& entry->d.h->tls_type == GOT_NORMAL)
{
if (g)