Add support for -Bsymbolic.
authorIan Lance Taylor <iant@google.com>
Thu, 18 Oct 2007 23:20:53 +0000 (23:20 +0000)
committerIan Lance Taylor <iant@google.com>
Thu, 18 Oct 2007 23:20:53 +0000 (23:20 +0000)
gold/options.cc
gold/options.h
gold/parameters.cc
gold/parameters.h
gold/symtab.h

index 6911e032a3333f85ab1eecde7623e6945fdc41a0..9513f15188d153620e699c0851cba07961686335 100644 (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_(),
index fd43de3daab94249c07bd20bb5dc525582697313..701aa9c6a046bb2675d1acb3770e34c3220317c4 100644 (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_;
index 7fe9ceb1c764ab181de4e8329c554427d89803cb..f8d6039fad8414b2724e4fc2b9d62a42e24416a6 100644 (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()),
index 4a19cb672174f1626afc3ee4decc7756c62df2dd..132aadab0781561a564d7a91fac7decfe2be57a4 100644 (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_;
index d8e68a0276975c2767cf29532f66e4ab2aa4c3d2..f7576b9fd82619255f5f23322bfcb219f0e34432 100644 (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
This page took 0.0291 seconds and 4 git commands to generate.