aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-02-13 22:14:11 +0000
committerJakub Jelinek <jakub@redhat.com>2003-02-13 22:14:11 +0000
commit9147e853bf5d168c176eb3993f93bda12de96232 (patch)
treedd406335a96b74a500bd03985f52327908e76a15 /bfd
parent40f235b7e218cc05a6cc5eea2aaac15d1e292058 (diff)
downloadgdb-9147e853bf5d168c176eb3993f93bda12de96232.zip
gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.gz
gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.bz2
bfd/
* elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO. ld/testsuite/ * ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too. xfail tests linking non-pic code into shared libs on x86_64-*-linux*. * ld-elfvsb/elfvsb.exp: Likewise. * ld-elfvers/vers.exp: Likewise. Add vers24a, vers24b and vers24c tests. * ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_* version. * ld-elfvers/vers19.ver: Likewise. * ld-elfvers/vers24a.c: New test. * ld-elfvers/vers24b.c: New test. * ld-elfvers/vers24c.c: New test. * ld-elfvers/vers24.map: New test. * ld-elfvers/vers24.rd: New test. * lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument cflags. If source files have .c extension, compile them first.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elflink.h70
2 files changed, 74 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f5c91e5..419e7e8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
+
2003-02-13 Nick Clifton <nickc@redhat.com>
* elf32-arm.h (elf32_thumb_to_arm_stub): Include section VMAs
diff --git a/bfd/elflink.h b/bfd/elflink.h
index a70f873..6b5922f 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -1168,6 +1168,8 @@ elf_link_add_object_symbols (abfd, info)
Elf_External_Versym *extversym = NULL;
Elf_External_Versym *ever;
struct elf_link_hash_entry *weaks;
+ struct elf_link_hash_entry **nondeflt_vers = NULL;
+ bfd_size_type nondeflt_vers_cnt = 0;
Elf_Internal_Sym *isymbuf = NULL;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
@@ -1997,6 +1999,23 @@ elf_link_add_object_symbols (abfd, info)
override, dt_needed))
goto error_free_vers;
+ if (definition && (abfd->flags & DYNAMIC) == 0)
+ {
+ char *p = strchr (name, ELF_VER_CHR);
+ if (p != NULL && p[1] != ELF_VER_CHR)
+ {
+ /* Queue non-default versions so that .symver x, x@FOO
+ aliases can be checked. */
+ if (! nondeflt_vers)
+ {
+ amt = (isymend - isym + 1)
+ * sizeof (struct elf_link_hash_entry *);
+ nondeflt_vers = bfd_malloc (amt);
+ }
+ nondeflt_vers [nondeflt_vers_cnt++] = h;
+ }
+ }
+
if (dynsym && h->dynindx == -1)
{
if (! _bfd_elf_link_record_dynamic_symbol (info, h))
@@ -2071,6 +2090,55 @@ elf_link_add_object_symbols (abfd, info)
}
}
+ /* Now that all the symbols from this input file are created, handle
+ .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */
+ if (nondeflt_vers != NULL)
+ {
+ bfd_size_type cnt, symidx;
+
+ for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
+ {
+ struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
+ char *shortname, *p;
+
+ p = strchr (h->root.root.string, ELF_VER_CHR);
+ if (p == NULL
+ || (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak))
+ continue;
+
+ amt = p - h->root.root.string;
+ shortname = bfd_malloc (amt + 1);
+ memcpy (shortname, h->root.root.string, amt);
+ shortname[amt] = '\0';
+
+ hi = (struct elf_link_hash_entry *)
+ bfd_link_hash_lookup (info->hash, shortname,
+ FALSE, FALSE, FALSE);
+ if (hi != NULL
+ && hi->root.type == h->root.type
+ && hi->root.u.def.value == h->root.u.def.value
+ && hi->root.u.def.section == h->root.u.def.section)
+ {
+ (*bed->elf_backend_hide_symbol) (info, hi, TRUE);
+ hi->root.type = bfd_link_hash_indirect;
+ hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
+ (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+ sym_hash = elf_sym_hashes (abfd);
+ if (sym_hash)
+ for (symidx = 0; symidx < extsymcount; ++symidx)
+ if (sym_hash[symidx] == hi)
+ {
+ sym_hash[symidx] = h;
+ break;
+ }
+ }
+ free (shortname);
+ }
+ free (nondeflt_vers);
+ nondeflt_vers = NULL;
+ }
+
if (extversym != NULL)
{
free (extversym);
@@ -2277,6 +2345,8 @@ elf_link_add_object_symbols (abfd, info)
return TRUE;
error_free_vers:
+ if (nondeflt_vers != NULL)
+ free (nondeflt_vers);
if (extversym != NULL)
free (extversym);
error_free_sym: