summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-ifunc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-07-21 10:35:58 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-07-21 11:40:27 -0700
commit8f29211c3f0a6335c17e0a90396c146facf6dba4 (patch)
tree5f38e50ea5188f6e4588ca968bec955c03a8e3b0 /ld/testsuite/ld-ifunc
parentc44885db3b56c83a12e88a176c03f2a2268428b8 (diff)
downloadbinutils-gdb-8f29211c3f0a6335c17e0a90396c146facf6dba4.tar.gz
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.
Diffstat (limited to 'ld/testsuite/ld-ifunc')
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-2-i386-now.d2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-2-i386.s2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-2-local-i386.s2
4 files changed, 4 insertions, 4 deletions
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
index a5c56b5a8e3..8d9e8dc988f 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
@@ -31,6 +31,6 @@ Disassembly of section .text:
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: 81 c3 9e 10 00 00 add \$0x109e,%ebx
+[a-f0-9]+: e8 de ff ff ff call 100 <\*ABS\*@plt>
- +[a-f0-9]+: 8d 83 4c ef ff ff lea -0x10b4\(%ebx\),%eax
+ +[a-f0-9]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[a-f0-9]+: c3 ret
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386.s b/ld/testsuite/ld-ifunc/ifunc-2-i386.s
index e84d6b7b5cc..1acf6847e0b 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-i386.s
+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386.s
@@ -16,6 +16,6 @@ bar:
popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
call __GI_foo@PLT
- leal __GI_foo@GOTOFF(%ebx), %eax
+ movl __GI_foo@GOT(%ebx), %eax
ret
.size bar, .-bar
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
index ff494decbdd..9da37e51db7 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
@@ -31,6 +31,6 @@ Disassembly of section .text:
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: 81 c3 9e 10 00 00 add \$0x109e,%ebx
+[a-f0-9]+: e8 de ff ff ff call f0 <\*ABS\*@plt>
- +[a-f0-9]+: 8d 83 4c ef ff ff lea -0x10b4\(%ebx\),%eax
+ +[a-f0-9]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[a-f0-9]+: c3 ret
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s
index a69e060ddc0..54e0e179551 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s
@@ -13,6 +13,6 @@ bar:
popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
call __GI_foo@PLT
- leal __GI_foo@GOTOFF(%ebx), %eax
+ movl __GI_foo@GOT(%ebx), %eax
ret
.size bar, .-bar