[PATCH] D150013: [Clang] Respect `-L` options when compiling directly for AMDGPU
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 5 18:52:06 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: tra, yaxunl, JonChesterfield.
Herald added subscribers: kosarev, kerbowa, tpr, dstuttard, jvesely, kzhuravl.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, wdng.
Herald added a project: clang.
The AMDGPU linker is `lld`, which has full support for standard features
like static libraries. Previously the AMDGPU toolchain did not forward
`-L` arguments so we could not tell it where to find certain libraries.
This patch simply forwards it like the other toolchains.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150013
Files:
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/test/Driver/amdgpu-toolchain.c
Index: clang/test/Driver/amdgpu-toolchain.c
===================================================================
--- clang/test/Driver/amdgpu-toolchain.c
+++ clang/test/Driver/amdgpu-toolchain.c
@@ -11,6 +11,6 @@
// DWARF_VER: "-dwarf-version=5"
// RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx906 -nogpulib \
-// RUN: -flto -fconvergent-functions %s 2>&1 | FileCheck -check-prefix=LTO %s
+// RUN: -L. -flto -fconvergent-functions %s 2>&1 | FileCheck -check-prefix=LTO %s
// LTO: clang{{.*}} "-flto=full"{{.*}}"-fconvergent-functions"
-// LTO: ld.lld{{.*}}-plugin-opt=mcpu=gfx906
+// LTO: ld.lld{{.*}}"-L."{{.*}}"-plugin-opt=mcpu=gfx906"
Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -544,6 +544,7 @@
ArgStringList CmdArgs;
addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs);
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+ Args.AddAllArgs(CmdArgs, options::OPT_L);
if (C.getDriver().isUsingLTO())
addLTOOptions(getToolChain(), Args, CmdArgs, Output, Inputs[0],
C.getDriver().getLTOMode() == LTOK_Thin);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150013.520017.patch
Type: text/x-patch
Size: 1245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230506/5169572f/attachment.bin>
More information about the cfe-commits
mailing list