x86: Properly handle function pointer reference
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 26 Apr 2022 16:08:54 +0000 (09:08 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 28 Apr 2022 16:20:30 +0000 (09:20 -0700)
commit68c4956b1401de70173848a6bdf620cb42fa9358
tree4e78b4d2d33a9b17371e61aade9b168d0bb377fa
parent9dd9f9ce1e231ef594845f11c05a724653241b58
x86: Properly handle function pointer reference

Update

commit ebb191adac4ab45498dec0bfaac62f0a33537ba4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 9 15:51:22 2022 -0800

    x86: Disallow invalid relocation against protected symbol

to allow function pointer reference and make sure that PLT entry isn't
used for function reference due to function pointer reference.

bfd/

PR ld/29087
* elf32-i386.c (elf_i386_scan_relocs): Don't set
pointer_equality_needed nor check non-canonical reference for
function pointer reference.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.

ld/

PR ld/29087
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/29087 tests.
* testsuite/ld-x86-64/protected-func-3.c: New file.
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/testsuite/ld-x86-64/protected-func-3.c [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp