mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
Fix problems with the --dynamic-list option.
PR gold/13577 complains that even though symbols listed in the --dynamic-list script are exported, they are still bound symbolically if -Bsymbolic is also used. There are two underlying problems here. First, -Bsymbolic should be overridden by --dynamic-list, since the dynamic list provides an explicit list of symbols that are not bound within the library, and if we go ahead and set DT_SYMBOLIC, then the dynamic loader will bind it within the library anyway. Second, gold did not properly identify the symbols listed in the file as preemptible. PR gold/16530 complains that symbols listed in the --dynamic-list script can still be garbage collected. I've fixed this by checking the symbols as they're added to the symbol table. (Unlike the --export-dynamic-symbol option, we can't iterate over the list, because the --dynamic-list script can have wildcards in it.) gold/ 2014-02-05 Cary Coutant <ccoutant@google.com> PR gold/13577 * options.cc (General_options::parse_dynamic_list): Set have_dynamic_list_. (General_options::General_options): Initialize have_dynamic_list_. (General_options::finalize): Turn off -Bsymbolic and -Bsymbolic-functions if --dynamic-list provided. * options.h (General_options::have_dynamic_list): New function. (General_options::have_dynamic_list_): New data member. * symtab.h (Symbol::is_preemptible): Handle --dynamic-list correctly. PR gold/16530 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named in --dynamic-list, mark it. * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case. (dynamic_list_2): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/dynamic_list_2.cc: New file. * testsuite/dynamic_list_2.t: New file. * testsuite/dynamic_list_lib1.cc: New file. * testsuite/dynamic_list_lib2.cc: New file. * testsuite/gc_dynamic_list_test.c: New file. * testsuite/gc_dynamic_list_test.sh: New file. * testsuite/gc_dynamic_list_test.t: New file.
This commit is contained in:
@@ -1438,6 +1438,11 @@ class General_options
|
||||
in_dynamic_list(const char* symbol) const
|
||||
{ return this->dynamic_list_.version_script_info()->symbol_is_local(symbol); }
|
||||
|
||||
// True if a --dynamic-list script was provided.
|
||||
bool
|
||||
have_dynamic_list() const
|
||||
{ return this->have_dynamic_list_; }
|
||||
|
||||
// Finalize the dynamic list.
|
||||
void
|
||||
finalize_dynamic_list()
|
||||
@@ -1591,6 +1596,8 @@ class General_options
|
||||
// script.cc, we store this as a Script_options object, even though
|
||||
// we only use a single Version_tree from it.
|
||||
Script_options dynamic_list_;
|
||||
// Whether a --dynamic-list file was provided.
|
||||
bool have_dynamic_list_;
|
||||
// The incremental linking mode.
|
||||
Incremental_mode incremental_mode_;
|
||||
// The disposition given by the --incremental-changed,
|
||||
|
||||
Reference in New Issue
Block a user