From 74437ea28fb611d4c88077b486fd7c0a8b4c2a25 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 29 Aug 2016 08:12:59 -0700 Subject: i386: Issue an error on non-PIC call to IFUNC in PIC object On i386, IFUNC function must be called via PLT. Since PLT in PIC object uses EBX register, R_386_PLT32 relocation must be used to call IFUNC function even when IFUNC function is defined locally. Linker should issue an error when R_386_PC32 relocation is used to call IFUNC function. Since PR ld/19784 tests doesn't use PLT relocation to local IFUNC function, they are moved to the x86-64 test directory. bfd/ PR ld/14961 PR ld/20515 * elf32-i386.c (elf_i386_check_relocs): Issue an error when R_386_PC32 relocation is used to call IFUNC function in PIC object. ld/ PR ld/14961 PR ld/20515 * testsuite/ld-i386/i386.exp: Run pr20515. * testsuite/ld-i386/pr20515.d: New file. * testsuite/ld-i386/pr20515.s: Likewise. * testsuite/ld-ifunc/ifunc-14a.s: Use R_386_PLT32 to call IFUNC function. * testsuite/ld-ifunc/ifunc-14c.s: Likewise. * testsuite/ld-ifunc/ifunc-2-i386.s: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise. * testsuite/ld-ifunc/ifunc.exp: Move PR ld/19784 tests to ... * testsuite/ld-x86-64/x86-64.exp: Here. * testsuite/ld-ifunc/pr19784a.c: Moved to ... * testsuite/ld-x86-64/pr19784a.c: Here. * testsuite/ld-ifunc/pr19784b.c: Moved to ... * testsuite/ld-x86-64/pr19784b.c: Here. * testsuite/ld-ifunc/pr19784c.c: Moved to ... * testsuite/ld-x86-64/pr19784c.c: Here. --- ld/testsuite/ld-x86-64/pr19784a.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 ld/testsuite/ld-x86-64/pr19784a.c (limited to 'ld/testsuite/ld-x86-64/pr19784a.c') diff --git a/ld/testsuite/ld-x86-64/pr19784a.c b/ld/testsuite/ld-x86-64/pr19784a.c new file mode 100644 index 0000000..c922cb9 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19784a.c @@ -0,0 +1,6 @@ +void bar(void); +int main(void) +{ + bar(); + return 0; +} -- cgit v1.1