Skip to content

Commit 5bc4b34

Browse files
committed
[clang][hexagon] Handle library path arguments earlier
The removal of the early return in 96832a6 was an error: it would include the 'standalone' library that's not used by linux. Instead we reproduce the library path handling in the linux/musl block. Differential Revision: https://reviews.llvm.org/D156771
1 parent e7a8a7d commit 5bc4b34

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

clang/lib/Driver/ToolChains/Hexagon.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
383383
if (HTC.ShouldLinkCXXStdlib(Args))
384384
HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
385385
}
386+
const ToolChain::path_list &LibPaths = HTC.getFilePaths();
387+
for (const auto &LibPath : LibPaths)
388+
CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
389+
Args.ClaimAllArgs(options::OPT_L);
390+
return;
386391
}
387392

388393
//----------------------------------------------------------------------------

clang/test/Driver/hexagon-toolchain-linux.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@
120120
// CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
121121
// CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"
122122

123-
// RUN: %clang -fdriver-only -Werror -v -L/tmp \
124-
// RUN: --target=hexagon-unknown-linux-musl %s 2>&1 \
123+
// RUN: %clang -Werror -L/tmp \
124+
// RUN: --target=hexagon-unknown-linux-musl %s -### 2>&1 \
125125
// RUN: | FileCheck -check-prefix=CHECK010 %s
126126
// CHECK010: InstalledDir: [[INSTALLED_DIR:.+]]
127+
// CHECK010-NOT: "-lstandalone"
128+
// CHECK010-NOT: crt0_standalone.o
129+
// CHECK010: crt1.o
127130
// CHECK010: "-L/tmp"
131+
// CHECK010-NOT: "-lstandalone"

0 commit comments

Comments
 (0)