aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc6
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();
}
}