2010-05-18 Rafael Espindola <espindola@google.com>
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Tue, 18 May 2010 18:08:03 +0000 (18:08 +0000)
committerRafael Ávila de Espíndola <respindola@mozilla.com>
Tue, 18 May 2010 18:08:03 +0000 (18:08 +0000)
* options.cc (General_options::finalize): Handle -nostdlib.
* options.h (nostdlib): New option.
* script.cc (script_add_search_dir): Handle -nostdlib.

gold/ChangeLog
gold/options.cc
gold/options.h
gold/script.cc

index 71bbf2aec2b195f6b0fb40755f321bbeb1e6185e..1085875c225b8faf7dc707ee97e6fbb3d1058846 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-18  Rafael Espindola  <espindola@google.com>
+
+       * options.cc (General_options::finalize): Handle -nostdlib.
+       * options.h (nostdlib): New option.
+       * script.cc (script_add_search_dir): Handle -nostdlib.
+
 2010-05-12  Doug Kwan  <dougkwan@google.com>
 
        * arm.cc (Target_arm::do_finalize_sections): Create an empty
index c566b99b2ada5128ca9cd80a3600b6c602504629..b209f85e30597221a7fcfad98ca5e66761be1601 100644 (file)
@@ -1074,7 +1074,7 @@ General_options::finalize()
        }
       while (next_pos != std::string::npos);
     }
-  else
+  else if (!this->nostdlib())
     {
       // Even if they don't specify it, we add -L /lib and -L /usr/lib.
       // FIXME: We should only do this when configured in native mode.
index ca5f74d9c84563a063c15a8260d5ae4790ecc8d8..1e328a8dbecf94041c858073c0414d4d7699af18 100644 (file)
@@ -800,6 +800,10 @@ class General_options
   DEFINE_dirlist(library_path, options::TWO_DASHES, 'L',
                  N_("Add directory to search path"), N_("DIR"));
 
+  DEFINE_bool(nostdlib, options::ONE_DASH, '\0', false,
+              N_(" Only search directories specified on the command line."),
+              NULL);
+
   DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
                 N_("Ignored for compatibility"), N_("EMULATION"));
 
index a68fb3865a02b0f6bd1207bbe2daf02412e53049..fc036bbdaed766e39f5e5bbf8b6ea863be4c5c61 100644 (file)
@@ -2767,7 +2767,7 @@ script_add_search_dir(void* closurev, const char* option, size_t length)
     gold_warning(_("%s:%d:%d: ignoring SEARCH_DIR; SEARCH_DIR is only valid"
                   " for scripts specified via -T/--script"),
                 closure->filename(), closure->lineno(), closure->charpos());
-  else
+  else if (!closure->command_line()->options().nostdlib())
     {
       std::string s = "-L" + std::string(option, length);
       script_parse_option(closurev, s.c_str(), s.size());