From 5c0b4ee406035917d0e50aa138194fab57ae6bf8 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 21 Jul 2022 10:35:58 -0700 Subject: i386: Don't allow GOTOFF relocation against IFUNC symbol for PIC We can't use the PLT entry as the function address for PIC since the PIC register may not be set up properly for indirect call. bfd/ PR ld/27998 * elf32-i386.c (elf_i386_relocate_section): Don't allow GOTOFF relocation against IFUNC symbol for PIC. ld/ PR ld/27998 * testsuite/ld-i386/pr27998a.d: Replace -shared with -e bar. * testsuite/ld-i386/pr27998b.d: Expect a linker error. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Updated. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386.s: Replace @GOTOFF with @GOT. * testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise. (cherry picked from commit 8f29211c3f0a6335c17e0a90396c146facf6dba4) --- ld/testsuite/ld-i386/pr27998b.d | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'ld/testsuite/ld-i386/pr27998b.d') diff --git a/ld/testsuite/ld-i386/pr27998b.d b/ld/testsuite/ld-i386/pr27998b.d index ca3c9205fa..8f81edbe8d 100644 --- a/ld/testsuite/ld-i386/pr27998b.d +++ b/ld/testsuite/ld-i386/pr27998b.d @@ -1,7 +1,3 @@ #as: --32 #ld: -shared -melf_i386 -#readelf: -r --wide - -Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entry: - Offset Info Type Sym. Value Symbol's Name -[0-9a-f]+ +[0-9a-f]+ +R_386_IRELATIVE + +#error: relocation R_386_GOTOFF against STT_GNU_IFUNC symbol `foo' isn't supported -- cgit v1.2.3