diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2015-02-26 20:09:50 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2015-02-26 20:09:50 +0000 |
commit | 82ae48eeb5e79ee9ecf1f6e7d8a433e45cfca4d0 (patch) | |
tree | a153b7832ed50cbceb7d8cf1889bfbbd5040faf9 | |
parent | 27967c843be0f1215c70fe0970793070e8cdeea3 (diff) | |
download | llvm-82ae48eeb5e79ee9ecf1f6e7d8a433e45cfca4d0.zip llvm-82ae48eeb5e79ee9ecf1f6e7d8a433e45cfca4d0.tar.gz llvm-82ae48eeb5e79ee9ecf1f6e7d8a433e45cfca4d0.tar.bz2 |
[Driver] Use paths explicitly provided by the -L option before default paths
User should be able to override default search paths using the -L
option.
http://reviews.llvm.org/D7902
llvm-svn: 230679
-rw-r--r-- | lld/lib/Driver/GnuLdDriver.cpp | 8 | ||||
-rw-r--r-- | lld/test/Driver/Inputs/libtest.a | 1 | ||||
-rw-r--r-- | lld/test/Driver/def-lib-search.test | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp index 16ffa98..48ec24a 100644 --- a/lld/lib/Driver/GnuLdDriver.cpp +++ b/lld/lib/Driver/GnuLdDriver.cpp @@ -423,10 +423,6 @@ bool GnuLdDriver::parse(int argc, const char *argv[], if (auto *arg = parsedArgs->getLastArg(OPT_sysroot)) ctx->setSysroot(arg->getValue()); - // Add the default search directory specific to the target. - if (!parsedArgs->hasArg(OPT_nostdlib)) - addPlatformSearchDirs(*ctx, triple, baseTriple); - // Handle --demangle option(For compatibility) if (parsedArgs->hasArg(OPT_demangle)) ctx->setDemangleSymbols(true); @@ -545,6 +541,10 @@ bool GnuLdDriver::parse(int argc, const char *argv[], for (auto *arg : parsedArgs->filtered(OPT_L)) ctx->addSearchPath(arg->getValue()); + // Add the default search directory specific to the target. + if (!parsedArgs->hasArg(OPT_nostdlib)) + addPlatformSearchDirs(*ctx, triple, baseTriple); + for (auto *arg : parsedArgs->filtered(OPT_u)) ctx->addInitialUndefinedSymbol(arg->getValue()); diff --git a/lld/test/Driver/Inputs/libtest.a b/lld/test/Driver/Inputs/libtest.a new file mode 100644 index 0000000..8b277f0 --- /dev/null +++ b/lld/test/Driver/Inputs/libtest.a @@ -0,0 +1 @@ +!<arch> diff --git a/lld/test/Driver/def-lib-search.test b/lld/test/Driver/def-lib-search.test new file mode 100644 index 0000000..818cbfe --- /dev/null +++ b/lld/test/Driver/def-lib-search.test @@ -0,0 +1,8 @@ +# Check that search paths explicitly provided by the -L option +# are used in search before default paths. + +RUN: not lld -flavor gnu -target x86_64 -t -ltest \ +RUN: --sysroot=%p/Inputs -L%p/Inputs 2> %t +RUN: FileCheck %s < %t + +CHECK: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}libtest.a |