aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc31
1 files changed, 27 insertions, 4 deletions
diff --git a/gold/options.cc b/gold/options.cc
index a80f32c..f2fb560 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -717,10 +717,33 @@ General_options::finalize()
program_name);
#endif
- // 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.
- this->add_to_library_path_with_sysroot("/lib");
- this->add_to_library_path_with_sysroot("/usr/lib");
+ if (this->user_set_Y())
+ {
+ std::string s = this->Y();
+ if (s.compare(0, 2, "P,") == 0)
+ s.erase(0, 2);
+
+ size_t pos = 0;
+ size_t next_pos;
+ do
+ {
+ next_pos = s.find(':', pos);
+ size_t len = (next_pos == std::string::npos
+ ? next_pos
+ : next_pos - pos);
+ if (len != 0)
+ this->add_to_library_path_with_sysroot(s.substr(pos, len).c_str());
+ pos = next_pos + 1;
+ }
+ while (next_pos != std::string::npos);
+ }
+ else
+ {
+ // 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.
+ this->add_to_library_path_with_sysroot("/lib");
+ this->add_to_library_path_with_sysroot("/usr/lib");
+ }
// Normalize library_path() by adding the sysroot to all directories
// in the path, as appropriate.