[PATCH] D156771: [clang][hexagon] Handle library path arguments earlier

Brian Cain via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 19:54:43 PDT 2023


bcain created this revision.
bcain added reviewers: kparzysz, sidneym, MaskRay.
Herald added a project: All.
bcain requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The removal of the early return in 96832a6bf7e0e7f1e8d634d38c44a1b32d512923 <https://reviews.llvm.org/rG96832a6bf7e0e7f1e8d634d38c44a1b32d512923>
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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156771

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
@@ -124,4 +124,8 @@
 // RUN:    --target=hexagon-unknown-linux-musl %s 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHECK010 %s
 // CHECK010:   InstalledDir: [[INSTALLED_DIR:.+]]
+// CHECK010-NOT:  "-lstandalone"
+// CHECK010-NOT:  crt0_standalone.o
+// CHECK010:   crt1.o
 // CHECK010:   "-L/tmp"
+// CHECK010-NOT:  "-lstandalone"
Index: clang/lib/Driver/ToolChains/Hexagon.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Hexagon.cpp
+++ clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -383,6 +383,11 @@
       if (HTC.ShouldLinkCXXStdlib(Args))
         HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
     }
+    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);
+    return;
   }
 
   //----------------------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156771.545904.patch
Type: text/x-patch
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230801/733be302/attachment.bin>


More information about the cfe-commits mailing list