diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-03-15 11:46:51 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-03-15 11:47:06 -0700 |
commit | 4e0c91e45402ebf4215066e4a61143896e831049 (patch) | |
tree | 55a15e4ef85bf47a1177c6a3c8e16f9f145f5e0f /bfd/elf64-x86-64.c | |
parent | 4c10bbaa0912742322f10d9d5bb630ba4e15dfa7 (diff) | |
download | gdb-4e0c91e45402ebf4215066e4a61143896e831049.zip gdb-4e0c91e45402ebf4215066e4a61143896e831049.tar.gz gdb-4e0c91e45402ebf4215066e4a61143896e831049.tar.bz2 |
Bind defined symbol locally in PIE
Symbols defined in PIE should be bound locally, the same as -shared
-Bsymbolic.
bfd/
PR ld/19827
* elf32-i386.c (elf_i386_check_relocs): Bind defined symbol
locally in PIE.
(elf_i386_relocate_section): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
ld/
PR ld/19827
* testsuite/ld-i386/i386.exp: Run PR ld/19827 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr19827.rd: New file.
* testsuite/ld-i386/pr19827a.S: Likewise.
* testsuite/ld-i386/pr19827b.S: Likewise.
* testsuite/ld-x86-64/pr19827.rd: Likewise.
* testsuite/ld-x86-64/pr19827a.S: Likewise.
* testsuite/ld-x86-64/pr19827b.S: Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 31b1f87..dc7738a 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2073,7 +2073,8 @@ do_size: && (sec->flags & SEC_ALLOC) != 0 && (! IS_X86_64_PCREL_TYPE (r_type) || (h != NULL - && (! SYMBOLIC_BIND (info, h) + && (! (bfd_link_pie (info) + || SYMBOLIC_BIND (info, h)) || h->root.type == bfd_link_hash_defweak || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS @@ -4830,8 +4831,8 @@ direct: else if (h != NULL && h->dynindx != -1 && (IS_X86_64_PCREL_TYPE (r_type) - || ! bfd_link_pic (info) - || ! SYMBOLIC_BIND (info, h) + || !(bfd_link_executable (info) + || SYMBOLIC_BIND (info, h)) || ! h->def_regular)) { if ((r_type != R_X86_64_PC64 && r_type != R_X86_64_64) |