diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-12-13 02:29:37 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-12-13 02:29:37 +0000 |
commit | 440f391466d3cdcc323c5173d395375d5f74752e (patch) | |
tree | 86022310e22cd3d9916888baa341ca83a16293dd /bfd/elflink.h | |
parent | 8dd6fde3e5ea3909e3a29be820a7b12925f90329 (diff) | |
download | gdb-440f391466d3cdcc323c5173d395375d5f74752e.zip gdb-440f391466d3cdcc323c5173d395375d5f74752e.tar.gz gdb-440f391466d3cdcc323c5173d395375d5f74752e.tar.bz2 |
* elflink.h (elf_link_add_object_symbols): Only add a weak
symbol if the real definition is in the dynamic symbol table.
After finding the real definition, then, if it is dynamic, add the
weak symbol to the dynamic symbol table.
PR 11244.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r-- | bfd/elflink.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h index 8be2f2d..5097b4c 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -810,8 +810,7 @@ elf_link_add_object_symbols (abfd, info) reference or definition we just found. Keep a count of the number of dynamic symbols we find. A dynamic symbol is one which is referenced or defined by both a regular - object and a shared object, or one which is referenced or - defined by more than one shared object. */ + object and a shared object. */ old_flags = h->elf_link_hash_flags; dynsym = false; if (! dynamic) @@ -834,8 +833,8 @@ elf_link_add_object_symbols (abfd, info) if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0 || (h->weakdef != NULL - && (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0)) + && ! new_weakdef + && h->weakdef->dynindx != -1)) dynsym = true; } @@ -912,6 +911,18 @@ elf_link_add_object_symbols (abfd, info) goto error_return; } + /* If the real definition is in the list of dynamic + symbols, make sure the weak definition is put there + as well. If we don't do this, then the dynamic + loader might not merge the entries for the real + definition and the weak definition. */ + if (h->dynindx != -1 + && hlook->dynindx == -1) + { + if (! _bfd_elf_link_record_dynamic_symbol (info, hlook)) + goto error_return; + } + break; } } |