aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-02-14 17:03:45 +0000
committerMike Frysinger <vapier@gentoo.org>2011-02-14 17:03:45 +0000
commit93252b1cf41a1638dc1c4a3d9688f2dbb5963504 (patch)
tree456755cee65d44c5321901f68825006bb4bdd876 /bfd/elflink.c
parent6bfc80c7385fe08f025e6e774655bc90441e2254 (diff)
downloadbinutils-93252b1cf41a1638dc1c4a3d9688f2dbb5963504.zip
binutils-93252b1cf41a1638dc1c4a3d9688f2dbb5963504.tar.gz
binutils-93252b1cf41a1638dc1c4a3d9688f2dbb5963504.tar.bz2
bfd/ld: handle ABI prefixes in version scripts
The default language in version scripts is supposed to be C, but no symbol demangling is performed on the symbols by default. This makes targets with a symbol prefix to fail with most version scripts out there. So strip away this prefix by default. This fixes many tests (real world and ld's testsuite) for Blackfin targets and doesn't seem to cause regressions for x86_64. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 79256bf..dffe0ae 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5710,11 +5710,12 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
{
const char *verstr, *name;
size_t namelen, verlen, newlen;
- char *newname, *p;
+ char *newname, *p, leading_char;
struct elf_link_hash_entry *newh;
+ leading_char = bfd_get_symbol_leading_char (output_bfd);
name = d->pattern;
- namelen = strlen (name);
+ namelen = strlen (name) + (leading_char != '\0');
verstr = t->name;
verlen = strlen (verstr);
newlen = namelen + verlen + 3;
@@ -5722,7 +5723,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
newname = (char *) bfd_malloc (newlen);
if (newname == NULL)
return FALSE;
- memcpy (newname, name, namelen);
+ newname[0] = leading_char;
+ memcpy (newname + (leading_char != '\0'), name, namelen);
/* Check the hidden versioned definition. */
p = newname + namelen;