PKGBUILDs/core/binutils/binutils-2.24-static-pie-hang.patch
2014-05-20 11:09:46 +00:00

78 lines
2.6 KiB
Diff

diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 4d391e1..d7f59e5 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2368,8 +2368,13 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
{
- p->count -= p->pc_count;
- p->pc_count = 0;
+ /* Don't update reloc count if there are any non
+ pc-relative relocs. */
+ if (!h->pointer_equality_needed)
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ }
if (p->count == 0)
*pp = p->next;
else
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index edee8ec..999011b 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2463,8 +2463,13 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
{
- p->count -= p->pc_count;
- p->pc_count = 0;
+ /* Don't update reloc count if there are any non
+ pc-relative relocs. */
+ if (!h->pointer_equality_needed)
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ }
if (p->count == 0)
*pp = p->next;
else
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 4d391e1..e834a5a 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2390,9 +2390,12 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
/* Also discard relocs on undefined weak syms with non-default
- visibility. */
+ visibility. Don't discard relocs against __ehdr_start which
+ will be defined by assign_file_positions_for_non_load_sections
+ later. */
if (eh->dyn_relocs != NULL
- && h->root.type == bfd_link_hash_undefweak)
+ && h->root.type == bfd_link_hash_undefweak
+ && strcmp (h->root.root.string, "__ehdr_start") != 0)
{
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
eh->dyn_relocs = NULL;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index edee8ec..f364fe4 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2473,9 +2473,12 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
}
/* Also discard relocs on undefined weak syms with non-default
- visibility. */
+ visibility. Don't discard relocs against __ehdr_start which
+ will be defined by assign_file_positions_for_non_load_sections
+ later. */
if (eh->dyn_relocs != NULL
- && h->root.type == bfd_link_hash_undefweak)
+ && h->root.type == bfd_link_hash_undefweak
+ && strcmp (h->root.root.string, "__ehdr_start") != 0)
{
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
eh->dyn_relocs = NULL;