https://sourceware.org/bugzilla/show_bug.cgi?id=16693
--- Comment #4 from Viatcheslav Ostapenko <ostap73 at gmail dot com> --- (In reply to H.J. Lu from comment #3) > (In reply to Viatcheslav Ostapenko from comment #2) > > Created attachment 7465 [details] > > Test > > > > Attached test miniproject. > > > > In resulting test.so dynamic_list_exported_from_static_lib() should be > > exported by dynamic list, but is missing from exports. > > > > --dynamic-list isn't used to control which symbols are exported or > not. From ld manual: > > '--dynamic-list=DYNAMIC-LIST-FILE' > Specify the name of a dynamic list file to the linker. This is > typically used when creating shared libraries to specify a list of > global symbols whose references shouldn't be bound to the > definition within the shared library, or creating dynamically > linked executables to specify a list of symbols which should be > added to the symbol table in the executable. This option is only > meaningful on ELF platforms which support shared libraries. That's very strange! >From code in symtab.cc (should_add_dynsym_entry): // If the symbol was forced dynamic in a --dynamic-list file // or an --export-dynamic-symbol option, add it. if (!this->is_from_dynobj() && (parameters->options().in_dynamic_list(this->name()) || parameters->options().is_export_dynamic_symbol(this->name()))) { if (!this->is_forced_local()) return true; gold_warning(_("Cannot export local symbol '%s'"), this->demangled_name().c_str()); return false; } At least from code here it seems dynamic-list option does the same as export-dynamic-symbol option, but not for the single symbol, but for the list or pattern specified in file. I see clear use case for this when developer chooses to specify exports in a single file. > If you remove/change --dynamic-list, you will get the same set of > symbols in dynamic symbol table. Please tell us exactly what you > want to see in test.so. Sorry, I forgot to specify default visibility for symbols. Tried it now and got into another problem. If I specify default visibility then I get warnings: ld.gold: warning: Cannot export local symbol 'dynamic_list_exported_directly' ld.gold: warning: Cannot export local symbol 'dynamic_list_exported_from_static_lib' And those functions are not exported. It is the same code piece I've pasted above and you can see that it hits is_forced_local() local condition. Function force_local is called on condition: if ((ret->visibility() == elfcpp::STV_HIDDEN || ret->visibility() == elfcpp::STV_INTERNAL) && (ret->binding() == elfcpp::STB_GLOBAL || ret->binding() == elfcpp::STB_GNU_UNIQUE || ret->binding() == elfcpp::STB_WEAK) && !parameters->options().relocatable()) That means that there is no way to hide all symbols by default and override with --dynamic-list or --export-dynamic-symbol . -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils