aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-25 07:56:18 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-07-25 08:07:33 -0700
commit1659f720b0818d6666570f79bef53ac461b2b22f (patch)
treeaa2b16c78a464506c355f240add209c61aa31236 /bfd/elflink.c
parent4a11f2065906976675808364ddbd1c0f77eea41f (diff)
downloadgdb-1659f720b0818d6666570f79bef53ac461b2b22f.zip
gdb-1659f720b0818d6666570f79bef53ac461b2b22f.tar.gz
gdb-1659f720b0818d6666570f79bef53ac461b2b22f.tar.bz2
Skip missing symbol version section check for executable
Missing symbol version section is a run-time problem only if it will be referenced dynamically at run-time. We should skip the check for locally defined symbol, which isn't referenced by shared library, when linking executable. bfd/ PR ld/18718 * elflink.c (elf_link_output_extsym): Check symbol version section check only if not linking executable, the symbol is referenced by shared library or not locally defined. ld/testsuite/ PR ld/18718 * ld-elf/pr18718.c: New file. * ld-elf/shared.exp: Run tests for PR ld/18718.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b741e7e..ccb7ba2 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -9217,8 +9217,12 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
/* Since there is no version information in the dynamic string,
if there is no version info in symbol version section, we will
- have a run-time problem. */
- if (h->verinfo.verdef == NULL)
+ have a run-time problem if not linking executable, referenced
+ by shared library, or not locally defined. */
+ if (h->verinfo.verdef == NULL
+ && (!flinfo->info->executable
+ || h->ref_dynamic
+ || !h->def_regular))
{
char *p = strrchr (h->root.root.string, ELF_VER_CHR);