aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-04-11 20:28:34 +0000
committerIan Lance Taylor <ian@airs.com>2008-04-11 20:28:34 +0000
commit706e1f5e80a60c1c30a0e075bcc8228ed3d905fc (patch)
treeacf39b572803a7ec9796c1b401a6ec33462d4233 /gold/options.cc
parent52a952116ffe3384e3c72a9742f831a5fa072052 (diff)
downloadfsf-binutils-gdb-706e1f5e80a60c1c30a0e075bcc8228ed3d905fc.zip
fsf-binutils-gdb-706e1f5e80a60c1c30a0e075bcc8228ed3d905fc.tar.gz
fsf-binutils-gdb-706e1f5e80a60c1c30a0e075bcc8228ed3d905fc.tar.bz2
* options.h (General_options): Add entries for '-Y' and
'-relax'. * options.cc (General_options:finalize): If -Y was used, add those entries to the library path instead of the default "/lib" and "/usr/lib".
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.