[PATCH] D156330: [hexagon] restore library path arguments
Brian Cain via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 06:42:58 PDT 2023
bcain created this revision.
bcain added reviewers: sidneym, kparzysz, MaskRay.
Herald added a project: All.
bcain requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Before applying this fix, clang would not include the specified library
path arguments:
$ ./bin/clang --target=hexagon-unknown-linux-musl -o tprog tprog.o -L/tmp -###
...
clang: warning: argument unused during compilation: '-L/tmp' [-Wunused-command-line-argument]
"/local/mnt/workspace/install/clang-latest/bin/ld.lld" "-z" "relro" "-o" "tprog" "-dynamic-linker=/lib/ld-musl-hexagon.so.1" "/usr/lib/crt1.o" "-L/usr/lib" "tprog.o" "-lclang_rt.builtins-hexagon" "-lc"
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156330
Files:
clang/lib/Driver/ToolChains/Hexagon.cpp
clang/test/Driver/hexagon-toolchain-linux.c
Index: clang/test/Driver/hexagon-toolchain-linux.c
===================================================================
--- clang/test/Driver/hexagon-toolchain-linux.c
+++ clang/test/Driver/hexagon-toolchain-linux.c
@@ -119,3 +119,11 @@
// CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]"
// CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
// CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"
+
+// RUN: %clang -### -target hexagon-unknown-linux \
+// RUN: -L /tmp \
+// RUN: %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK010 %s
+// CHECK010: InstalledDir: [[INSTALLED_DIR:.+]]
+// CHECK010-NOT: warning:
+// CHECK010: -L/tmp
Index: clang/lib/Driver/ToolChains/Hexagon.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Hexagon.cpp
+++ clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -383,7 +383,6 @@
if (HTC.ShouldLinkCXXStdlib(Args))
HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
}
- return;
}
//----------------------------------------------------------------------------
@@ -441,6 +440,7 @@
const ToolChain::path_list &LibPaths = HTC.getFilePaths();
for (const auto &LibPath : LibPaths)
CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+ Args.ClaimAllArgs(options::OPT_L);
//----------------------------------------------------------------------------
//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156330.544342.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230726/4eb1827d/attachment-0001.bin>
More information about the cfe-commits
mailing list