Skip to content

Commit

Permalink
[hexagon] restore library path arguments
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 96832a6)
  • Loading branch information
androm3da authored and tru committed Jul 28, 2023
1 parent 3fbec44 commit 991cbe1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
if (HTC.ShouldLinkCXXStdlib(Args))
HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
}
return;
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -441,6 +440,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
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);

//----------------------------------------------------------------------------
//
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Driver/hexagon-toolchain-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@
// CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]"
// CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
// CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"

// RUN: %clang -fdriver-only -Werror -v -L/tmp \
// RUN: --target=hexagon-unknown-linux-musl %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK010 %s
// CHECK010: InstalledDir: [[INSTALLED_DIR:.+]]
// CHECK010: "-L/tmp"

0 comments on commit 991cbe1

Please sign in to comment.