98da9d9
2009-11-08  H.J. Lu  <hongjiu.lu@intel.com>
98da9d9
98da9d9
	PR ld/10911
98da9d9
	* elflink.c (elf_link_output_extsym): Don't return on
98da9d9
	STT_GNU_IFUNC symbol when stripping.
98da9d9
98da9d9
	* ld-ifunc/ifunc-4a-x86.d: New.
98da9d9
98da9d9
--- bfd/elflink.c
98da9d9
+++ bfd/elflink.c
98da9d9
@@ -8639,9 +8639,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
98da9d9
     strip = FALSE;
98da9d9
 
98da9d9
   /* If we're stripping it, and it's not a dynamic symbol, there's
98da9d9
-     nothing else to do unless it is a forced local symbol.  */
98da9d9
+     nothing else to do unless it is a forced local symbol or a
98da9d9
+     STT_GNU_IFUNC symbol.  */
98da9d9
   if (strip
98da9d9
       && h->dynindx == -1
98da9d9
+      && h->type != STT_GNU_IFUNC
98da9d9
       && !h->forced_local)
98da9d9
     return TRUE;
98da9d9
 
98da9d9
--- ld/testsuite/ld-ifunc/ifunc-4a-x86.d
98da9d9
+++ ld/testsuite/ld-ifunc/ifunc-4a-x86.d
98da9d9
@@ -0,0 +1,8 @@
98da9d9
+#ld: -s
98da9d9
+#readelf: -r --wide
98da9d9
+#target: x86_64-*-* i?86-*-*
98da9d9
+#source: ifunc-4-x86.s
98da9d9
+
98da9d9
+#...
98da9d9
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_[_0-9A-Z]+_IRELATIVE[ ]*[0-9a-f]*
98da9d9
+#pass