diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-06-03 14:45:44 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-06-03 14:45:44 +0000 |
commit | c72f8e9f9d5b7a9c1717428f02ba30ad3f401799 (patch) | |
tree | 0c38199b7adc32173620b21be1dbee2055bb70f1 /tools/gold | |
parent | 869d60d39d579b2051a8e34f460de72f071c2172 (diff) |
Don't preserve all symbols in a .so and instead trust gold to know what is
needed. The result is that now we are able to drop unnecessary symbol from
shared libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2e5c1790c68..7059210a4b6 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -343,19 +343,17 @@ static ld_plugin_status all_symbols_read_hook(void) { // If we don't preserve any symbols, libLTO will assume that all symbols are // needed. Keep all symbols unless we're producing a final executable. - if (output_type == LTO_CODEGEN_PIC_MODEL_STATIC) { - bool anySymbolsPreserved = false; - for (std::list<claimed_file>::iterator I = Modules.begin(), + bool anySymbolsPreserved = false; + for (std::list<claimed_file>::iterator I = Modules.begin(), E = Modules.end(); I != E; ++I) { - (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]); - for (unsigned i = 0, e = I->syms.size(); i != e; i++) { - if (I->syms[i].resolution == LDPR_PREVAILING_DEF) { - lto_codegen_add_must_preserve_symbol(cg, I->syms[i].name); - anySymbolsPreserved = true; - - if (options::generate_api_file) - api_file << I->syms[i].name << "\n"; - } + (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]); + for (unsigned i = 0, e = I->syms.size(); i != e; i++) { + if (I->syms[i].resolution == LDPR_PREVAILING_DEF) { + lto_codegen_add_must_preserve_symbol(cg, I->syms[i].name); + anySymbolsPreserved = true; + + if (options::generate_api_file) + api_file << I->syms[i].name << "\n"; } } |