aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-09-03 04:03:13 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-09-03 04:03:13 -0700
commit8c650f161a95873e3dc08365fc9a74583df9de62 (patch)
tree8bc983ee17dba381ee1f9d749a31ecdd4d8a3186
parent6c214e7cb397bf0de539fec640e764f0131e9677 (diff)
downloadbinutils-8c650f161a95873e3dc08365fc9a74583df9de62.zip
binutils-8c650f161a95873e3dc08365fc9a74583df9de62.tar.gz
binutils-8c650f161a95873e3dc08365fc9a74583df9de62.tar.bz2
Add ifunc tests for call, jmp, add, test
* ld-ifunc/ifunc-21-i386.s: Add tests for call, jmp, add, test. * ld-ifunc/ifunc-21-x86-64.s: Likewise. * ld-ifunc/ifunc-22-i386.s: Likewise. * ld-ifunc/ifunc-22-x86-64.s: Likewise. * ld-ifunc/ifunc-21-i386.d: Updated. * ld-ifunc/ifunc-21-x86-64.d: Likewise. * ld-ifunc/ifunc-22-i386.d: Likewise. * ld-ifunc/ifunc-22-x86-64.d: Likewise.
-rw-r--r--ld/testsuite/ChangeLog13
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-21-i386.d24
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-21-i386.s8
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-21-x86-64.d23
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-21-x86-64.s4
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-22-i386.d24
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-22-i386.s8
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-22-x86-64.d23
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-22-x86-64.s4
9 files changed, 50 insertions, 81 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index ca1b665..34ed02d 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,6 +1,17 @@
+2015-09-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-ifunc/ifunc-21-i386.s: Add tests for call, jmp, add, test.
+ * ld-ifunc/ifunc-21-x86-64.s: Likewise.
+ * ld-ifunc/ifunc-22-i386.s: Likewise.
+ * ld-ifunc/ifunc-22-x86-64.s: Likewise.
+ * ld-ifunc/ifunc-21-i386.d: Updated.
+ * ld-ifunc/ifunc-21-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-22-i386.d: Likewise.
+ * ld-ifunc/ifunc-22-x86-64.d: Likewise.
+
2015-09-02 H.J. Lu <hongjiu.lu@intel.com>
- * ld-ifunc/ifunc-21-i386.d: Likewise.
+ * ld-ifunc/ifunc-21-i386.d: New file.
* ld-ifunc/ifunc-21-i386.s: Likewise.
* ld-ifunc/ifunc-21-x86-64.d: Likewise.
* ld-ifunc/ifunc-21-x86-64.s: Likewise.
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-i386.d b/ld/testsuite/ld-ifunc/ifunc-21-i386.d
index 4c3a6a3..c7ca811 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-i386.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-i386.d
@@ -5,26 +5,12 @@
.*: +file format .*
-
-Disassembly of section .plt:
-
-0+8048080 <.plt>:
-[ ]*[a-f0-9]+: ff 25 b8 90 04 08 jmp \*0x80490b8
-[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 8048090 <__start>
-
-Disassembly of section .text:
-
+#...
0+8048090 <__start>:
-[ ]*[a-f0-9]+: e8 00 00 00 00 call 8048095 <__start\+0x5>
-[ ]*[a-f0-9]+: 5b pop %ebx
-[ ]*[a-f0-9]+: 81 c3 17 10 00 00 add \$0x1017,%ebx
+[ ]*[a-f0-9]+: ff 93 0c 00 00 00 call \*0xc\(%ebx\)
+[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[ ]*[a-f0-9]+: 03 83 0c 00 00 00 add 0xc\(%ebx\),%eax
[ ]*[a-f0-9]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[ ]*[a-f0-9]+: 85 83 0c 00 00 00 test %eax,0xc\(%ebx\)
[ ]*[a-f0-9]+: 8d ([0-9a-f]{2} ){5}[ ]+lea[ ]+.*
-
-0+80480a8 <foo>:
-[ ]*[a-f0-9]+: c3 ret
-
-0+80480a9 <bar>:
-[ ]*[a-f0-9]+: c3 ret
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-i386.s b/ld/testsuite/ld-ifunc/ifunc-21-i386.s
index e1af106..92eb55e 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-i386.s
+++ b/ld/testsuite/ld-ifunc/ifunc-21-i386.s
@@ -9,11 +9,11 @@ _start:
.global __start
__start:
.type __start,"function"
- call .L6
-.L6:
- popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
+ call *foo@GOT(%ebx)
+ jmp *foo@GOT(%ebx)
+ add foo@GOT(%ebx), %eax
mov foo@GOT(%ebx), %eax
+ test %eax, foo@GOT(%ebx)
mov bar@GOT(%ebx), %eax
.type foo, %gnu_indirect_function
foo:
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
index ea46631..53ccd5a 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -5,23 +5,12 @@
.*: +file format .*
-
-Disassembly of section .plt:
-
-0+4000d0 <.plt>:
-[ ]*[a-f0-9]+: ff 25 32 00 20 00 jmpq \*0x200032\(%rip\) # 600108 <_GLOBAL_OFFSET_TABLE_\+0x18>
-[ ]*[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 4000e0 <__start>
-
-Disassembly of section .text:
-
+#...
0+4000e0 <__start>:
-[ ]*[a-f0-9]+: 48 8b 05 21 00 20 00 mov 0x200021\(%rip\),%rax # 600108 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: ff 15 42 00 20 00 callq \*0x200042\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: ff 25 3c 00 20 00 jmpq \*0x20003c\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 03 05 35 00 20 00 add 0x200035\(%rip\),%rax # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 8b 05 2e 00 20 00 mov 0x20002e\(%rip\),%rax # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 85 05 27 00 20 00 test %rax,0x200027\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
[ ]*[a-f0-9]+: 48 8d ([0-9a-f]{2} ){5}[ ]+lea[ ]+.*
-
-0+4000ee <foo>:
-[ ]*[a-f0-9]+: c3 retq
-
-0+4000ef <bar>:
-[ ]*[a-f0-9]+: c3 retq
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.s
index 0cf92ac..9d5d028 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.s
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.s
@@ -9,7 +9,11 @@ _start:
.global __start
__start:
.type __start,"function"
+ call *foo@GOTPCREL(%rip)
+ jmp *foo@GOTPCREL(%rip)
+ add foo@GOTPCREL(%rip), %rax
movq foo@GOTPCREL(%rip), %rax
+ test %rax, foo@GOTPCREL(%rip)
movq bar@GOTPCREL(%rip), %rax
.type foo, %gnu_indirect_function
foo:
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-i386.d b/ld/testsuite/ld-ifunc/ifunc-22-i386.d
index 4c3a6a3..c7ca811 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-i386.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-i386.d
@@ -5,26 +5,12 @@
.*: +file format .*
-
-Disassembly of section .plt:
-
-0+8048080 <.plt>:
-[ ]*[a-f0-9]+: ff 25 b8 90 04 08 jmp \*0x80490b8
-[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 8048090 <__start>
-
-Disassembly of section .text:
-
+#...
0+8048090 <__start>:
-[ ]*[a-f0-9]+: e8 00 00 00 00 call 8048095 <__start\+0x5>
-[ ]*[a-f0-9]+: 5b pop %ebx
-[ ]*[a-f0-9]+: 81 c3 17 10 00 00 add \$0x1017,%ebx
+[ ]*[a-f0-9]+: ff 93 0c 00 00 00 call \*0xc\(%ebx\)
+[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[ ]*[a-f0-9]+: 03 83 0c 00 00 00 add 0xc\(%ebx\),%eax
[ ]*[a-f0-9]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[ ]*[a-f0-9]+: 85 83 0c 00 00 00 test %eax,0xc\(%ebx\)
[ ]*[a-f0-9]+: 8d ([0-9a-f]{2} ){5}[ ]+lea[ ]+.*
-
-0+80480a8 <foo>:
-[ ]*[a-f0-9]+: c3 ret
-
-0+80480a9 <bar>:
-[ ]*[a-f0-9]+: c3 ret
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-i386.s b/ld/testsuite/ld-ifunc/ifunc-22-i386.s
index f6fc784..2e3202d 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-i386.s
+++ b/ld/testsuite/ld-ifunc/ifunc-22-i386.s
@@ -9,11 +9,11 @@ _start:
.global __start
__start:
.type __start,"function"
- call .L6
-.L6:
- popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
+ call *foo@GOT(%ebx)
+ jmp *foo@GOT(%ebx)
+ add foo@GOT(%ebx), %eax
mov foo@GOT(%ebx), %eax
+ test %eax, foo@GOT(%ebx)
mov bar@GOT(%ebx), %eax
.global foo
.type foo, %gnu_indirect_function
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
index ea46631..53ccd5a 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -5,23 +5,12 @@
.*: +file format .*
-
-Disassembly of section .plt:
-
-0+4000d0 <.plt>:
-[ ]*[a-f0-9]+: ff 25 32 00 20 00 jmpq \*0x200032\(%rip\) # 600108 <_GLOBAL_OFFSET_TABLE_\+0x18>
-[ ]*[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 4000e0 <__start>
-
-Disassembly of section .text:
-
+#...
0+4000e0 <__start>:
-[ ]*[a-f0-9]+: 48 8b 05 21 00 20 00 mov 0x200021\(%rip\),%rax # 600108 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: ff 15 42 00 20 00 callq \*0x200042\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: ff 25 3c 00 20 00 jmpq \*0x20003c\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 03 05 35 00 20 00 add 0x200035\(%rip\),%rax # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 8b 05 2e 00 20 00 mov 0x20002e\(%rip\),%rax # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[ ]*[a-f0-9]+: 48 85 05 27 00 20 00 test %rax,0x200027\(%rip\) # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
[ ]*[a-f0-9]+: 48 8d ([0-9a-f]{2} ){5}[ ]+lea[ ]+.*
-
-0+4000ee <foo>:
-[ ]*[a-f0-9]+: c3 retq
-
-0+4000ef <bar>:
-[ ]*[a-f0-9]+: c3 retq
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.s
index f402c62..d4194a0 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.s
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.s
@@ -9,7 +9,11 @@ _start:
.global __start
__start:
.type __start,"function"
+ call *foo@GOTPCREL(%rip)
+ jmp *foo@GOTPCREL(%rip)
+ add foo@GOTPCREL(%rip), %rax
movq foo@GOTPCREL(%rip), %rax
+ test %rax, foo@GOTPCREL(%rip)
movq bar@GOTPCREL(%rip), %rax
.type foo, %gnu_indirect_function
.globl foo