From: Tom Stellard Date: Thu, 5 May 2016 17:03:41 +0000 (+0000) Subject: AMDGPU: Use lld as the linker again X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5388501da4730c02ff0e6affe6f61c89324278b1;p=clang AMDGPU: Use lld as the linker again Summary: Now that LLVM is emitting version 2 of the AMD code object, we can start using lld again for linking instead of our custom tool. Reviewers: arsenm, kzhuravl Subscribers: rafael, cfe-commits Differential Revision: http://reviews.llvm.org/D19952 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c688763e69..3b639bc975 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -6786,6 +6786,8 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA, std::string Linker = getToolChain().GetProgramPath(getShortName()); ArgStringList CmdArgs; AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); + CmdArgs.push_back("-shared"); + CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename()); C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Linker), CmdArgs, Inputs)); diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index d25d91d87f..c9d5c2238d 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -242,7 +242,7 @@ namespace amdgpu { class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { public: - Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "amdphdrs", TC) {} + Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "ld.lld", TC) {} bool isLinkJob() const override { return true; } bool hasIntegratedCPP() const override { return false; } void ConstructJob(Compilation &C, const JobAction &JA, diff --git a/test/Driver/amdgpu-toolchain.c b/test/Driver/amdgpu-toolchain.c index 5a67bae246..833b49df5d 100644 --- a/test/Driver/amdgpu-toolchain.c +++ b/test/Driver/amdgpu-toolchain.c @@ -1,3 +1,3 @@ // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s // AS_LINK: clang{{.*}} "-cc1as" -// AS_LINK: amdphdrs{{.*}} +// AS_LINK: ld.lld{{.*}} "-shared"