From 706e1f5e80a60c1c30a0e075bcc8228ed3d905fc Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Apr 2008 20:28:34 +0000 Subject: * 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". --- gold/options.cc | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'gold/options.cc') 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. -- cgit v1.1