aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2014-02-05 14:01:52 -0800
committerCary Coutant <ccoutant@google.com>2014-02-05 18:01:47 -0800
commitfd834e57ffce2f5dbe3443f034e68cebd63ee89a (patch)
tree6a5324243f95c8d47ee76b928cb3ca02076e184e /gold/options.cc
parentee1e2d4fb692736c754b42b69eb88c1f436c5f15 (diff)
downloadgdb-fd834e57ffce2f5dbe3443f034e68cebd63ee89a.zip
gdb-fd834e57ffce2f5dbe3443f034e68cebd63ee89a.tar.gz
gdb-fd834e57ffce2f5dbe3443f034e68cebd63ee89a.tar.bz2
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.
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 000e6d0..6b49459 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -549,6 +549,7 @@ General_options::parse_dynamic_list(const char*, const char* arg,
{
if (!read_dynamic_list(arg, cmdline, &this->dynamic_list_))
gold::gold_fatal(_("unable to parse dynamic-list script file %s"), arg);
+ this->have_dynamic_list_ = true;
}
void
@@ -918,6 +919,7 @@ General_options::General_options()
do_demangle_(false),
plugins_(NULL),
dynamic_list_(),
+ have_dynamic_list_(false),
incremental_mode_(INCREMENTAL_OFF),
incremental_disposition_(INCREMENTAL_STARTUP),
incremental_startup_disposition_(INCREMENTAL_CHECK),
@@ -1199,6 +1201,13 @@ General_options::finalize()
// in the path, as appropriate.
this->add_sysroot();
+ // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
+ if (this->have_dynamic_list())
+ {
+ this->set_Bsymbolic(false);
+ this->set_Bsymbolic_functions(false);
+ }
+
// Now that we've normalized the options, check for contradictory ones.
if (this->shared() && this->is_static())
gold_fatal(_("-shared and -static are incompatible"));