From: Ian Lance Taylor Date: Thu, 18 Oct 2007 23:20:53 +0000 (+0000) Subject: Add support for -Bsymbolic. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=51b08ebe94b5dbaa1feb97d2b062e0098e277ea9;p=binutils-gdb.git Add support for -Bsymbolic. --- diff --git a/gold/options.cc b/gold/options.cc index 6911e032a33..9513f15188d 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -312,6 +312,8 @@ options::Command_line_options::options[] = POSDEP_NOARG('\0', "no-as-needed", N_("Always DT_NEEDED for dynamic libs (default)"), NULL, TWO_DASHES, &Position_dependent_options::clear_as_needed), + GENERAL_NOARG('\0', "Bsymbolic", N_("Bind defined symbols locally"), + NULL, ONE_DASH, &General_options::set_symbolic), GENERAL_NOARG('E', "export-dynamic", N_("Export all dynamic symbols"), NULL, TWO_DASHES, &General_options::set_export_dynamic), GENERAL_NOARG('\0', "eh-frame-hdr", N_("Create exception frame header"), @@ -407,6 +409,7 @@ General_options::General_options() output_file_name_("a.out"), is_relocatable_(false), strip_(STRIP_NONE), + symbolic_(false), create_eh_frame_hdr_(false), rpath_(), rpath_link_(), diff --git a/gold/options.h b/gold/options.h index fd43de3daab..701aa9c6a04 100644 --- a/gold/options.h +++ b/gold/options.h @@ -144,6 +144,11 @@ class General_options strip_debug() const { return this->strip_ == STRIP_ALL || this->strip_ == STRIP_DEBUG; } + // -Bsymbolic: bind defined symbols locally. + bool + symbolic() const + { return this->symbolic_; } + // --eh-frame-hdr: Whether to generate an exception frame header. bool create_eh_frame_hdr() const @@ -266,6 +271,10 @@ class General_options set_strip_debug() { this->strip_ = STRIP_DEBUG; } + void + set_symbolic() + { this->symbolic_ = true; } + void set_create_eh_frame_hdr() { this->create_eh_frame_hdr_ = true; } @@ -366,6 +375,7 @@ class General_options const char* output_file_name_; bool is_relocatable_; Strip strip_; + bool symbolic_; bool create_eh_frame_hdr_; Dir_list rpath_; Dir_list rpath_link_; diff --git a/gold/parameters.cc b/gold/parameters.cc index 7fe9ceb1c76..f8d6039fad8 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -32,7 +32,7 @@ namespace gold Parameters::Parameters(const General_options* options, Errors* errors) : errors_(errors), output_file_name_(options->output_file_name()), - sysroot_(options->sysroot()), + sysroot_(options->sysroot()), symbolic_(options->symbolic()), is_doing_static_link_valid_(false), doing_static_link_(false), is_size_and_endian_valid_(false), size_(0), is_big_endian_(false), optimization_level_(options->optimization_level()), diff --git a/gold/parameters.h b/gold/parameters.h index 4a19cb67217..132aadab078 100644 --- a/gold/parameters.h +++ b/gold/parameters.h @@ -91,6 +91,12 @@ class Parameters strip_debug() const { return this->strip_ == STRIP_ALL || this->strip_ == STRIP_DEBUG; } + // Whether we are doing a symbolic link, in which all defined + // symbols are bound locally. + bool + symbolic() const + { return this->symbolic_; } + // Whether we are doing a static link--a link in which none of the // input files are shared libraries. This is only known after we // have seen all the input files. @@ -170,6 +176,8 @@ class Parameters std::string sysroot_; // Which symbols to strip. Strip strip_; + // Whether we are doing a symbolic link. + bool symbolic_; // Whether the doing_static_link_ field is valid. bool is_doing_static_link_valid_; diff --git a/gold/symtab.h b/gold/symtab.h index d8e68a02769..f7576b9fd82 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -407,7 +407,8 @@ class Symbol { return (this->visibility_ != elfcpp::STV_INTERNAL && this->visibility_ != elfcpp::STV_HIDDEN - && this->visibility_ != elfcpp::STV_PROTECTED); + && this->visibility_ != elfcpp::STV_PROTECTED + && !parameters->symbolic()); } // Return whether there should be a warning for references to this