Author: Brian Cain
Date: 2023-07-27T13:26:28-07:00
New Revision: 96832a6bf7e0e7f1e8d634d38c44a1b32d512923

URL: 
https://github.com/llvm/llvm-project/commit/96832a6bf7e0e7f1e8d634d38c44a1b32d512923
DIFF: 
https://github.com/llvm/llvm-project/commit/96832a6bf7e0e7f1e8d634d38c44a1b32d512923.diff

LOG: [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

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Hexagon.cpp
    clang/test/Driver/hexagon-toolchain-linux.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Hexagon.cpp 
b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 7acc600a6aa4fe..dab7382532520a 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -383,7 +383,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction 
&JA,
       if (HTC.ShouldLinkCXXStdlib(Args))
         HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
     }
-    return;
   }
 
   
//----------------------------------------------------------------------------
@@ -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);
 
   
//----------------------------------------------------------------------------
   //

diff  --git a/clang/test/Driver/hexagon-toolchain-linux.c 
b/clang/test/Driver/hexagon-toolchain-linux.c
index 05ae1733992d97..61a5581b009c23 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -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"


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to