Skip to content

Commit 96832a6

Browse files
committed
[hexagon] restore library path arguments
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" Differential Revision: https://reviews.llvm.org/D156330
1 parent 3d9a64f commit 96832a6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clang/lib/Driver/ToolChains/Hexagon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
383383
if (HTC.ShouldLinkCXXStdlib(Args))
384384
HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
385385
}
386-
return;
387386
}
388387

389388
//----------------------------------------------------------------------------
@@ -441,6 +440,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
441440
const ToolChain::path_list &LibPaths = HTC.getFilePaths();
442441
for (const auto &LibPath : LibPaths)
443442
CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
443+
Args.ClaimAllArgs(options::OPT_L);
444444

445445
//----------------------------------------------------------------------------
446446
//

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,9 @@
119119
// CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]"
120120
// CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
121121
// CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"
122+
123+
// RUN: %clang -fdriver-only -Werror -v -L/tmp \
124+
// RUN: --target=hexagon-unknown-linux-musl %s 2>&1 \
125+
// RUN: | FileCheck -check-prefix=CHECK010 %s
126+
// CHECK010: InstalledDir: [[INSTALLED_DIR:.+]]
127+
// CHECK010: "-L/tmp"

0 commit comments

Comments
 (0)