Add support for -Bsymbolic.

This commit is contained in:
Ian Lance Taylor 2007-10-18 23:20:53 +00:00
parent af4a8a833e
commit 51b08ebe94
5 changed files with 24 additions and 2 deletions

View File

@ -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_(),

View File

@ -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_;

View File

@ -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()),

View File

@ -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_;

View File

@ -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