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;
   }
 
   
//----------------------------------------------------------------------------


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;
   }
 
   //----------------------------------------------------------------------------
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to