[lld] r230679 - [Driver] Use paths explicitly provided by the -L option before default paths
Simon Atanasyan
simon at atanasyan.com
Thu Feb 26 12:09:50 PST 2015
Author: atanasyan
Date: Thu Feb 26 14:09:50 2015
New Revision: 230679
URL: http://llvm.org/viewvc/llvm-project?rev=230679&view=rev
Log:
[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
Added:
lld/trunk/test/Driver/Inputs/libtest.a
lld/trunk/test/Driver/def-lib-search.test
Modified:
lld/trunk/lib/Driver/GnuLdDriver.cpp
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=230679&r1=230678&r2=230679&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Thu Feb 26 14:09:50 2015
@@ -423,10 +423,6 @@ bool GnuLdDriver::parse(int argc, const
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
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());
Added: lld/trunk/test/Driver/Inputs/libtest.a
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/Driver/Inputs/libtest.a?rev=230679&view=auto
==============================================================================
--- lld/trunk/test/Driver/Inputs/libtest.a (added)
+++ lld/trunk/test/Driver/Inputs/libtest.a Thu Feb 26 14:09:50 2015
@@ -0,0 +1 @@
+!<arch>
Added: lld/trunk/test/Driver/def-lib-search.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/Driver/def-lib-search.test?rev=230679&view=auto
==============================================================================
--- lld/trunk/test/Driver/def-lib-search.test (added)
+++ lld/trunk/test/Driver/def-lib-search.test Thu Feb 26 14:09:50 2015
@@ -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
More information about the llvm-commits
mailing list