diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-11-05 06:24:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-11-05 06:24:39 +0000 |
commit | 594c8e5ede2a93362f335a97389eaadac17ec204 (patch) | |
tree | f6fa13b594ad3af2539139a534d3645daefb4fbf /gold/symtab.cc | |
parent | 946ef19679549c1751ca5c3a963f48c21112e19b (diff) | |
download | gdb-594c8e5ede2a93362f335a97389eaadac17ec204.zip gdb-594c8e5ede2a93362f335a97389eaadac17ec204.tar.gz gdb-594c8e5ede2a93362f335a97389eaadac17ec204.tar.bz2 |
PR 10880
* object.h (class Object): Add is_needed and set_is_needed
methods. Add is_needed_ field. Make bool fields into bitfields.
* symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
defined in a dynamic object and referenced by a regular object,
set is_needed for the dynamic object.
* layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
if the file is marked with as_needed and it is not needed.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r-- | gold/symtab.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc index af27210..dd52145 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -2243,6 +2243,12 @@ Symbol_table::set_dynsym_indexes(unsigned int index, // Record any version information. if (sym->version() != NULL) versions->record_version(this, dynpool, sym); + + // If the symbol is defined in a dynamic object and is + // referenced in a regular object, then mark the dynamic + // object as needed. This is used to implement --as-needed. + if (sym->is_from_dynobj() && sym->in_reg()) + sym->object()->set_is_needed(); } } |