summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2009-07-21 21:37:25 +0000
committerH.J. Lu <hjl@lucon.org>2009-07-21 21:37:25 +0000
commitc8b17513be07b2d517d1061ff4729e7f39a5ae29 (patch)
treef1ada57bbb1deecb98b2b9f1c5f9f9886eaba98a
parent6c6f926a5c02e86193a54027474ae10c40f383a8 (diff)
downloadgdb-c8b17513be07b2d517d1061ff4729e7f39a5ae29.tar.gz
bfd/
2009-07-21 H.J. Lu <hongjiu.lu@intel.com> PR ld/10426 * elflink.c (elf_link_add_object_symbols): Turn an IFUNC symbol from a DSO into a normal FUNC symbol. (elf_link_output_extsym): Turn an undefined IFUNC symbol into a normal FUNC symbol. ld/testsuite/ 2009-07-21 H.J. Lu <hongjiu.lu@intel.com> PR ld/10426 * ld-ifunc/ifunc.exp: Check test-1 and libtest-2.so. Updated. * ld-ifunc/test-1.c: New. * ld-ifunc/test-2.c: Likewise.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elflink.c32
2 files changed, 31 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c8f1d85a75c..926e5d99baa 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/10426
+ * elflink.c (elf_link_add_object_symbols): Turn an IFUNC symbol
+ from a DSO into a normal FUNC symbol.
+ (elf_link_output_extsym): Turn an undefined IFUNC symbol into
+ a normal FUNC symbol.
+
2009-07-17 Chao-ying Fu <fu@mips.com>
* elfxx-mips.c (LOAD_INTERLOCKS_P): New define.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4d54adddb48..f9b577c7738 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4279,15 +4279,24 @@ error_free_dyn:
if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE
&& (definition || h->type == STT_NOTYPE))
{
- if (h->type != STT_NOTYPE
- && h->type != ELF_ST_TYPE (isym->st_info)
- && ! type_change_ok)
- (*_bfd_error_handler)
- (_("Warning: type of symbol `%s' changed"
- " from %d to %d in %B"),
- abfd, name, h->type, ELF_ST_TYPE (isym->st_info));
+ unsigned int type = ELF_ST_TYPE (isym->st_info);
+
+ /* Turn an IFUNC symbol from a DSO into a normal FUNC
+ symbol. */
+ if (type == STT_GNU_IFUNC
+ && (abfd->flags & DYNAMIC) != 0)
+ type = STT_FUNC;
- h->type = ELF_ST_TYPE (isym->st_info);
+ if (h->type != type)
+ {
+ if (h->type != STT_NOTYPE && ! type_change_ok)
+ (*_bfd_error_handler)
+ (_("Warning: type of symbol `%s' changed"
+ " from %d to %d in %B"),
+ abfd, name, h->type, type);
+
+ h->type = type;
+ }
}
/* Merge st_other field. */
@@ -8683,12 +8692,17 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
|| ELF_ST_BIND (sym.st_info) == STB_WEAK))
{
int bindtype;
+ unsigned int type = ELF_ST_TYPE (sym.st_info);
+
+ /* Turn an undefined IFUNC symbol into a normal FUNC symbol. */
+ if (type == STT_GNU_IFUNC)
+ type = STT_FUNC;
if (h->ref_regular_nonweak)
bindtype = STB_GLOBAL;
else
bindtype = STB_WEAK;
- sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
+ sym.st_info = ELF_ST_INFO (bindtype, type);
}
/* If this is a symbol defined in a dynamic library, don't use the