PATCH: PR ld/10911: ld -s -static breaks IRELATIVE relocations

View: New views
2 Messages — Rating Filter:   Alert me  

PATCH: PR ld/10911: ld -s -static breaks IRELATIVE relocations

by H.J. Lu-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When stripping, we shouldn't return on STT_GNU_IFUNC symbols.  OK to
install?

Thanks.


H.J.
---
bfd/

2009-11-08  H.J. Lu  <hongjiu.lu@...>

        PR ld/10911
        * elflink.c (elf_link_output_extsym): Don't return on
        STT_GNU_IFUNC symbol when stripping.

ld/testsuite/

2009-11-08  H.J. Lu  <hongjiu.lu@...>

        PR ld/10911
        * ld-ifunc/ifunc-4a-x86.d: New.

diff --git a/bfd/elflink.c b/bfd/elflink.c
index cd016b7..0153411 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8639,9 +8639,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
     strip = FALSE;
 
   /* If we're stripping it, and it's not a dynamic symbol, there's
-     nothing else to do unless it is a forced local symbol.  */
+     nothing else to do unless it is a forced local symbol or a
+     STT_GNU_IFUNC symbol.  */
   if (strip
       && h->dynindx == -1
+      && h->type != STT_GNU_IFUNC
       && !h->forced_local)
     return TRUE;
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-4a-x86.d b/ld/testsuite/ld-ifunc/ifunc-4a-x86.d
new file mode 100644
index 0000000..d06f589
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-4a-x86.d
@@ -0,0 +1,8 @@
+#ld: -s
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+#source: ifunc-4-x86.s
+
+#...
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_[_0-9A-Z]+_IRELATIVE[ ]*[0-9a-f]*
+#pass

Re: PATCH: PR ld/10911: ld -s -static breaks IRELATIVE relocations

by Alan Modra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 08, 2009 at 04:32:22PM -0800, H.J. Lu wrote:

> 2009-11-08  H.J. Lu  <hongjiu.lu@...>
>
> PR ld/10911
> * elflink.c (elf_link_output_extsym): Don't return on
> STT_GNU_IFUNC symbol when stripping.
>
> ld/testsuite/
>
> 2009-11-08  H.J. Lu  <hongjiu.lu@...>
>
> PR ld/10911
> * ld-ifunc/ifunc-4a-x86.d: New.

OK.

--
Alan Modra
Australia Development Lab, IBM