aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 98fb88113c0..4b6489b9648 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3160,6 +3160,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|| (no_copyreloc_p
&& h->def_dynamic
&& !(h->root.u.def.section->flags & SEC_CODE))))
+ || (bfd_link_pie (info)
+ && h->root.type == bfd_link_hash_undefweak)
|| bfd_link_dll (info)))
{
bool fail = false;
@@ -3173,8 +3175,9 @@ elf_x86_64_relocate_section (bfd *output_bfd,
{
/* We can only use PC-relative relocations in PIE
from non-code sections. */
- if (h->type == STT_FUNC
- && (sec->flags & SEC_CODE) != 0)
+ if (h->root.type == bfd_link_hash_undefweak
+ || (h->type == STT_FUNC
+ && (sec->flags & SEC_CODE) != 0))
fail = true;
}
else if (no_copyreloc_p || bfd_link_dll (info))