diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -196,8 +196,8 @@ break; case file_magic::archive: if (wholeArchive) { - std::unique_ptr file = - CHECK(Archive::create(mbref), filename + ": failed to parse archive"); + std::unique_ptr file = LLD_CHECK( + Archive::create(mbref), filename + ": failed to parse archive"); Archive *archive = file.get(); make>(std::move(file)); // take ownership @@ -316,10 +316,10 @@ return; } - std::string childName = CHECK( - c.getFullName(), - "could not get the filename for the member defining symbol " + - toCOFFString(sym)); + std::string childName = + LLD_CHECK(c.getFullName(), + "could not get the filename for the member defining symbol " + + toCOFFString(sym)); auto future = std::make_shared>( createFutureForFile(childName)); enqueueTask([=]() { @@ -980,10 +980,10 @@ static void parseModuleDefs(StringRef path) { std::unique_ptr mb = - CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, - /*RequiresNullTerminator=*/false, - /*IsVolatile=*/true), - "could not open " + path); + LLD_CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, + /*RequiresNullTerminator=*/false, + /*IsVolatile=*/true), + "could not open " + path); COFFModuleDefinition m = check(parseCOFFModuleDefinition( mb->getMemBufferRef(), config->machine, config->mingw)); @@ -1073,10 +1073,10 @@ // Open a file. StringRef path = arg.substr(1); std::unique_ptr mb = - CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, - /*RequiresNullTerminator=*/false, - /*IsVolatile=*/true), - "could not open " + path); + LLD_CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, + /*RequiresNullTerminator=*/false, + /*IsVolatile=*/true), + "could not open " + path); // Parse a file. An order file contains one symbol per line. // All symbols that were not present in a given order file are @@ -1101,10 +1101,10 @@ static void parseCallGraphFile(COFFLinkerContext &ctx, StringRef path) { std::unique_ptr mb = - CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, - /*RequiresNullTerminator=*/false, - /*IsVolatile=*/true), - "could not open " + path); + LLD_CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, + /*RequiresNullTerminator=*/false, + /*IsVolatile=*/true), + "could not open " + path); // Build a map from symbol name to section. DenseMap map; @@ -1804,7 +1804,7 @@ // Handle /lldsavecachepolicy if (auto *arg = args.getLastArg(OPT_lldltocachepolicy)) - config->ltoCachePolicy = CHECK( + config->ltoCachePolicy = LLD_CHECK( parseCachePruningPolicy(arg->getValue()), Twine("/lldltocachepolicy: invalid cache policy: ") + arg->getValue()); diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -361,10 +361,10 @@ // is called (you cannot remove an opened file on Windows.) std::unique_ptr getMemoryBuffer() { // IsVolatile=true forces MemoryBuffer to not use mmap(). - return CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, - /*RequiresNullTerminator=*/false, - /*IsVolatile=*/true), - "could not open " + path); + return LLD_CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, + /*RequiresNullTerminator=*/false, + /*IsVolatile=*/true), + "could not open " + path); } std::string path; @@ -453,7 +453,7 @@ e.run(); return std::string( - CHECK(MemoryBuffer::getFile(user.path), "could not open " + user.path) + LLD_CHECK(MemoryBuffer::getFile(user.path), "could not open " + user.path) .get() ->getBuffer()); } diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -98,7 +98,7 @@ void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. - file = CHECK(Archive::create(mb), this); + file = LLD_CHECK(Archive::create(mb), this); // Read the symbol table to construct Lazy objects. for (const Archive::Symbol &sym : file->symbols()) @@ -108,8 +108,8 @@ // Returns a buffer pointing to a member file containing a given symbol. void ArchiveFile::addMember(const Archive::Symbol &sym) { const Archive::Child &c = - CHECK(sym.getMember(), - "could not get the member for symbol " + toCOFFString(sym)); + LLD_CHECK(sym.getMember(), + "could not get the member for symbol " + toCOFFString(sym)); // Return an empty buffer if we have already returned the same buffer. if (!seen.insert(c.getChildOffset()).second) @@ -123,9 +123,9 @@ Error err = Error::success(); for (const Archive::Child &c : file->children(err)) { MemoryBufferRef mbref = - CHECK(c.getMemoryBufferRef(), - file->getFileName() + - ": could not get the buffer for a child of the archive"); + LLD_CHECK(c.getMemoryBufferRef(), + file->getFileName() + + ": could not get the buffer for a child of the archive"); v.push_back(mbref); } if (err) @@ -136,7 +136,7 @@ void ObjFile::parseLazy() { // Native object file. - std::unique_ptr coffObjPtr = CHECK(createBinary(mb), this); + std::unique_ptr coffObjPtr = LLD_CHECK(createBinary(mb), this); COFFObjectFile *coffObj = cast(coffObjPtr.get()); uint32_t numSymbols = coffObj->getNumberOfSymbols(); for (uint32_t i = 0; i < numSymbols; ++i) { @@ -154,7 +154,7 @@ void ObjFile::parse() { // Parse a memory buffer as a COFF file. - std::unique_ptr bin = CHECK(createBinary(mb), this); + std::unique_ptr bin = LLD_CHECK(createBinary(mb), this); if (auto *obj = dyn_cast(bin.get())) { bin.release(); @@ -1121,7 +1121,7 @@ static bool isRVACode(COFFObjectFile *coffObj, uint64_t rva, InputFile *file) { for (size_t i = 1, e = coffObj->getNumberOfSections(); i <= e; i++) { - const coff_section *sec = CHECK(coffObj->getSection(i), file); + const coff_section *sec = LLD_CHECK(coffObj->getSection(i), file); if (rva >= sec->VirtualAddress && rva <= sec->VirtualAddress + sec->VirtualSize) { return (sec->Characteristics & COFF::IMAGE_SCN_CNT_CODE) != 0; @@ -1132,7 +1132,7 @@ void DLLFile::parse() { // Parse a memory buffer as a PE-COFF executable. - std::unique_ptr bin = CHECK(createBinary(mb), this); + std::unique_ptr bin = LLD_CHECK(createBinary(mb), this); if (auto *obj = dyn_cast(bin.get())) { bin.release(); diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp --- a/lld/COFF/Symbols.cpp +++ b/lld/COFF/Symbols.cpp @@ -130,11 +130,11 @@ MemoryBufferRef LazyArchive::getMemberBuffer() { Archive::Child c = - CHECK(sym.getMember(), - "could not get the member for symbol " + toCOFFString(sym)); - return CHECK(c.getMemoryBufferRef(), - "could not get the buffer for the member defining symbol " + - toCOFFString(sym)); + LLD_CHECK(sym.getMember(), + "could not get the member for symbol " + toCOFFString(sym)); + return LLD_CHECK(c.getMemoryBufferRef(), + "could not get the buffer for the member defining symbol " + + toCOFFString(sym)); } } // namespace coff } // namespace lld diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -1550,7 +1550,7 @@ } void Writer::openFile(StringRef path) { - buffer = CHECK( + buffer = LLD_CHECK( FileOutputBuffer::create(path, fileSize, FileOutputBuffer::F_executable), "failed to open " + path); } diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -193,17 +193,17 @@ std::vector> static getArchiveMembers( MemoryBufferRef mb) { std::unique_ptr file = - CHECK(Archive::create(mb), - mb.getBufferIdentifier() + ": failed to parse archive"); + LLD_CHECK(Archive::create(mb), + mb.getBufferIdentifier() + ": failed to parse archive"); std::vector> v; Error err = Error::success(); bool addToTar = file->isThin() && tar; for (const Archive::Child &c : file->children(err)) { MemoryBufferRef mbref = - CHECK(c.getMemoryBufferRef(), - mb.getBufferIdentifier() + - ": could not get the buffer for a child of the archive"); + LLD_CHECK(c.getMemoryBufferRef(), + mb.getBufferIdentifier() + + ": could not get the buffer for a child of the archive"); if (addToTar) tar->append(relativeToRoot(check(c.getFullName())), mbref.getBuffer()); v.push_back(std::make_pair(mbref, c.getChildOffset())); @@ -925,15 +925,15 @@ const Elf_Shdr_Impl &sec = objSections[i]; if (sec.sh_info == inputObj->cgProfileSectionIndex) { if (sec.sh_type == SHT_RELA) { - ArrayRef relas = - CHECK(obj.relas(sec), "could not retrieve cg profile rela section"); + ArrayRef relas = LLD_CHECK( + obj.relas(sec), "could not retrieve cg profile rela section"); for (const typename ELFT::Rela &rel : relas) symbolIndices.push_back(rel.getSymbol(config->isMips64EL)); break; } if (sec.sh_type == SHT_REL) { - ArrayRef rels = - CHECK(obj.rels(sec), "could not retrieve cg profile rel section"); + ArrayRef rels = LLD_CHECK( + obj.rels(sec), "could not retrieve cg profile rel section"); for (const typename ELFT::Rel &rel : rels) symbolIndices.push_back(rel.getSymbol(config->isMips64EL)); break; @@ -1217,7 +1217,7 @@ config->target1Rel = args.hasFlag(OPT_target1_rel, OPT_target1_abs, false); config->target2 = getTarget2(args); config->thinLTOCacheDir = args.getLastArgValue(OPT_thinlto_cache_dir); - config->thinLTOCachePolicy = CHECK( + config->thinLTOCachePolicy = LLD_CHECK( parseCachePruningPolicy(args.getLastArgValue(OPT_thinlto_cache_policy)), "--thinlto-cache-policy: invalid cache policy"); config->thinLTOEmitImportsFiles = args.hasArg(OPT_thinlto_emit_imports_files); diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -488,7 +488,7 @@ osabi = obj.getHeader().e_ident[llvm::ELF::EI_OSABI]; abiVersion = obj.getHeader().e_ident[llvm::ELF::EI_ABIVERSION]; - ArrayRef sections = CHECK(obj.sections(), this); + ArrayRef sections = LLD_CHECK(obj.sections(), this); elfShdrs = sections.data(); numELFShdrs = sections.size(); @@ -502,18 +502,19 @@ // Initialize members corresponding to a symbol table. firstGlobal = symtabSec->sh_info; - ArrayRef eSyms = CHECK(obj.symbols(symtabSec), this); + ArrayRef eSyms = LLD_CHECK(obj.symbols(symtabSec), this); if (firstGlobal == 0 || firstGlobal > eSyms.size()) fatal(toString(this) + ": invalid sh_info in symbol table"); elfSyms = reinterpret_cast(eSyms.data()); numELFSyms = uint32_t(eSyms.size()); - stringTable = CHECK(obj.getStringTableForSymtab(*symtabSec, sections), this); + stringTable = + LLD_CHECK(obj.getStringTableForSymtab(*symtabSec, sections), this); } template uint32_t ObjFile::getSectionIndex(const Elf_Sym &sym) const { - return CHECK( + return LLD_CHECK( this->getObj().getSectionIndex(sym, getELFSyms(), shndxTable), this); } @@ -530,14 +531,14 @@ // Handle dependent libraries and selection of section groups as these are not // done in parallel. ArrayRef objSections = getELFShdrs(); - StringRef shstrtab = CHECK(obj.getSectionStringTable(objSections), this); + StringRef shstrtab = LLD_CHECK(obj.getSectionStringTable(objSections), this); uint64_t size = objSections.size(); sections.resize(size); for (size_t i = 0; i != size; ++i) { const Elf_Shdr &sec = objSections[i]; if (sec.sh_type == SHT_LLVM_DEPENDENT_LIBRARIES && !config->relocatable) { StringRef name = check(obj.getSectionName(sec, shstrtab)); - ArrayRef data = CHECK( + ArrayRef data = LLD_CHECK( this->getObj().template getSectionContentsAsArray(sec), this); if (!data.empty() && data.back() != '\0') { error( @@ -585,7 +586,7 @@ continue; StringRef signature = getShtGroupSignature(objSections, sec); ArrayRef entries = - CHECK(obj.template getSectionContentsAsArray(sec), this); + LLD_CHECK(obj.template getSectionContentsAsArray(sec), this); if (entries.empty()) fatal(toString(this) + ": empty SHT_GROUP"); @@ -627,7 +628,7 @@ if (sec.sh_info >= symbols.size()) fatal(toString(this) + ": invalid symbol index"); const typename ELFT::Sym &sym = symbols[sec.sh_info]; - return CHECK(sym.getName(this->stringTable), this); + return LLD_CHECK(sym.getName(this->stringTable), this); } template @@ -691,7 +692,7 @@ void ObjFile::initializeSections(bool ignoreComdats, const llvm::object::ELFFile &obj) { ArrayRef objSections = getELFShdrs(); - StringRef shstrtab = CHECK(obj.getSectionStringTable(objSections), this); + StringRef shstrtab = LLD_CHECK(obj.getSectionStringTable(objSections), this); uint64_t size = objSections.size(); SmallVector, 0> selectedGroups; for (size_t i = 0; i != size; ++i) { @@ -739,7 +740,7 @@ break; } case SHT_SYMTAB_SHNDX: - shndxTable = CHECK(obj.getSHNDXTable(sec, objSections), this); + shndxTable = LLD_CHECK(obj.getSHNDXTable(sec, objSections), this); break; case SHT_SYMTAB: case SHT_STRTAB: @@ -1020,7 +1021,8 @@ // Some entries have been filled by LazyObjFile. for (size_t i = firstGlobal, end = eSyms.size(); i != end; ++i) if (!symbols[i]) - symbols[i] = symtab.insert(CHECK(eSyms[i].getName(stringTable), this)); + symbols[i] = + symtab.insert(LLD_CHECK(eSyms[i].getName(stringTable), this)); // Perform symbol resolution on non-local symbols. SmallVector undefineds; @@ -1098,7 +1100,7 @@ InputSectionBase *sec = sections[secIdx]; uint8_t type = eSym.getType(); if (type == STT_FILE) - sourceFile = CHECK(eSym.getName(stringTable), this); + sourceFile = LLD_CHECK(eSym.getName(stringTable), this); if (LLVM_UNLIKELY(stringTable.size() <= eSym.st_name)) fatal(toString(this) + ": invalid symbol name offset"); StringRef name(stringTable.data() + eSym.st_name); @@ -1284,7 +1286,7 @@ if (!sec) return {}; std::vector verneeds; - ArrayRef data = CHECK(obj.getSectionContents(*sec), this); + ArrayRef data = LLD_CHECK(obj.getSectionContents(*sec), this); const uint8_t *verneedBuf = data.begin(); for (unsigned i = 0; i != sec->sh_info; ++i) { if (verneedBuf + sizeof(typename ELFT::Verneed) > data.end()) @@ -1360,7 +1362,7 @@ continue; case SHT_DYNAMIC: dynamicTags = - CHECK(obj.template getSectionContentsAsArray(sec), this); + LLD_CHECK(obj.template getSectionContentsAsArray(sec), this); break; case SHT_GNU_versym: versymSec = &sec; @@ -1420,8 +1422,9 @@ std::vector versyms(size, VER_NDX_GLOBAL); if (versymSec) { ArrayRef versym = - CHECK(obj.template getSectionContentsAsArray(*versymSec), - this) + LLD_CHECK( + obj.template getSectionContentsAsArray(*versymSec), + this) .slice(firstGlobal); for (size_t i = 0; i < size; ++i) versyms[i] = versym[i].vs_index; @@ -1441,7 +1444,7 @@ // symbols in each symbol table, and the index of first non-local symbol // is stored to sh_info. If a local symbol appears after some non-local // symbol, that's a violation of the spec. - StringRef name = CHECK(sym.getName(stringTable), this); + StringRef name = LLD_CHECK(sym.getName(stringTable), this); if (sym.getBinding() == STB_LOCAL) { errorOrWarn(toString(this) + ": invalid local symbol '" + name + "' in global part of symbol table"); @@ -1596,7 +1599,7 @@ " at " + utostr(offsetInArchive) + ")"); MemoryBufferRef mbref(mb.getBuffer(), name); - obj = CHECK(lto::InputFile::create(mbref), this); + obj = LLD_CHECK(lto::InputFile::create(mbref), this); Triple t(obj->getTargetTriple()); ekind = getBitcodeELFKind(t); @@ -1758,7 +1761,7 @@ for (size_t i = firstGlobal, end = eSyms.size(); i != end; ++i) { if (eSyms[i].st_shndx == SHN_UNDEF) continue; - symbols[i] = symtab.insert(CHECK(eSyms[i].getName(stringTable), this)); + symbols[i] = symtab.insert(LLD_CHECK(eSyms[i].getName(stringTable), this)); symbols[i]->resolve(LazyObject{*this}); if (!lazy) break; diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -396,7 +396,7 @@ uint32_t secIdx = cast(sym).discardedSecIdx; Elf_Shdr_Impl sec = file->template getELFShdrs()[secIdx]; warn("relocation refers to a discarded section: " + - CHECK(file->getObj().getSectionName(sec), file) + + LLD_CHECK(file->getObj().getSectionName(sec), file) + "\n>>> referenced by " + getObjMsg(p->r_offset)); } p->setSymbolAndType(0, 0, false); diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -508,7 +508,7 @@ std::string msg; if (sym.type == ELF::STT_SECTION) { msg = "relocation refers to a discarded section: "; - msg += CHECK( + msg += LLD_CHECK( file->getObj().getSectionName(objSections[sym.discardedSecIdx]), file); } else { msg = "relocation refers to a symbol in a discarded section: " + diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -244,7 +244,8 @@ break; } } - return CHECK(parseCachePruningPolicy(ltoPolicy), "invalid LTO cache policy"); + return LLD_CHECK(parseCachePruningPolicy(ltoPolicy), + "invalid LTO cache policy"); } // What caused a given library to be loaded. Only relevant for archives. @@ -289,7 +290,7 @@ ArchiveFile *file; if (entry == loadedArchives.end()) { // No cached archive, we need to create a new one - std::unique_ptr archive = CHECK( + std::unique_ptr archive = LLD_CHECK( object::Archive::create(mbref), path + ": failed to parse archive"); if (!archive->isEmpty() && !archive->hasSymbolTable()) diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -2136,7 +2136,8 @@ // Thin archives refer to .o files, so --reproduce needs the .o files too. if (tar && c.getParent()->isThin()) - tar->append(relativeToRoot(CHECK(c.getFullName(), this)), mb->getBuffer()); + tar->append(relativeToRoot(LLD_CHECK(c.getFullName(), this)), + mb->getBuffer()); Expected> modTime = c.getLastModified(); if (!modTime) @@ -2155,9 +2156,9 @@ void ArchiveFile::fetch(const object::Archive::Symbol &sym) { object::Archive::Child c = - CHECK(sym.getMember(), toString(this) + - ": could not get the member defining symbol " + - toMachOString(sym)); + LLD_CHECK(sym.getMember(), + toString(this) + ": could not get the member defining symbol " + + toMachOString(sym)); // `sym` is owned by a LazySym, which will be replace<>()d by make // and become invalid after that call. Copy it to the stack so we can refer diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -1596,8 +1596,8 @@ void BitcodeBundleSection::writeTo(uint8_t *buf) const { using namespace llvm::sys::fs; file_t handle = - CHECK(openNativeFile(xarPath, CD_OpenExisting, FA_Read, OF_None), - "failed to open XAR file"); + LLD_CHECK(openNativeFile(xarPath, CD_OpenExisting, FA_Read, OF_None), + "failed to open XAR file"); std::error_code ec; mapped_file_region xarMap(handle, mapped_file_region::mapmode::readonly, xarSize, 0, ec); diff --git a/lld/include/lld/Common/ErrorHandler.h b/lld/include/lld/Common/ErrorHandler.h --- a/lld/include/lld/Common/ErrorHandler.h +++ b/lld/include/lld/Common/ErrorHandler.h @@ -195,7 +195,7 @@ inline std::string toString(const Twine &s) { return s.str(); } // To evaluate the second argument lazily, we use C macro. -#define CHECK(E, S) check2((E), [&] { return toString(S); }) +#define LLD_CHECK(E, S) check2((E), [&] { return toString(S); }) } // namespace lld diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -212,16 +212,16 @@ // Each slice consists of a member file in the archive. std::vector static getArchiveMembers(MemoryBufferRef mb) { std::unique_ptr file = - CHECK(Archive::create(mb), - mb.getBufferIdentifier() + ": failed to parse archive"); + LLD_CHECK(Archive::create(mb), + mb.getBufferIdentifier() + ": failed to parse archive"); std::vector v; Error err = Error::success(); for (const Archive::Child &c : file->children(err)) { MemoryBufferRef mbref = - CHECK(c.getMemoryBufferRef(), - mb.getBufferIdentifier() + - ": could not get the buffer for a child of the archive"); + LLD_CHECK(c.getMemoryBufferRef(), + mb.getBufferIdentifier() + + ": could not get the buffer for a child of the archive"); v.push_back(mbref); } if (err) @@ -263,7 +263,7 @@ } std::unique_ptr file = - CHECK(Archive::create(mbref), path + ": failed to parse archive"); + LLD_CHECK(Archive::create(mbref), path + ": failed to parse archive"); if (!file->isEmpty() && !file->hasSymbolTable()) { error(mbref.getBufferIdentifier() + @@ -443,7 +443,7 @@ config->stackFirst = args.hasArg(OPT_stack_first); config->trace = args.hasArg(OPT_trace); config->thinLTOCacheDir = args.getLastArgValue(OPT_thinlto_cache_dir); - config->thinLTOCachePolicy = CHECK( + config->thinLTOCachePolicy = LLD_CHECK( parseCachePruningPolicy(args.getLastArgValue(OPT_thinlto_cache_policy)), "--thinlto-cache-policy: invalid cache policy"); config->unresolvedSymbols = getUnresolvedSymbolPolicy(args); diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -77,7 +77,7 @@ file_magic magic = identify_magic(mb.getBuffer()); if (magic == file_magic::wasm_object) { std::unique_ptr bin = - CHECK(createBinary(mb), mb.getBufferIdentifier()); + LLD_CHECK(createBinary(mb), mb.getBufferIdentifier()); auto *obj = cast(bin.get()); if (obj->isSharedObject()) return make(mb); @@ -391,7 +391,7 @@ void ObjFile::parse(bool ignoreComdats) { // Parse a memory buffer as a wasm file. LLVM_DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n"); - std::unique_ptr bin = CHECK(createBinary(mb), toString(this)); + std::unique_ptr bin = LLD_CHECK(createBinary(mb), toString(this)); auto *obj = dyn_cast(bin.get()); if (!obj) @@ -680,7 +680,7 @@ void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. LLVM_DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n"); - file = CHECK(Archive::create(mb), toString(this)); + file = LLD_CHECK(Archive::create(mb), toString(this)); // Read the symbol table to construct Lazy symbols. int count = 0; @@ -694,8 +694,8 @@ void ArchiveFile::addMember(const Archive::Symbol *sym) { const Archive::Child &c = - CHECK(sym->getMember(), - "could not get the member for symbol " + sym->getName()); + LLD_CHECK(sym->getMember(), + "could not get the member for symbol " + sym->getName()); // Don't try to load the same member twice (this can happen when members // mutually reference each other). @@ -706,9 +706,9 @@ LLVM_DEBUG(dbgs() << "from archive: " << toString(this) << "\n"); MemoryBufferRef mb = - CHECK(c.getMemoryBufferRef(), - "could not get the buffer for the member defining symbol " + - sym->getName()); + LLD_CHECK(c.getMemoryBufferRef(), + "could not get the buffer for the member defining symbol " + + sym->getName()); InputFile *obj = createObjectFile(mb, getName(), c.getChildOffset()); symtab->addFile(obj); diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp --- a/lld/wasm/Symbols.cpp +++ b/lld/wasm/Symbols.cpp @@ -428,12 +428,12 @@ MemoryBufferRef LazySymbol::getMemberBuffer() { Archive::Child c = - CHECK(archiveSymbol.getMember(), - "could not get the member for symbol " + toString(*this)); + LLD_CHECK(archiveSymbol.getMember(), + "could not get the member for symbol " + toString(*this)); - return CHECK(c.getMemoryBufferRef(), - "could not get the buffer for the member defining symbol " + - toString(*this)); + return LLD_CHECK(c.getMemoryBufferRef(), + "could not get the buffer for the member defining symbol " + + toString(*this)); } void printTraceSymbolUndefined(StringRef name, const InputFile* file) {