aboutsummaryrefslogtreecommitdiff
path: root/clang/tools
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2022-07-12 11:40:38 -0400
committerJoseph Huber <jhuber6@vols.utk.edu>2022-07-12 11:46:46 -0400
commit1586b5952894c9ba1941fd38a1f7a6b8ca4ee8df (patch)
tree010f00104a702da91af9260255638891a2251318 /clang/tools
parent86a49a4f4f50c2590716bdc440a97e89f5858a4f (diff)
downloadllvm-1586b5952894c9ba1941fd38a1f7a6b8ca4ee8df.zip
llvm-1586b5952894c9ba1941fd38a1f7a6b8ca4ee8df.tar.gz
llvm-1586b5952894c9ba1941fd38a1f7a6b8ca4ee8df.tar.bz2
[LinkerWrapper] Clean-up unused definitions
Summary: There are a few definitions that are unused or unnecessary after previous changes, clean them up.
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp28
1 files changed, 5 insertions, 23 deletions
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 13c0a7e..c1990ab 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -56,8 +56,8 @@ using namespace llvm;
using namespace llvm::opt;
using namespace llvm::object;
-/// TODO: We use the command line parser only to forward `-pass-remarks` options
-/// to the LTO backend. This should be replaced when there is a better way.
+/// We use the command line parser only to forward options like `-pass-remarks`
+/// to the LLVM tools.
static cl::OptionCategory
ClangLinkerWrapperCategory("clang-linker-wrapper options");
static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden,
@@ -92,14 +92,6 @@ static codegen::RegisterCodeGenFlags CodeGenFlags;
/// Global flag to indicate that the LTO pipeline threw an error.
static std::atomic<bool> LTOError;
-/// Magic section string that marks the existence of offloading data. The
-/// section will contain one or more offloading binaries stored contiguously.
-#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
-
-/// The magic offset for the first object inside CUDA's fatbinary. This can be
-/// different but it should work for what is passed here.
-static constexpr unsigned FatbinaryOffset = 0x50;
-
using OffloadingImage = OffloadBinary::OffloadingImage;
/// A class to contain the binary information for a single OffloadBinary.
@@ -353,7 +345,7 @@ Error extractFromBitcode(std::unique_ptr<MemoryBuffer> Buffer,
continue;
MDString *SectionID = dyn_cast<MDString>(Op->getOperand(1));
- if (!SectionID || SectionID->getString() != OFFLOAD_SECTION_MAGIC_STR)
+ if (!SectionID || SectionID->getString() != ".llvm.offloading")
continue;
GlobalVariable *GV =
@@ -872,24 +864,14 @@ Error linkBitcodeFiles(SmallVectorImpl<OffloadFile> &InputFiles,
BitcodeInputFiles.emplace_back(std::move(File));
continue;
}
- case file_magic::cuda_fatbinary: {
- // Cuda fatbinaries made by Clang almost almost have an object eighty
- // bytes from the beginning. This should be sufficient to identify the
- // symbols.
- Buffer =
- MemoryBufferRef(Buffer.getBuffer().drop_front(FatbinaryOffset), "");
- LLVM_FALLTHROUGH;
- }
case file_magic::elf_relocatable:
- case file_magic::elf_shared_object:
- case file_magic::macho_object:
- case file_magic::coff_object: {
+ case file_magic::elf_shared_object: {
Expected<std::unique_ptr<ObjectFile>> ObjFile =
ObjectFile::createObjectFile(Buffer);
if (!ObjFile)
continue;
- for (auto &Sym : (*ObjFile)->symbols()) {
+ for (SymbolRef Sym : (*ObjFile)->symbols()) {
Expected<StringRef> Name = Sym.getName();
if (!Name)
return Name.takeError();