diff options
author | Ian Lance Taylor <ian@airs.com> | 2011-11-03 04:32:01 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2011-11-03 04:32:01 +0000 |
commit | 3f3cddf146bb20f8222ce6ed8c8ffc6ee9c59124 (patch) | |
tree | ca8130f91064ed5ffc266840f2633256acae10e9 /gold/options.cc | |
parent | a8e2273bba9b658132165d70edb8b47023193e82 (diff) | |
download | gdb-3f3cddf146bb20f8222ce6ed8c8ffc6ee9c59124.zip gdb-3f3cddf146bb20f8222ce6ed8c8ffc6ee9c59124.tar.gz gdb-3f3cddf146bb20f8222ce6ed8c8ffc6ee9c59124.tar.bz2 |
* configure.ac: Add --with-lib-path option. Define LIB_PATH and
NATIVE_LINKER.
* Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
* options.cc (General_options::finalize): Use library search path
from configure script if specified. If not native and no sysroot,
only search TOOLLIBDIR.
* options.h (Search_directory::Search_directory): Change name to
const std::string&.
(General_options::add_to_library_path_with_sysroot): Change arg to
const std::string&.
* configure, Makefile.in, config.in: Rebuild.
Diffstat (limited to 'gold/options.cc')
-rw-r--r-- | gold/options.cc | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/gold/options.cc b/gold/options.cc index dcf6ba7..64a8539 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -1121,33 +1121,48 @@ General_options::finalize() program_name); #endif + std::string libpath; if (this->user_set_Y()) { - std::string s = this->Y(); - if (s.compare(0, 2, "P,") == 0) - s.erase(0, 2); + libpath = this->Y(); + if (libpath.compare(0, 2, "P,") == 0) + libpath.erase(0, 2); + } + else if (!this->nostdlib()) + { +#ifndef NATIVE_LINKER +#define NATIVE_LINKER 0 +#endif + const char* p = LIB_PATH; + if (strcmp(p, "::DEFAULT::") != 0) + libpath = p; + else if (NATIVE_LINKER + || this->user_set_sysroot() + || *TARGET_SYSTEM_ROOT != '\0') + { + this->add_to_library_path_with_sysroot("/lib"); + this->add_to_library_path_with_sysroot("/usr/lib"); + } + else + this->add_to_library_path_with_sysroot(TOOLLIBDIR); + } + if (!libpath.empty()) + { size_t pos = 0; size_t next_pos; do { - next_pos = s.find(':', pos); + next_pos = libpath.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()); + this->add_to_library_path_with_sysroot(libpath.substr(pos, len)); pos = next_pos + 1; } while (next_pos != std::string::npos); } - 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. - this->add_to_library_path_with_sysroot("/lib"); - this->add_to_library_path_with_sysroot("/usr/lib"); - } // Parse the contents of -retain-symbols-file into a set. if (this->retain_symbols_file()) |