diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-07-14 23:37:14 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-07-14 23:37:14 +0000 |
| commit | 606047939c90ae185d2d9dfa98f314af9ffed793 (patch) | |
| tree | 3ae60baf3a76149e553bb57987964eda17f79289 | |
| parent | 7e75866c51d700981c6b4a98a66ffcad02b8ffe6 (diff) | |
| download | bcm5719-llvm-606047939c90ae185d2d9dfa98f314af9ffed793.tar.gz bcm5719-llvm-606047939c90ae185d2d9dfa98f314af9ffed793.zip | |
COFF: Rename noreturn error -> fatal.
This new name is also consistent with ELF.
llvm-svn: 275500
| -rw-r--r-- | lld/COFF/Chunks.cpp | 6 | ||||
| -rw-r--r-- | lld/COFF/Driver.cpp | 24 | ||||
| -rw-r--r-- | lld/COFF/DriverUtils.cpp | 44 | ||||
| -rw-r--r-- | lld/COFF/Error.cpp | 6 | ||||
| -rw-r--r-- | lld/COFF/Error.h | 4 | ||||
| -rw-r--r-- | lld/COFF/InputFiles.cpp | 10 | ||||
| -rw-r--r-- | lld/COFF/InputFiles.h | 2 | ||||
| -rw-r--r-- | lld/COFF/ModuleDef.cpp | 14 | ||||
| -rw-r--r-- | lld/COFF/SymbolTable.cpp | 12 | ||||
| -rw-r--r-- | lld/COFF/Symbols.cpp | 2 | ||||
| -rw-r--r-- | lld/COFF/Writer.cpp | 8 |
11 files changed, 66 insertions, 66 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index 0f9552591e8..067a55688c7 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -61,7 +61,7 @@ void SectionChunk::applyRelX64(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_AMD64_SECTION: add16(Off, Sym->getSectionIndex()); break; case IMAGE_REL_AMD64_SECREL: add32(Off, Sym->getSecrel()); break; default: - error("Unsupported relocation type"); + fatal("Unsupported relocation type"); } } @@ -76,7 +76,7 @@ void SectionChunk::applyRelX86(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_I386_SECTION: add16(Off, Sym->getSectionIndex()); break; case IMAGE_REL_I386_SECREL: add32(Off, Sym->getSecrel()); break; default: - error("Unsupported relocation type"); + fatal("Unsupported relocation type"); } } @@ -120,7 +120,7 @@ void SectionChunk::applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break; case IMAGE_REL_ARM_BLX23T: applyBranch24T(Off, S - P - 4); break; default: - error("Unsupported relocation type"); + fatal("Unsupported relocation type"); } } diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index a93abcf3ce0..11dfccb0488 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -128,7 +128,7 @@ void LinkerDriver::parseDirectives(StringRef S) { case OPT_throwingnew: break; default: - error(Twine(Arg->getSpelling()) + " is not allowed in .drectve"); + fatal(Twine(Arg->getSpelling()) + " is not allowed in .drectve"); } } } @@ -253,7 +253,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { // We call our own implementation of lib.exe that understands bitcode files. if (ArgsArr.size() > 1 && StringRef(ArgsArr[1]).equals_lower("/lib")) { if (llvm::libDriverMain(ArgsArr.slice(1)) != 0) - error("lib failed"); + fatal("lib failed"); return; } @@ -275,7 +275,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { } if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end()) - error("no input files."); + fatal("no input files."); // Construct search path list. SearchPaths.push_back(""); @@ -302,7 +302,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { // Handle /noentry if (Args.hasArg(OPT_noentry)) { if (!Args.hasArg(OPT_dll)) - error("/noentry must be specified with /dll"); + fatal("/noentry must be specified with /dll"); Config->NoEntry = true; } @@ -315,7 +315,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { // Handle /fixed if (Args.hasArg(OPT_fixed)) { if (Args.hasArg(OPT_dynamicbase)) - error("/fixed must not be specified with /dynamicbase"); + fatal("/fixed must not be specified with /dynamicbase"); Config->Relocatable = false; Config->DynamicBase = false; } @@ -389,17 +389,17 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { StringRef OptLevel = StringRef(S).substr(7); if (OptLevel.getAsInteger(10, Config->LTOOptLevel) || Config->LTOOptLevel > 3) - error("/opt:lldlto: invalid optimization level: " + OptLevel); + fatal("/opt:lldlto: invalid optimization level: " + OptLevel); continue; } if (StringRef(S).startswith("lldltojobs=")) { StringRef Jobs = StringRef(S).substr(11); if (Jobs.getAsInteger(10, Config->LTOJobs) || Config->LTOJobs == 0) - error("/opt:lldltojobs: invalid job count: " + Jobs); + fatal("/opt:lldltojobs: invalid job count: " + Jobs); continue; } if (S != "ref" && S != "lbr" && S != "nolbr") - error(Twine("/opt: unknown option: ") + S); + fatal(Twine("/opt: unknown option: ") + S); } } @@ -500,7 +500,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { continue; } if (Config->Machine != MT) - error(Twine(File->getShortName()) + ": machine type " + machineToStr(MT) + + fatal(Twine(File->getShortName()) + ": machine type " + machineToStr(MT) + " conflicts with " + machineToStr(Config->Machine)); } if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) { @@ -535,7 +535,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { // infer that from user-defined entry name. StringRef S = findDefaultEntry(); if (S.empty()) - error("entry point must be defined"); + fatal("entry point must be defined"); Config->Entry = addUndefined(S); if (Config->Verbose) llvm::outs() << "Entry name inferred: " << S << "\n"; @@ -642,14 +642,14 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) { Config->Subsystem = inferSubsystem(); if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) - error("subsystem must be defined"); + fatal("subsystem must be defined"); } // Handle /safeseh. if (Args.hasArg(OPT_safeseh)) for (ObjectFile *File : Symtab.ObjectFiles) if (!File->SEHCompat) - error("/safeseh: " + File->getName() + " is not compatible with SEH"); + fatal("/safeseh: " + File->getName() + " is not compatible with SEH"); // Windows specific -- when we are creating a .dll file, we also // need to create a .lib file. diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index acfc02757b8..561490173cf 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -58,7 +58,7 @@ public: for (const char *S : Args) if (S) llvm::errs() << S << " "; - error("failed"); + fatal("failed"); } } @@ -82,7 +82,7 @@ MachineTypes getMachineType(StringRef S) { .Default(IMAGE_FILE_MACHINE_UNKNOWN); if (MT != IMAGE_FILE_MACHINE_UNKNOWN) return MT; - error(Twine("unknown /machine argument: ") + S); + fatal(Twine("unknown /machine argument: ") + S); } StringRef machineToStr(MachineTypes MT) { @@ -103,9 +103,9 @@ void parseNumbers(StringRef Arg, uint64_t *Addr, uint64_t *Size) { StringRef S1, S2; std::tie(S1, S2) = Arg.split(','); if (S1.getAsInteger(0, *Addr)) - error(Twine("invalid number: ") + S1); + fatal(Twine("invalid number: ") + S1); if (Size && !S2.empty() && S2.getAsInteger(0, *Size)) - error(Twine("invalid number: ") + S2); + fatal(Twine("invalid number: ") + S2); } // Parses a string in the form of "<integer>[.<integer>]". @@ -114,10 +114,10 @@ void parseVersion(StringRef Arg, uint32_t *Major, uint32_t *Minor) { StringRef S1, S2; std::tie(S1, S2) = Arg.split('.'); if (S1.getAsInteger(0, *Major)) - error(Twine("invalid number: ") + S1); + fatal(Twine("invalid number: ") + S1); *Minor = 0; if (!S2.empty() && S2.getAsInteger(0, *Minor)) - error(Twine("invalid number: ") + S2); + fatal(Twine("invalid number: ") + S2); } // Parses a string in the form of "<subsystem>[,<integer>[.<integer>]]". @@ -137,7 +137,7 @@ void parseSubsystem(StringRef Arg, WindowsSubsystem *Sys, uint32_t *Major, .Case("windows", IMAGE_SUBSYSTEM_WINDOWS_GUI) .Default(IMAGE_SUBSYSTEM_UNKNOWN); if (*Sys == IMAGE_SUBSYSTEM_UNKNOWN) - error(Twine("unknown subsystem: ") + SysStr); + fatal(Twine("unknown subsystem: ") + SysStr); if (!Ver.empty()) parseVersion(Ver, Major, Minor); } @@ -148,10 +148,10 @@ void parseAlternateName(StringRef S) { StringRef From, To; std::tie(From, To) = S.split('='); if (From.empty() || To.empty()) - error(Twine("/alternatename: invalid argument: ") + S); + fatal(Twine("/alternatename: invalid argument: ") + S); auto It = Config->AlternateNames.find(From); if (It != Config->AlternateNames.end() && It->second != To) - error(Twine("/alternatename: conflicts: ") + S); + fatal(Twine("/alternatename: conflicts: ") + S); Config->AlternateNames.insert(It, std::make_pair(From, To)); } @@ -161,7 +161,7 @@ void parseMerge(StringRef S) { StringRef From, To; std::tie(From, To) = S.split('='); if (From.empty() || To.empty()) - error(Twine("/merge: invalid argument: ") + S); + fatal(Twine("/merge: invalid argument: ") + S); auto Pair = Config->Merge.insert(std::make_pair(From, To)); bool Inserted = Pair.second; if (!Inserted) { @@ -198,7 +198,7 @@ static uint32_t parseSectionAttributes(StringRef S) { Ret |= IMAGE_SCN_MEM_WRITE; break; default: - error(Twine("/section: invalid argument: ") + S); + fatal(Twine("/section: invalid argument: ") + S); } } return Ret; @@ -209,7 +209,7 @@ void parseSection(StringRef S) { StringRef Name, Attrs; std::tie(Name, Attrs) = S.split(','); if (Name.empty() || Attrs.empty()) - error(Twine("/section: invalid argument: ") + S); + fatal(Twine("/section: invalid argument: ") + S); Config->Section[Name] = parseSectionAttributes(Attrs); } @@ -221,16 +221,16 @@ void parseManifest(StringRef Arg) { return; } if (!Arg.startswith_lower("embed")) - error(Twine("Invalid option ") + Arg); + fatal(Twine("Invalid option ") + Arg); Config->Manifest = Configuration::Embed; Arg = Arg.substr(strlen("embed")); if (Arg.empty()) return; if (!Arg.startswith_lower(",id=")) - error(Twine("Invalid option ") + Arg); + fatal(Twine("Invalid option ") + Arg); Arg = Arg.substr(strlen(",id=")); if (Arg.getAsInteger(0, Config->ManifestID)) - error(Twine("Invalid option ") + Arg); + fatal(Twine("Invalid option ") + Arg); } // Parses a string in the form of "level=<string>|uiAccess=<string>|NO". @@ -254,7 +254,7 @@ void parseManifestUAC(StringRef Arg) { std::tie(Config->ManifestUIAccess, Arg) = Arg.split(" "); continue; } - error(Twine("Invalid option ") + Arg); + fatal(Twine("Invalid option ") + Arg); } } @@ -459,7 +459,7 @@ Export parseExport(StringRef Arg) { return E; err: - error(Twine("invalid /export: ") + Arg); + fatal(Twine("invalid /export: ") + Arg); } static StringRef undecorate(StringRef Sym) { @@ -477,7 +477,7 @@ void fixupExports() { if (E.Ordinal == 0) continue; if (!Ords.insert(E.Ordinal).second) - error("duplicate export ordinal: " + E.Name); + fatal("duplicate export ordinal: " + E.Name); } for (Export &E : Config->Exports) { @@ -538,10 +538,10 @@ void checkFailIfMismatch(StringRef Arg) { StringRef K, V; std::tie(K, V) = Arg.split('='); if (K.empty() || V.empty()) - error(Twine("/failifmismatch: invalid argument: ") + Arg); + fatal(Twine("/failifmismatch: invalid argument: ") + Arg); StringRef Existing = Config->MustMatch[K]; if (!Existing.empty() && V != Existing) - error(Twine("/failifmismatch: mismatch detected: ") + Existing + " and " + + fatal(Twine("/failifmismatch: mismatch detected: ") + Existing + " and " + V + " for key " + K); Config->MustMatch[K] = V; } @@ -553,7 +553,7 @@ convertResToCOFF(const std::vector<MemoryBufferRef> &MBs) { // Create an output file path. SmallString<128> Path; if (llvm::sys::fs::createTemporaryFile("resource", "obj", Path)) - error("Could not create temporary file"); + fatal("Could not create temporary file"); // Execute cvtres.exe. Executor E("cvtres.exe"); @@ -613,7 +613,7 @@ llvm::opt::InputArgList ArgParser::parse(ArrayRef<const char *> ArgsArr) { } if (MissingCount) - error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) + + fatal(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) + "\", expected " + Twine(MissingCount) + (MissingCount == 1 ? " argument." : " arguments.")); for (auto *Arg : Args.filtered(OPT_UNKNOWN)) diff --git a/lld/COFF/Error.cpp b/lld/COFF/Error.cpp index c5b0987cf81..04950beee8a 100644 --- a/lld/COFF/Error.cpp +++ b/lld/COFF/Error.cpp @@ -15,7 +15,7 @@ namespace lld { namespace coff { -void error(const Twine &Msg) { +void fatal(const Twine &Msg) { llvm::errs() << Msg << "\n"; exit(1); } @@ -23,14 +23,14 @@ void error(const Twine &Msg) { void check(std::error_code EC, const Twine &Prefix) { if (!EC) return; - error(Prefix + ": " + EC.message()); + fatal(Prefix + ": " + EC.message()); } void check(llvm::Error E, const Twine &Prefix) { if (!E) return; handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EIB) { - error(Prefix + ": " + EIB.message()); + fatal(Prefix + ": " + EIB.message()); }); } diff --git a/lld/COFF/Error.h b/lld/COFF/Error.h index d2aa0c3d8a3..d2189b25ffd 100644 --- a/lld/COFF/Error.h +++ b/lld/COFF/Error.h @@ -16,7 +16,7 @@ namespace lld { namespace coff { -LLVM_ATTRIBUTE_NORETURN void error(const Twine &Msg); +LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg); void check(std::error_code EC, const Twine &Prefix); void check(llvm::Error E, const Twine &Prefix); @@ -27,7 +27,7 @@ template <typename T> void check(const ErrorOr<T> &V, const Twine &Prefix) { template <class T> T check(Expected<T> E, const Twine &Prefix) { if (E) return std::move(*E); - error(E.takeError(), Prefix); + fatal(E.takeError(), Prefix); return T(); } diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index eda1877423a..efe1f5521d5 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -113,7 +113,7 @@ void ObjectFile::parse() { Bin.release(); COFFObj.reset(Obj); } else { - error(Twine(getName()) + " is not a COFF file."); + fatal(Twine(getName()) + " is not a COFF file."); } // Read section and symbol tables. @@ -231,12 +231,12 @@ Defined *ObjectFile::createDefined(COFFSymbolRef Sym, const void *AuxP, // Reserved sections numbers don't have contents. if (llvm::COFF::isReservedSectionNumber(SectionNumber)) - error(Twine("broken object file: ") + getName()); + fatal(Twine("broken object file: ") + getName()); // This symbol references a section which is not present in the section // header. if ((uint32_t)SectionNumber >= SparseChunks.size()) - error(Twine("broken object file: ") + getName()); + fatal(Twine("broken object file: ") + getName()); // Nothing else to do without a section chunk. auto *SC = cast_or_null<SectionChunk>(SparseChunks[SectionNumber]); @@ -266,7 +266,7 @@ void ObjectFile::initializeSEH() { ArrayRef<uint8_t> A; COFFObj->getSectionContents(SXData, A); if (A.size() % 4 != 0) - error(".sxdata must be an array of symbol table indices"); + fatal(".sxdata must be an array of symbol table indices"); auto *I = reinterpret_cast<const ulittle32_t *>(A.data()); auto *E = reinterpret_cast<const ulittle32_t *>(A.data() + A.size()); for (; I != E; ++I) @@ -292,7 +292,7 @@ void ImportFile::parse() { // Check if the total size is valid. if ((size_t)(End - Buf) != (sizeof(*Hdr) + Hdr->SizeOfData)) - error("broken import library"); + fatal("broken import library"); // Read names and create an __imp_ symbol. StringRef Name = StringAlloc.save(StringRef(Buf + sizeof(*Hdr))); diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h index c51c14b6d01..0ec01b5075f 100644 --- a/lld/COFF/InputFiles.h +++ b/lld/COFF/InputFiles.h @@ -104,7 +104,7 @@ public: // All symbols returned by ArchiveFiles are of Lazy type. std::vector<SymbolBody *> &getSymbols() override { - llvm_unreachable("internal error"); + llvm_unreachable("internal fatal"); } private: diff --git a/lld/COFF/ModuleDef.cpp b/lld/COFF/ModuleDef.cpp index d117e961f89..acb9fefa906 100644 --- a/lld/COFF/ModuleDef.cpp +++ b/lld/COFF/ModuleDef.cpp @@ -134,13 +134,13 @@ private: void readAsInt(uint64_t *I) { read(); if (Tok.K != Identifier || Tok.Value.getAsInteger(10, *I)) - error("integer expected"); + fatal("integer expected"); } void expect(Kind Expected, StringRef Msg) { read(); if (Tok.K != Expected) - error(Msg); + fatal(Msg); } void unget() { Stack.push_back(Tok); } @@ -177,7 +177,7 @@ private: parseVersion(&Config->MajorImageVersion, &Config->MinorImageVersion); return; default: - error(Twine("unknown directive: ") + Tok.Value); + fatal(Twine("unknown directive: ") + Tok.Value); } } @@ -188,7 +188,7 @@ private: if (Tok.K == Equal) { read(); if (Tok.K != Identifier) - error(Twine("identifier expected, but got ") + Tok.Value); + fatal(Twine("identifier expected, but got ") + Tok.Value); E.ExtName = E.Name; E.Name = Tok.Value; } else { @@ -264,15 +264,15 @@ private: void parseVersion(uint32_t *Major, uint32_t *Minor) { read(); if (Tok.K != Identifier) - error(Twine("identifier expected, but got ") + Tok.Value); + fatal(Twine("identifier expected, but got ") + Tok.Value); StringRef V1, V2; std::tie(V1, V2) = Tok.Value.split('.'); if (V1.getAsInteger(10, *Major)) - error(Twine("integer expected, but got ") + Tok.Value); + fatal(Twine("integer expected, but got ") + Tok.Value); if (V2.empty()) *Minor = 0; else if (V2.getAsInteger(10, *Minor)) - error(Twine("integer expected, but got ") + Tok.Value); + fatal(Twine("integer expected, but got ") + Tok.Value); } Lexer Lex; diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index 60a2c34e6d7..3e8c112e768 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -164,7 +164,7 @@ void SymbolTable::reportRemainingUndefines(bool Resolve) { llvm::errs() << File->getShortName() << ": undefined symbol: " << Sym->getName() << "\n"; if (!Config->Force) - error("Link failed"); + fatal("Link failed"); } void SymbolTable::addLazy(Lazy *New, std::vector<Symbol *> *Accum) { @@ -211,7 +211,7 @@ void SymbolTable::addSymbol(SymbolBody *New) { // equivalent (conflicting), or more preferable, respectively. int Comp = Existing->compare(New); if (Comp == 0) - error(Twine("duplicate symbol: ") + Existing->getDebugName() + " and " + + fatal(Twine("duplicate symbol: ") + Existing->getDebugName() + " and " + New->getDebugName()); if (Comp < 0) Sym->Body = New; @@ -356,7 +356,7 @@ void SymbolTable::addCombinedLTOObject(ObjectFile *Obj) { int Comp = Existing->compare(Body); if (Comp == 0) - error(Twine("LTO: unexpected duplicate symbol: ") + Name); + fatal(Twine("LTO: unexpected duplicate symbol: ") + Name); if (Comp < 0) Sym->Body = Body; } @@ -383,7 +383,7 @@ void SymbolTable::addCombinedLTOObjects() { size_t NumBitcodeFiles = BitcodeFiles.size(); run(); if (BitcodeFiles.size() != NumBitcodeFiles) - error("LTO: late loaded symbol created new bitcode reference"); + fatal("LTO: late loaded symbol created new bitcode reference"); } // Combine and compile bitcode files and then return the result @@ -418,7 +418,7 @@ std::vector<ObjectFile *> SymbolTable::createLTOObjects(LTOCodeGenerator *CG) { DisableVerify = false; #endif if (!CG->optimize(DisableVerify, false, false, false)) - error(""); // optimize() should have emitted any error message. + fatal(""); // optimize() should have emitted any error message. Objs.resize(Config->LTOJobs); // Use std::list to avoid invalidation of pointers in OSPtrs. @@ -430,7 +430,7 @@ std::vector<ObjectFile *> SymbolTable::createLTOObjects(LTOCodeGenerator *CG) { } if (!CG->compileOptimized(OSPtrs)) - error(""); // compileOptimized() should have emitted any error message. + fatal(""); // compileOptimized() should have emitted any error message. std::vector<ObjectFile *> ObjFiles; for (SmallString<0> &Obj : Objs) { diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp index 3d125c92b2a..a08e1d3e816 100644 --- a/lld/COFF/Symbols.cpp +++ b/lld/COFF/Symbols.cpp @@ -199,7 +199,7 @@ std::unique_ptr<InputFile> Lazy::getMember() { else if (Magic == file_magic::bitcode) Obj.reset(new BitcodeFile(MBRef)); else - error(Twine(File->getName()) + ": unknown file type"); + fatal(Twine(File->getName()) + ": unknown file type"); Obj->setParentName(File->getName()); return Obj; diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 56b1924af76..d97a137c3ba 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -199,13 +199,13 @@ void OutputSection::writeHeaderTo(uint8_t *Buf) { uint64_t Defined::getSecrel() { if (auto *D = dyn_cast<DefinedRegular>(this)) return getRVA() - D->getChunk()->getOutputSection()->getRVA(); - error("SECREL relocation points to a non-regular symbol"); + fatal("SECREL relocation points to a non-regular symbol"); } uint64_t Defined::getSectionIndex() { if (auto *D = dyn_cast<DefinedRegular>(this)) return D->getChunk()->getOutputSection()->SectionIndex; - error("SECTION relocation points to a non-regular symbol"); + fatal("SECTION relocation points to a non-regular symbol"); } bool Defined::isExecutable() { @@ -614,13 +614,13 @@ template <typename PEHeaderTy> void Writer::writeHeader() { assert(B->getRVA() >= SC->getRVA()); uint64_t OffsetInChunk = B->getRVA() - SC->getRVA(); if (!SC->hasData() || OffsetInChunk + 4 > SC->getSize()) - error("_load_config_used is malformed"); + fatal("_load_config_used is malformed"); ArrayRef<uint8_t> SecContents = SC->getContents(); uint32_t LoadConfigSize = *reinterpret_cast<const ulittle32_t *>(&SecContents[OffsetInChunk]); if (OffsetInChunk + LoadConfigSize > SC->getSize()) - error("_load_config_used is too large"); + fatal("_load_config_used is too large"); Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA(); Dir[LOAD_CONFIG_TABLE].Size = LoadConfigSize; } |

