bfd/
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 16 Jul 2009 14:23:12 +0000 (14:23 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 16 Jul 2009 14:23:12 +0000 (14:23 +0000)
2009-07-16  H.J. Lu  <hongjiu.lu@intel.com>

* elf32-i386.c (elf_i386_relocate_section): Don't get local
STT_GNU_IFUNC symbol for relocatable link.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.

ld/testsuite/

2009-07-16  H.J. Lu  <hongjiu.lu@intel.com>

* ld-ifunc/ifunc-5r-local-i386.d: New.
* ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-ifunc/ifunc-5r-local-i386.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d [new file with mode: 0644]

index c433df753e7dfb65e3475974253dd1760f8cb050..79a75d9032389a50cd38ac062c65e42b77b20c7e 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-i386.c (elf_i386_relocate_section): Don't get local
+       STT_GNU_IFUNC symbol for relocatable link.
+       * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
 2009-07-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * bfdio.c (bfd_iovec): Add comments for bmmap.
index c86d00da170639b3daad00f4262db9914ae1e81b..868e9d4328f3018adb03b7988dba6cde8bc9e646 100644 (file)
@@ -2891,7 +2891,8 @@ elf_i386_relocate_section (bfd *output_bfd,
                  break;
                }
            }
-         else if (ELF32_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+         else if (!info->relocatable
+                  && ELF32_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
            {
              /* Relocate against local STT_GNU_IFUNC symbol.  */
              h = elf_i386_get_local_sym_hash (htab, input_bfd,
index 6e868b389df2efadb5c45a95072c4d08190914f3..718f07610a8ca51bf7f6f404b7137c82f5a308d7 100644 (file)
@@ -2612,7 +2612,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                                                &sec, rel);
 
          /* Relocate against local STT_GNU_IFUNC symbol.  */
-         if (ELF64_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+         if (!info->relocatable
+             && ELF64_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
            {
              h = elf64_x86_64_get_local_sym_hash (htab, input_bfd,
                                                   rel, FALSE);
index 1c00f3e96222f610dab33be119b66d5a11957bc0..78ec4a8d54e776981008963939434fda1f4a5eb9 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-ifunc/ifunc-5r-local-i386.d: New.
+       * ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
+
 2009-07-16  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ld-arm/arm-target2.s: Add addend cases.
diff --git a/ld/testsuite/ld-ifunc/ifunc-5r-local-i386.d b/ld/testsuite/ld-ifunc/ifunc-5r-local-i386.d
new file mode 100644 (file)
index 0000000..18e1295
--- /dev/null
@@ -0,0 +1,11 @@
+#source: ifunc-5-local-i386.s
+#ld: -r -m elf_i386
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+Relocation section '.rel.text' at .*
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_GOTPC[ ]+0+[ ]+_GLOBAL_OFFSET_TABLE_[ ]*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_PLT32[ ]+foo\(\)[ ]+foo[ ]*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_GOT32[ ]+foo\(\)[ ]+foo[ ]*
diff --git a/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d
new file mode 100644 (file)
index 0000000..e9ad214
--- /dev/null
@@ -0,0 +1,10 @@
+#source: ifunc-5-local-x86-64.s
+#as: --64
+#ld: -r -melf_x86_64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+Relocation section '.rela.text' at .*
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_PLT32[ ]+foo\(\)[ ]+foo - 4
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_GOTPCREL[ ]+foo\(\)[ ]+foo - 4