diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-07-30 03:27:44 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-07-30 03:28:00 -0700 |
commit | c6e8a9a802bcd3a96ef14b6ea1b6cd60d5d8d065 (patch) | |
tree | 2f89635eb9cf57993817771a73573a5e1fcc72a3 /bfd/elflink.c | |
parent | 13be649613bb62e75296d1f69a7c889ddf29a564 (diff) | |
download | gdb-c6e8a9a802bcd3a96ef14b6ea1b6cd60d5d8d065.zip gdb-c6e8a9a802bcd3a96ef14b6ea1b6cd60d5d8d065.tar.gz gdb-c6e8a9a802bcd3a96ef14b6ea1b6cd60d5d8d065.tar.bz2 |
Don't change the default symbol for relocatable link
We should change the default symbol for the versioned symbol only when
not performing a relocatable link.
bfd/
PR ld/18735
* elflink.c (_bfd_elf_add_default_symbol): Add the default
symbol if not performing a relocatable link.
(elf_link_add_object_symbols): Adjust the default symbol if
not performing a relocatable link.
ld/testsuite/
PR ld/18735
* ld-elf/pr18735.d: New file.
* ld-elf/pr18735.s: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index fc1fd08..846f35e 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1655,12 +1655,17 @@ _bfd_elf_add_default_symbol (bfd *abfd, if (! override) { - bh = &hi->root; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr, - 0, name, FALSE, collect, &bh))) - return FALSE; - hi = (struct elf_link_hash_entry *) bh; + /* Add the default symbol if not performing a relocatable link. */ + if (! info->relocatable) + { + bh = &hi->root; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, shortname, BSF_INDIRECT, + bfd_ind_section_ptr, + 0, name, FALSE, collect, &bh))) + return FALSE; + hi = (struct elf_link_hash_entry *) bh; + } } else { @@ -4609,9 +4614,10 @@ error_free_dyn: old_tab = NULL; } - /* 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) + /* Now that all the symbols from this input file are created, if + not performing a relocatable link, handle .symver foo, foo@BAR + such that any relocs against foo become foo@BAR. */ + if (!info->relocatable && nondeflt_vers != NULL) { bfd_size_type cnt, symidx; |