diff options
author | Alan Modra <amodra@gmail.com> | 2003-10-30 14:13:50 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-10-30 14:13:50 +0000 |
commit | 68b6ddd08f8b349f4da7d3a2da151a482db36115 (patch) | |
tree | 39260621927a1c074e699bd26c3e715c56159096 /bfd | |
parent | 3f8b3ef37bb717cf25bfe766ba87e0c4dc19d633 (diff) | |
download | gdb-68b6ddd08f8b349f4da7d3a2da151a482db36115.zip gdb-68b6ddd08f8b349f4da7d3a2da151a482db36115.tar.gz gdb-68b6ddd08f8b349f4da7d3a2da151a482db36115.tar.bz2 |
* elflink.c (_bfd_elf_link_record_dynamic_symbol): Modify versioned
symbol string in place.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elflink.c | 37 |
2 files changed, 18 insertions, 24 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4728081..76042fb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2003-10-30 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Modify versioned + symbol string in place. + 2003-10-30 Jim Blandy <jimb@redhat.com> * cpu-rs6000.c (rs6000_compatible): Check the correct arch_info diff --git a/bfd/elflink.c b/bfd/elflink.c index 19f6d4d..651ffd5 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -353,9 +353,8 @@ _bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, if (h->dynindx == -1) { struct elf_strtab_hash *dynstr; - char *p, *alc; + char *p; const char *name; - bfd_boolean copy; bfd_size_type indx; /* XXX: The ABI draft says the linker must turn hidden and @@ -393,28 +392,18 @@ _bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, table. */ name = h->root.root.string; p = strchr (name, ELF_VER_CHR); - if (p == NULL) - { - alc = NULL; - copy = FALSE; - } - else - { - size_t len = p - name + 1; - - alc = bfd_malloc (len); - if (alc == NULL) - return FALSE; - memcpy (alc, name, len - 1); - alc[len - 1] = '\0'; - name = alc; - copy = TRUE; - } - - indx = _bfd_elf_strtab_add (dynstr, name, copy); - - if (alc != NULL) - free (alc); + if (p != NULL) + /* We know that the p points into writable memory. In fact, + there are only a few symbols that have read-only names, being + those like _GLOBAL_OFFSET_TABLE_ that are created specially + by the backends. Most symbols will have names pointing into + an ELF string table read from a file, or to objalloc memory. */ + *p = 0; + + indx = _bfd_elf_strtab_add (dynstr, name, p != NULL); + + if (p != NULL) + *p = ELF_VER_CHR; if (indx == (bfd_size_type) -1) return FALSE; |