summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-ifunc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-07-13 16:59:09 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-07-13 16:59:09 +0000
commit6f03b2b0bea6a6a11684e5547775d0b565a6bb01 (patch)
tree16e6a7b5c10cd825dc59e819bd99d932af3ef498 /ld/testsuite/ld-ifunc
parentc57c768ab65354cf4dacf1d5a3fa1e18467429dd (diff)
downloadbinutils-redhat-6f03b2b0bea6a6a11684e5547775d0b565a6bb01.tar.gz
Support garbage collection against STT_GNU_IFUNC symbols.
bfd/ 2010-07-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11791 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Support garbage collection against STT_GNU_IFUNC symbols. * elf32-i386.c (elf_i386_get_local_sym_hash): Don't set elf.plt.offset/elf.got.offset to -1. (elf_i386_tls_transition): Skip TLS transition for functions. (elf_i386_gc_sweep_hook): Support STT_GNU_IFUNC symbols. * elf64-x86-64.c (elf64_x86_64_get_local_sym_hash): Don't set elf.plt.offset/elf.got.offset to -1. (elf64_x86_64_tls_transition): Skip TLS transition for functions. (elf64_x86_64_gc_sweep_hook): Support STT_GNU_IFUNC symbols. ld/testsuite/ 2010-07-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11791 * ld-ifunc/ifunc-10-i386.d: New. * ld-ifunc/ifunc-10-i386.s: Likewise. * ld-ifunc/ifunc-10-x86-64.d: Likewise. * ld-ifunc/ifunc-10-x86-64.s: Likewise. * ld-ifunc/ifunc-11-i386.d: Likewise. * ld-ifunc/ifunc-11-i386.s: Likewise. * ld-ifunc/ifunc-11-x86-64.d: Likewise. * ld-ifunc/ifunc-11-x86-64.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-ifunc')
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-10-i386.d6
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-10-i386.s20
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-10-x86-64.d6
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-10-x86-64.s20
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-11-i386.d6
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-11-i386.s21
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-11-x86-64.d6
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-11-x86-64.s21
8 files changed, 106 insertions, 0 deletions
diff --git a/ld/testsuite/ld-ifunc/ifunc-10-i386.d b/ld/testsuite/ld-ifunc/ifunc-10-i386.d
new file mode 100644
index 0000000000..5f56b24425
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-10-i386.d
@@ -0,0 +1,6 @@
+#ld: -m elf_i386 -e bar --gc-sections
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-ifunc/ifunc-10-i386.s b/ld/testsuite/ld-ifunc/ifunc-10-i386.s
new file mode 100644
index 0000000000..8411e815eb
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-10-i386.s
@@ -0,0 +1,20 @@
+ .section .text.foo,"ax",@progbits
+ .type foo, @function
+foo:
+ .global foo
+ movl ifunc@GOT(%ecx), %eax
+ movl ifunc@GOTOFF(%ecx), %eax
+ call ifunc@PLT
+ call ifunc
+ ret
+
+ .section .text.bar,"ax",@progbits
+ .type bar, @function
+bar:
+ .global bar
+ ret
+
+ .section .text.ifunc,"ax",@progbits
+ .type ifunc, @gnu_indirect_function
+ifunc:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-10-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-10-x86-64.d
new file mode 100644
index 0000000000..8ece379efb
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-10-x86-64.d
@@ -0,0 +1,6 @@
+#ld: -m elf_x86_64 -e bar --gc-sections
+#as: --64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-ifunc/ifunc-10-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-10-x86-64.s
new file mode 100644
index 0000000000..ea6f8c2d16
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-10-x86-64.s
@@ -0,0 +1,20 @@
+ .section .text.foo,"ax",@progbits
+ .type foo, @function
+foo:
+ .global foo
+ movl ifunc@GOTPCREL(%rip), %eax
+ movl ifunc(%rip), %eax
+ call ifunc@PLT
+ call ifunc
+ ret
+
+ .section .text.bar,"ax",@progbits
+ .type bar, @function
+bar:
+ .global bar
+ ret
+
+ .section .text.ifunc,"ax",@progbits
+ .type ifunc, @gnu_indirect_function
+ifunc:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-11-i386.d b/ld/testsuite/ld-ifunc/ifunc-11-i386.d
new file mode 100644
index 0000000000..5f56b24425
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-11-i386.d
@@ -0,0 +1,6 @@
+#ld: -m elf_i386 -e bar --gc-sections
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-ifunc/ifunc-11-i386.s b/ld/testsuite/ld-ifunc/ifunc-11-i386.s
new file mode 100644
index 0000000000..06f592400e
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-11-i386.s
@@ -0,0 +1,21 @@
+ .section .text.foo,"ax",@progbits
+ .type foo, @function
+foo:
+ .global foo
+ movl ifunc@GOT(%ecx), %eax
+ movl ifunc@GOTOFF(%ecx), %eax
+ call ifunc@PLT
+ call ifunc
+ ret
+
+ .section .text.bar,"ax",@progbits
+ .type bar, @function
+bar:
+ .global bar
+ ret
+
+ .section .text.ifunc,"ax",@progbits
+ .type ifunc, @gnu_indirect_function
+ .global ifunc
+ifunc:
+ ret
diff --git a/ld/testsuite/ld-ifunc/ifunc-11-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-11-x86-64.d
new file mode 100644
index 0000000000..8ece379efb
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-11-x86-64.d
@@ -0,0 +1,6 @@
+#ld: -m elf_x86_64 -e bar --gc-sections
+#as: --64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-ifunc/ifunc-11-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-11-x86-64.s
new file mode 100644
index 0000000000..70d4fbfdb1
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-11-x86-64.s
@@ -0,0 +1,21 @@
+ .section .text.foo,"ax",@progbits
+ .type foo, @function
+foo:
+ .global foo
+ movl ifunc@GOTPCREL(%rip), %eax
+ movl ifunc(%rip), %eax
+ call ifunc@PLT
+ call ifunc
+ ret
+
+ .section .text.bar,"ax",@progbits
+ .type bar, @function
+bar:
+ .global bar
+ ret
+
+ .section .text.ifunc,"ax",@progbits
+ .type ifunc, @gnu_indirect_function
+ .global ifunc
+ifunc:
+ ret