This revision was automatically updated to reflect the committed changes. Closed by commit rL368245: [Driver] Move LIBRARY_PATH before user inputs (authored by MaskRay, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65880/new/ https://reviews.llvm.org/D65880 Files: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/test/Driver/linker-opts.c Index: cfe/trunk/test/Driver/linker-opts.c =================================================================== --- cfe/trunk/test/Driver/linker-opts.c +++ cfe/trunk/test/Driver/linker-opts.c @@ -1,8 +1,10 @@ // RUN: rm -rf %t // RUN: mkdir %t // -// RUN: env LIBRARY_PATH=%t/test1 %clang -x c %s -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target %itanium_abi_triple %s -la -### 2>&1 | FileCheck %s // CHECK: "-L{{.*}}/test1" +// CHECK: "{{[^"]+}}.o" +// CHECK: "-la" // GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH. // XFAIL: windows-msvc @@ -10,8 +12,8 @@ // REQUIRES: native // Make sure that LIBRARY_PATH works for both i386 and x86_64 on Darwin. -// RUN: env LIBRARY_PATH=%t/test1 %clang -target x86_64-apple-darwin %s -### 2>&1 | FileCheck %s -// RUN: env LIBRARY_PATH=%t/test1 %clang -target i386-apple-darwin %s -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target x86_64-apple-darwin %s -la -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target i386-apple-darwin %s -la -### 2>&1 | FileCheck %s // // Make sure that we don't warn on unused compiler arguments. // RUN: %clang -Xclang -I. -x c %s -c -o %t/tmp.o Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp @@ -145,6 +145,11 @@ // (constructed via -Xarch_). Args.AddAllArgValues(CmdArgs, options::OPT_Zlinker_input); + // LIBRARY_PATH are included before user inputs and only supported on native + // toolchains. + if (!TC.isCrossCompiling()) + addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); + for (const auto &II : Inputs) { // If the current tool chain refers to an OpenMP or HIP offloading host, we // should ignore inputs that refer to OpenMP or HIP offloading devices - @@ -182,12 +187,6 @@ A.renderAsInput(Args, CmdArgs); } } - - // LIBRARY_PATH - included following the user specified library paths. - // and only supported on native toolchains. - if (!TC.isCrossCompiling()) { - addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); - } } void tools::AddTargetFeature(const ArgList &Args,
Index: cfe/trunk/test/Driver/linker-opts.c =================================================================== --- cfe/trunk/test/Driver/linker-opts.c +++ cfe/trunk/test/Driver/linker-opts.c @@ -1,8 +1,10 @@ // RUN: rm -rf %t // RUN: mkdir %t // -// RUN: env LIBRARY_PATH=%t/test1 %clang -x c %s -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target %itanium_abi_triple %s -la -### 2>&1 | FileCheck %s // CHECK: "-L{{.*}}/test1" +// CHECK: "{{[^"]+}}.o" +// CHECK: "-la" // GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH. // XFAIL: windows-msvc @@ -10,8 +12,8 @@ // REQUIRES: native // Make sure that LIBRARY_PATH works for both i386 and x86_64 on Darwin. -// RUN: env LIBRARY_PATH=%t/test1 %clang -target x86_64-apple-darwin %s -### 2>&1 | FileCheck %s -// RUN: env LIBRARY_PATH=%t/test1 %clang -target i386-apple-darwin %s -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target x86_64-apple-darwin %s -la -### 2>&1 | FileCheck %s +// RUN: env LIBRARY_PATH=%t/test1 %clang -target i386-apple-darwin %s -la -### 2>&1 | FileCheck %s // // Make sure that we don't warn on unused compiler arguments. // RUN: %clang -Xclang -I. -x c %s -c -o %t/tmp.o Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp @@ -145,6 +145,11 @@ // (constructed via -Xarch_). Args.AddAllArgValues(CmdArgs, options::OPT_Zlinker_input); + // LIBRARY_PATH are included before user inputs and only supported on native + // toolchains. + if (!TC.isCrossCompiling()) + addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); + for (const auto &II : Inputs) { // If the current tool chain refers to an OpenMP or HIP offloading host, we // should ignore inputs that refer to OpenMP or HIP offloading devices - @@ -182,12 +187,6 @@ A.renderAsInput(Args, CmdArgs); } } - - // LIBRARY_PATH - included following the user specified library paths. - // and only supported on native toolchains. - if (!TC.isCrossCompiling()) { - addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); - } } void tools::AddTargetFeature(const ArgList &Args,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits