diff options
author | Joseph Huber <jhuber6@vols.utk.edu> | 2022-06-30 11:41:38 -0400 |
---|---|---|
committer | Joseph Huber <jhuber6@vols.utk.edu> | 2022-07-05 13:43:51 -0400 |
commit | 0bb1bf1b1761a9070540df0ae0e51bc1bfb80ccd (patch) | |
tree | eaa760c378ca1ecfbc4fe2e236178d81c5ccc595 /clang/tools | |
parent | 3f58177d7ffa9873c89d48177df94008e316ed10 (diff) | |
download | llvm-0bb1bf1b1761a9070540df0ae0e51bc1bfb80ccd.zip llvm-0bb1bf1b1761a9070540df0ae0e51bc1bfb80ccd.tar.gz llvm-0bb1bf1b1761a9070540df0ae0e51bc1bfb80ccd.tar.bz2 |
[LinkerWrapper] Add AMDGPU specific options to the LLD invocation
We use LLD to perform AMDGPU linking. This linker accepts some arguments
through the `-plugin-opt` facilities. These options match what `Clang`
will output when given the same input.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D128923
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index ffd17b6..3e935bc 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -8,9 +8,9 @@ // // This tool works as a wrapper over a linking job. This tool is used to create // linked device images for offloading. It scans the linker's input for embedded -// device offloading data stored in sections `.llvm.offloading.<triple>.<arch>` -// and extracts it as a temporary file. The extracted device files will then be -// passed to a device linking job to create a final device image. +// device offloading data stored in sections `.llvm.offloading` and extracts it +// as a temporary file. The extracted device files will then be passed to a +// device linking job to create a final device image. // //===---------------------------------------------------------------------===// @@ -573,6 +573,7 @@ Expected<StringRef> link(ArrayRef<StringRef> InputFiles, Triple TheTriple, "out"); if (!TempFileOrErr) return TempFileOrErr.takeError(); + std::string ArchArg = ("-plugin-opt=mcpu=" + Arch).str(); SmallVector<StringRef, 16> CmdArgs; CmdArgs.push_back(*LLDPath); @@ -580,6 +581,8 @@ Expected<StringRef> link(ArrayRef<StringRef> InputFiles, Triple TheTriple, CmdArgs.push_back("gnu"); CmdArgs.push_back("--no-undefined"); CmdArgs.push_back("-shared"); + CmdArgs.push_back("-plugin-opt=-amdgpu-internalize-symbols"); + CmdArgs.push_back(ArchArg); CmdArgs.push_back("-o"); CmdArgs.push_back(*TempFileOrErr); |