This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Add 2 ifunc tests for i386 and x86-64
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 2 Sep 2015 22:31:31 -0000
- Subject: [binutils-gdb] Add 2 ifunc tests for i386 and x86-64
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0762fbb6a7543730d61384344a95fa7bf174a6cb
commit 0762fbb6a7543730d61384344a95fa7bf174a6cb
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Sep 2 15:30:32 2015 -0700
Add 2 ifunc tests for i386 and x86-64
* ld-ifunc/ifunc-21-i386.d: Likewise.
* ld-ifunc/ifunc-21-i386.s: Likewise.
* ld-ifunc/ifunc-21-x86-64.d: Likewise.
* ld-ifunc/ifunc-21-x86-64.s: Likewise.
* ld-ifunc/ifunc-22-i386.d: Likewise.
* ld-ifunc/ifunc-22-i386.s: Likewise.
* ld-ifunc/ifunc-22-x86-64.d: Likewise.
* ld-ifunc/ifunc-22-x86-64.s: Likewise.
Diff:
---
ld/testsuite/ChangeLog | 11 +++++++++++
ld/testsuite/ld-ifunc/ifunc-21-i386.d | 30 ++++++++++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-21-i386.s | 23 +++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-21-x86-64.d | 27 +++++++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-21-x86-64.s | 19 +++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-22-i386.d | 30 ++++++++++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-22-i386.s | 24 ++++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-22-x86-64.d | 27 +++++++++++++++++++++++++++
ld/testsuite/ld-ifunc/ifunc-22-x86-64.s | 20 ++++++++++++++++++++
9 files changed, 211 insertions(+)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 0241c08..ca1b665 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2015-09-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-ifunc/ifunc-21-i386.d: Likewise.
+ * ld-ifunc/ifunc-21-i386.s: Likewise.
+ * ld-ifunc/ifunc-21-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-21-x86-64.s: Likewise.
+ * ld-ifunc/ifunc-22-i386.d: Likewise.
+ * ld-ifunc/ifunc-22-i386.s: Likewise.
+ * ld-ifunc/ifunc-22-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-22-x86-64.s: Likewise.
+
2015-09-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/18900
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-i386.d b/ld/testsuite/ld-ifunc/ifunc-21-i386.d
new file mode 100644
index 0000000..4c3a6a3
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-21-i386.d
@@ -0,0 +1,30 @@
+#ld: -m elf_i386
+#as: --32
+#objdump: -dw
+#target: x86_64-*-* i?86-*-*
+
+.*: +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]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[ ]*[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
new file mode 100644
index 0000000..e1af106
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-21-i386.s
@@ -0,0 +1,23 @@
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type __start,"function"
+ call .L6
+.L6:
+ popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
+ mov foo@GOT(%ebx), %eax
+ mov bar@GOT(%ebx), %eax
+ .type foo, %gnu_indirect_function
+foo:
+ ret
+ .type bar, %function
+bar:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
new file mode 100644
index 0000000..ea46631
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -0,0 +1,27 @@
+#as: --64
+#ld: -melf_x86_64
+#objdump: -dw
+#target: x86_64-*-*
+
+.*: +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]+: 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
new file mode 100644
index 0000000..0cf92ac
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.s
@@ -0,0 +1,19 @@
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type __start,"function"
+ movq foo@GOTPCREL(%rip), %rax
+ movq bar@GOTPCREL(%rip), %rax
+ .type foo, %gnu_indirect_function
+foo:
+ ret
+ .type bar, %function
+bar:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-i386.d b/ld/testsuite/ld-ifunc/ifunc-22-i386.d
new file mode 100644
index 0000000..4c3a6a3
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-22-i386.d
@@ -0,0 +1,30 @@
+#ld: -m elf_i386
+#as: --32
+#objdump: -dw
+#target: x86_64-*-* i?86-*-*
+
+.*: +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]+: 8b 83 0c 00 00 00 mov 0xc\(%ebx\),%eax
+[ ]*[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
new file mode 100644
index 0000000..f6fc784
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-22-i386.s
@@ -0,0 +1,24 @@
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type __start,"function"
+ call .L6
+.L6:
+ popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx
+ mov foo@GOT(%ebx), %eax
+ mov bar@GOT(%ebx), %eax
+ .global foo
+ .type foo, %gnu_indirect_function
+foo:
+ ret
+ .type bar, %function
+bar:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
new file mode 100644
index 0000000..ea46631
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -0,0 +1,27 @@
+#as: --64
+#ld: -melf_x86_64
+#objdump: -dw
+#target: x86_64-*-*
+
+.*: +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]+: 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
new file mode 100644
index 0000000..f402c62
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.s
@@ -0,0 +1,20 @@
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type __start,"function"
+ movq foo@GOTPCREL(%rip), %rax
+ movq bar@GOTPCREL(%rip), %rax
+ .type foo, %gnu_indirect_function
+ .globl foo
+foo:
+ ret
+ .type bar, %function
+bar:
+ ret