Skip to content

Commit

Permalink
AMDGPU: Use lld as the linker again
Browse files Browse the repository at this point in the history
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

llvm-svn: 268648
  • Loading branch information
tstellarAMD committed May 5, 2016
1 parent fcfaea4 commit f6699f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Driver/Tools.cpp
Expand Up @@ -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<Command>(JA, *this, Args.MakeArgString(Linker),
CmdArgs, Inputs));
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Driver/Tools.h
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion clang/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"

0 comments on commit f6699f5

Please sign in to comment.