case IMAGE_REL_AMD64_SECTION: add16(Off, Sym->getSectionIndex()); break;
case IMAGE_REL_AMD64_SECREL: add32(Off, Sym->getSecrel()); break;
default:
- fatal("Unsupported relocation type");
+ fatal("unsupported relocation type");
}
}
case IMAGE_REL_I386_SECTION: add16(Off, Sym->getSectionIndex()); break;
case IMAGE_REL_I386_SECREL: add32(Off, Sym->getSecrel()); break;
default:
- fatal("Unsupported relocation type");
+ fatal("unsupported relocation type");
}
}
case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break;
case IMAGE_REL_ARM_BLX23T: applyBranch24T(Off, S - P - 4); break;
default:
- fatal("Unsupported relocation type");
+ fatal("unsupported relocation type");
}
}
// Newly created memory buffers are owned by this driver.
MemoryBufferRef LinkerDriver::openFile(StringRef Path) {
std::unique_ptr<MemoryBuffer> MB =
- check(MemoryBuffer::getFile(Path), "Could not open " + Path);
+ check(MemoryBuffer::getFile(Path), "could not open " + Path);
MemoryBufferRef MBRef = MB->getMemBufferRef();
OwningMBs.push_back(std::move(MB)); // take ownership
return MBRef;
}
if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end())
- fatal("no input files.");
+ fatal("no input files");
// Construct search path list.
SearchPaths.push_back("");
std::error_code EC;
llvm::raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text);
if (EC)
- fatal(EC, "Could not create the symbol map");
+ fatal(EC, "could not create the symbol map");
Symtab.printMap(Out);
}
// Call exit to avoid calling destructors.
for (const char *S : Args)
if (S)
llvm::errs() << S << " ";
- fatal("failed");
+ fatal("ExecuteAndWait failed");
}
}
return;
}
if (!Arg.startswith_lower("embed"))
- fatal("Invalid option " + Arg);
+ fatal("invalid option " + Arg);
Config->Manifest = Configuration::Embed;
Arg = Arg.substr(strlen("embed"));
if (Arg.empty())
return;
if (!Arg.startswith_lower(",id="))
- fatal("Invalid option " + Arg);
+ fatal("invalid option " + Arg);
Arg = Arg.substr(strlen(",id="));
if (Arg.getAsInteger(0, Config->ManifestID))
- fatal("Invalid option " + Arg);
+ fatal("invalid option " + Arg);
}
// Parses a string in the form of "level=<string>|uiAccess=<string>|NO".
std::tie(Config->ManifestUIAccess, Arg) = Arg.split(" ");
continue;
}
- fatal("Invalid option " + Arg);
+ fatal("invalid option " + Arg);
}
}
static std::string readFile(StringRef Path) {
std::unique_ptr<MemoryBuffer> MB =
- check(MemoryBuffer::getFile(Path), "Could not open " + Path);
+ check(MemoryBuffer::getFile(Path), "could not open " + Path);
std::unique_ptr<MemoryBuffer> Buf(std::move(MB));
return Buf->getBuffer();
}
E.add("/nologo");
E.add(RCPath.str());
E.run();
- return check(MemoryBuffer::getFile(ResPath), "Could not open " + ResPath);
+ return check(MemoryBuffer::getFile(ResPath), "could not open " + ResPath);
}
void createSideBySideManifest() {
convertResToCOFF(const std::vector<MemoryBufferRef> &MBs) {
// Create an output file path.
SmallString<128> Path;
- if (llvm::sys::fs::createTemporaryFile("resource", "obj", Path))
- fatal("Could not create temporary file");
+ if (auto EC = llvm::sys::fs::createTemporaryFile("resource", "obj", Path))
+ fatal(EC, "could not create temporary file");
// Execute cvtres.exe.
Executor E("cvtres.exe");
for (MemoryBufferRef MB : MBs)
E.add(MB.getBufferIdentifier());
E.run();
- return check(MemoryBuffer::getFile(Path), "Could not open " + Path);
+ return check(MemoryBuffer::getFile(Path), "could not open " + Path);
}
// Create OptTable
void ArchiveFile::parse() {
// Parse a MemoryBufferRef as an archive file.
- File = check(Archive::create(MB), "Failed to parse static library");
+ File = check(Archive::create(MB), "failed to parse static library");
// Allocate a buffer for Lazy objects.
size_t NumSyms = File->getNumberOfSymbols();
for (auto &Child : File->children(Err))
Seen[Child.getChildOffset()].clear();
if (Err)
- fatal(Err, "Failed to parse static library");
+ fatal(Err, "failed to parse static library");
}
// Returns a buffer pointing to a member file containing a given symbol.
MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) {
const Archive::Child &C =
check(Sym->getMember(),
- "Could not get the member for symbol " + Sym->getName());
+ "could not get the member for symbol " + Sym->getName());
// Return an empty buffer if we have already returned the same buffer.
if (Seen[C.getChildOffset()].test_and_set())
return MemoryBufferRef();
return check(C.getMemoryBufferRef(),
- "Could not get the buffer for the member defining symbol " +
+ "could not get the buffer for the member defining symbol " +
Sym->getName());
}
void ObjectFile::parse() {
// Parse a memory buffer as a COFF file.
std::unique_ptr<Binary> Bin =
- check(createBinary(MB), "Failed to parse object file");
+ check(createBinary(MB), "failed to parse object file");
if (auto *Obj = dyn_cast<COFFObjectFile>(Bin.get())) {
Bin.release();
COFFObj.reset(Obj);
} else {
- fatal(getName() + " is not a COFF file.");
+ fatal(getName() + " is not a COFF file");
}
// Read section and symbol tables.
Context.enableDebugTypeODRUniquing();
ErrorOr<std::unique_ptr<LTOModule>> ModOrErr = LTOModule::createFromBuffer(
Context, MB.getBufferStart(), MB.getBufferSize(), llvm::TargetOptions());
- M = check(std::move(ModOrErr), "Could not create lto module");
+ M = check(std::move(ModOrErr), "could not create LTO module");
llvm::StringSaver Saver(Alloc);
for (unsigned I = 0, E = M->getSymbolCount(); I != E; ++I) {
writeArchive(Path, Members, /*WriteSymtab*/ true, object::Archive::K_GNU,
/*Deterministic*/ true, /*Thin*/ false);
if (auto EC = Result.second)
- fatal(EC, Twine("Failed to write ") + Path);
+ fatal(EC, "failed to write " + Path);
}
llvm::errs() << File->getShortName() << ": undefined symbol: "
<< Sym->getName() << "\n";
if (!Config->Force)
- fatal("Link failed");
+ fatal("link failed");
}
void SymbolTable::addLazy(Lazy *New, std::vector<Symbol *> *Accum) {
else if (Magic == file_magic::bitcode)
Obj.reset(new BitcodeFile(MBRef));
else
- fatal(File->getName() + ": unknown file type");
+ fatal("unknown file type: " + File->getName());
Obj->setParentName(File->getName());
return Obj;
writeSections();
sortExceptionTable();
if (auto EC = Buffer->commit())
- fatal(EC, "Failed to write the output file");
+ fatal(EC, "failed to write the output file");
}
static StringRef getOutputSection(StringRef Name) {