aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-18 23:20:53 +0000
committerIan Lance Taylor <iant@google.com>2007-10-18 23:20:53 +0000
commit51b08ebe94b5dbaa1feb97d2b062e0098e277ea9 (patch)
treebfc86ec4e97c4879532a4539c94442130e70022f /gold
parentaf4a8a833e23e7d7bba9fa3c3b5ff9325dc3df94 (diff)
downloadgdb-51b08ebe94b5dbaa1feb97d2b062e0098e277ea9.zip
gdb-51b08ebe94b5dbaa1feb97d2b062e0098e277ea9.tar.gz
gdb-51b08ebe94b5dbaa1feb97d2b062e0098e277ea9.tar.bz2
Add support for -Bsymbolic.
Diffstat (limited to 'gold')
-rw-r--r--gold/options.cc3
-rw-r--r--gold/options.h10
-rw-r--r--gold/parameters.cc2
-rw-r--r--gold/parameters.h8
-rw-r--r--gold/symtab.h3
5 files changed, 24 insertions, 2 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 6911e03..9513f15 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 fd43de3..701aa9c 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
@@ -267,6 +272,10 @@ class General_options
{ 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 7fe9ceb..f8d6039 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 4a19cb6..132aada 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 d8e68a0..f7576b9 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