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