This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Remove check of h->plt.refcount > 0 on STT_GNU_IFUNC symbol
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 3 Jun 2009 10:30:50 -0700
- Subject: Re: PATCH: Remove check of h->plt.refcount > 0 on STT_GNU_IFUNC symbol
- References: <20090603165746.GA11137@lucon.org>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Wed, Jun 03, 2009 at 09:57:46AM -0700, H.J. Lu wrote:
> Even if we don't have PLT relocation on STT_GNU_IFUNC symbol, we still
> need PLT entry for function pointer. I am checking in this patch to fix
> it.
>
>
I am checking this testcase.
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 6058)
+++ ChangeLog (working copy)
@@ -1,3 +1,21 @@
+2009-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-ifunc/ifunc-2-x86-64.d: Pass --64 to as and -melf_x86_64 to
+ ld.
+ * ld-ifunc/ifunc-5a-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-5b-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-6a-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-6b-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-7a-x86-64.d: Likewise.
+ * ld-ifunc/ifunc-7b-x86-64.d: Likewise.
+
+ * ld-ifunc/ifunc-8a-i386.s: New.
+ * ld-ifunc/ifunc-8a-x86-64.s: Likewise.
+ * ld-ifunc/ifunc-8b-i386.s: Likewise.
+ * ld-ifunc/ifunc-8b-x86-64.s: Likewise.
+ * ld-ifunc/ifunc-8-i386.d: Likewise.
+ * ld-ifunc/ifunc-8-x86-64.d: Likewise.
+
2009-06-02 Richard Sandiford <r.sandiford@uk.ibm.com>
* ld-powerpc/aix-glink-3.s, ld-powerpc/aix-glink-3a.s,
Index: ld-ifunc/ifunc-8-i386.d
===================================================================
--- ld-ifunc/ifunc-8-i386.d (revision 0)
+++ ld-ifunc/ifunc-8-i386.d (revision 0)
@@ -0,0 +1,10 @@
+#source: ifunc-8a-i386.s
+#source: ifunc-8b-i386.s
+#ld: -m elf_i386
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+Relocation section '.rel.plt' at .*
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_IRELATIVE[ ]*
Index: ld-ifunc/ifunc-8b-x86-64.s
===================================================================
--- ld-ifunc/ifunc-8b-x86-64.s (revision 0)
+++ ld-ifunc/ifunc-8b-x86-64.s (revision 0)
@@ -0,0 +1,7 @@
+ .text
+ .type foo, %gnu_indirect_function
+.globl foo
+ .type foo, @function
+foo:
+ ret
+ .size foo, .-foo
Index: ld-ifunc/ifunc-2-x86-64.d
===================================================================
--- ld-ifunc/ifunc-2-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-2-x86-64.d (working copy)
@@ -1,4 +1,5 @@
-#ld: -shared
+#as: --64
+#ld: -shared -melf_x86_64
#objdump: -dw
#target: x86_64-*-*
Index: ld-ifunc/ifunc-8a-i386.s
===================================================================
--- ld-ifunc/ifunc-8a-i386.s (revision 0)
+++ ld-ifunc/ifunc-8a-i386.s (revision 0)
@@ -0,0 +1,16 @@
+ .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
Index: ld-ifunc/ifunc-5a-x86-64.d
===================================================================
--- ld-ifunc/ifunc-5a-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-5a-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-5-x86-64.s
-#ld:
+#as: --64
+#ld: -melf_x86_64
#readelf: -r --wide
#target: x86_64-*-*
Index: ld-ifunc/ifunc-6a-x86-64.d
===================================================================
--- ld-ifunc/ifunc-6a-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-6a-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-6-x86-64.s
-#ld:
+#as: --64
+#ld: -melf_x86_64
#readelf: -r --wide
#target: x86_64-*-*
Index: ld-ifunc/ifunc-8-x86-64.d
===================================================================
--- ld-ifunc/ifunc-8-x86-64.d (revision 0)
+++ ld-ifunc/ifunc-8-x86-64.d (revision 0)
@@ -0,0 +1,10 @@
+#source: ifunc-8a-x86-64.s
+#source: ifunc-8b-x86-64.s
+#as: --64
+#ld: -melf_x86_64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+Relocation section '.rela.plt' at .*
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_IRELATIVE[ ]+[0-9a-f]*
Index: ld-ifunc/ifunc-7a-x86-64.d
===================================================================
--- ld-ifunc/ifunc-7a-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-7a-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-7-x86-64.s
-#ld:
+#as: --64
+#ld: -melf_x86_64
#readelf: -r --wide
#target: x86_64-*-*
Index: ld-ifunc/ifunc-8a-x86-64.s
===================================================================
--- ld-ifunc/ifunc-8a-x86-64.s (revision 0)
+++ ld-ifunc/ifunc-8a-x86-64.s (revision 0)
@@ -0,0 +1,12 @@
+ .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
Index: ld-ifunc/ifunc-8b-i386.s
===================================================================
--- ld-ifunc/ifunc-8b-i386.s (revision 0)
+++ ld-ifunc/ifunc-8b-i386.s (revision 0)
@@ -0,0 +1,7 @@
+ .text
+ .type foo, %gnu_indirect_function
+.globl foo
+ .type foo, @function
+foo:
+ ret
+ .size foo, .-foo
Index: ld-ifunc/ifunc-5b-x86-64.d
===================================================================
--- ld-ifunc/ifunc-5b-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-5b-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-5-x86-64.s
-#ld: -shared -z nocombreloc
+#as: --64
+#ld: -melf_x86_64 -shared -z nocombreloc
#readelf: -r --wide
#target: x86_64-*-*
Index: ld-ifunc/ifunc-6b-x86-64.d
===================================================================
--- ld-ifunc/ifunc-6b-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-6b-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-6-x86-64.s
-#ld: -shared -z nocombreloc
+#as: --64
+#ld: -melf_x86_64 -shared -z nocombreloc
#readelf: -r --wide
#target: x86_64-*-*
Index: ld-ifunc/ifunc-7b-x86-64.d
===================================================================
--- ld-ifunc/ifunc-7b-x86-64.d (revision 6057)
+++ ld-ifunc/ifunc-7b-x86-64.d (working copy)
@@ -1,5 +1,6 @@
#source: ifunc-7-x86-64.s
-#ld: -shared
+#as: --64
+#ld: -melf_x86_64 -shared
#readelf: -r --wide
#target: x86_64-*-*