[ELF] Replace warn(...) with Warn
This commit is contained in:
parent
09c2c5e1e9
commit
f8bae3af74
@ -300,9 +300,9 @@ static ScanResult scanCortexA8Errata657417(InputSection *isec, uint64_t &off,
|
||||
scanRes.off = branchOff;
|
||||
scanRes.instr = instr2;
|
||||
} else {
|
||||
warn(toString(isec->file) +
|
||||
": skipping cortex-a8 657417 erratum sequence, section " +
|
||||
isec->name + " is too large to patch");
|
||||
Warn(ctx) << isec->file
|
||||
<< ": skipping cortex-a8 657417 erratum sequence, section "
|
||||
<< isec->name << " is too large to patch";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,18 +504,19 @@ static void stateChangeWarning(Ctx &ctx, uint8_t *loc, RelType relt,
|
||||
if (s.isSection()) {
|
||||
// Section symbols must be defined and in a section. Users cannot change
|
||||
// the type. Use the section name as getName() returns an empty string.
|
||||
warn(place.loc + "branch and link relocation: " + toString(relt) +
|
||||
" to STT_SECTION symbol " + cast<Defined>(s).section->name +
|
||||
" ; interworking not performed" + hint);
|
||||
Warn(ctx) << place.loc << "branch and link relocation: " << relt
|
||||
<< " to STT_SECTION symbol " << cast<Defined>(s).section->name
|
||||
<< " ; interworking not performed" << hint;
|
||||
} else {
|
||||
// Warn with hint on how to alter the symbol type.
|
||||
warn(getErrorLoc(ctx, loc) + "branch and link relocation: " +
|
||||
toString(relt) + " to non STT_FUNC symbol: " + s.getName() +
|
||||
" interworking not performed; consider using directive '.type " +
|
||||
s.getName() +
|
||||
", %function' to give symbol type STT_FUNC if interworking between "
|
||||
"ARM and Thumb is required" +
|
||||
hint);
|
||||
Warn(ctx)
|
||||
<< getErrorLoc(ctx, loc) << "branch and link relocation: " << relt
|
||||
<< " to non STT_FUNC symbol: " << s.getName()
|
||||
<< " interworking not performed; consider using directive '.type "
|
||||
<< s.getName()
|
||||
<< ", %function' to give symbol type STT_FUNC if interworking between "
|
||||
"ARM and Thumb is required"
|
||||
<< hint;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1236,9 +1237,9 @@ template <class ELFT> void ObjFile<ELFT>::importCmseSymbols() {
|
||||
}
|
||||
|
||||
if (eSym.st_size != ACLESESYM_SIZE) {
|
||||
warn("CMSE symbol '" + sym->getName() + "' in import library '" +
|
||||
toString(this) + "' does not have correct size of " +
|
||||
Twine(ACLESESYM_SIZE) + " bytes");
|
||||
Warn(ctx) << "CMSE symbol '" << sym->getName() << "' in import library '"
|
||||
<< this << "' does not have correct size of "
|
||||
<< Twine(ACLESESYM_SIZE) << " bytes";
|
||||
}
|
||||
|
||||
ctx.symtab->cmseImportLib[sym->getName()] = sym;
|
||||
@ -1360,16 +1361,17 @@ ArmCmseSGSection::ArmCmseSGSection(Ctx &ctx)
|
||||
cast<Defined>(entryFunc.sym));
|
||||
for (auto &[_, sym] : ctx.symtab->cmseImportLib) {
|
||||
if (!ctx.symtab->inCMSEOutImpLib.count(sym->getName()))
|
||||
warn("entry function '" + sym->getName() +
|
||||
"' from CMSE import library is not present in secure application");
|
||||
Warn(ctx)
|
||||
<< "entry function '" << sym->getName()
|
||||
<< "' from CMSE import library is not present in secure application";
|
||||
}
|
||||
|
||||
if (!ctx.symtab->cmseImportLib.empty() && ctx.arg.cmseOutputLib.empty()) {
|
||||
for (auto &[_, entryFunc] : ctx.symtab->cmseSymMap) {
|
||||
Symbol *sym = entryFunc.sym;
|
||||
if (!ctx.symtab->inCMSEOutImpLib.count(sym->getName()))
|
||||
warn("new entry function '" + sym->getName() +
|
||||
"' introduced but no output import library specified");
|
||||
Warn(ctx) << "new entry function '" << sym->getName()
|
||||
<< "' introduced but no output import library specified";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +87,9 @@ RelExpr MIPS<ELFT>::getRelExpr(RelType type, const Symbol &s,
|
||||
// (e.g. a table of function pointers). When we encounter this, ignore the
|
||||
// relocation and emit a warning instead.
|
||||
if (!s.isFunc() && s.type != STT_NOTYPE) {
|
||||
warn(getErrorLoc(ctx, loc) +
|
||||
"found R_MIPS_JALR relocation against non-function symbol " +
|
||||
toString(s) + ". This is invalid and most likely a compiler bug.");
|
||||
Warn(ctx) << getErrorLoc(ctx, loc)
|
||||
<< "found R_MIPS_JALR relocation against non-function symbol "
|
||||
<< &s << ". This is invalid and most likely a compiler bug.";
|
||||
return R_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -108,13 +108,11 @@ static uint32_t getPicFlags(ArrayRef<FileFlags> files) {
|
||||
for (const FileFlags &f : files.slice(1)) {
|
||||
bool isPic2 = f.flags & (EF_MIPS_PIC | EF_MIPS_CPIC);
|
||||
if (isPic && !isPic2)
|
||||
warn(toString(f.file) +
|
||||
": linking non-abicalls code with abicalls code " +
|
||||
toString(files[0].file));
|
||||
Warn(ctx) << f.file << ": linking non-abicalls code with abicalls code "
|
||||
<< files[0].file;
|
||||
if (!isPic && isPic2)
|
||||
warn(toString(f.file) +
|
||||
": linking abicalls code with non-abicalls code " +
|
||||
toString(files[0].file));
|
||||
Warn(ctx) << f.file << ": linking abicalls code with non-abicalls code "
|
||||
<< files[0].file;
|
||||
}
|
||||
|
||||
// Compute the result PIC/non-PIC flag.
|
||||
|
||||
@ -1189,7 +1189,7 @@ mergeAttributesSection(Ctx &ctx,
|
||||
for (const InputSectionBase *sec : sections) {
|
||||
RISCVAttributeParser parser;
|
||||
if (Error e = parser.parse(sec->content(), llvm::endianness::little))
|
||||
warn(toString(sec) + ": " + llvm::toString(std::move(e)));
|
||||
Warn(ctx) << sec << ": " << llvm::toString(std::move(e));
|
||||
for (const auto &tag : attributesTags) {
|
||||
switch (RISCVAttrs::AttrType(tag.attr)) {
|
||||
// Integer attributes.
|
||||
|
||||
@ -86,7 +86,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args);
|
||||
|
||||
void elf::errorOrWarn(const Twine &msg) {
|
||||
if (ctx.arg.noinhibitExec)
|
||||
warn(msg);
|
||||
Warn(ctx) << msg;
|
||||
else
|
||||
ErrAlways(ctx) << msg;
|
||||
}
|
||||
@ -346,8 +346,9 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
|
||||
} else if (magic == file_magic::bitcode)
|
||||
files.push_back(make<BitcodeFile>(ctx, p.first, path, p.second, true));
|
||||
else
|
||||
warn(path + ": archive member '" + p.first.getBufferIdentifier() +
|
||||
"' is neither ET_REL nor LLVM bitcode");
|
||||
Warn(ctx) << path << ": archive member '"
|
||||
<< p.first.getBufferIdentifier()
|
||||
<< "' is neither ET_REL nor LLVM bitcode";
|
||||
}
|
||||
if (!saved.get())
|
||||
++nextGroupId;
|
||||
@ -627,7 +628,7 @@ static void checkZOptions(opt::InputArgList &args) {
|
||||
getZFlag(args, "rel", "rela", false);
|
||||
for (auto *arg : args.filtered(OPT_z))
|
||||
if (!arg->isClaimed())
|
||||
warn("unknown -z value: " + StringRef(arg->getValue()));
|
||||
Warn(ctx) << "unknown -z value: " << StringRef(arg->getValue());
|
||||
}
|
||||
|
||||
constexpr const char *saveTempsValues[] = {
|
||||
@ -838,11 +839,11 @@ static int getMemtagMode(Ctx &ctx, opt::InputArgList &args) {
|
||||
StringRef memtagModeArg = args.getLastArgValue(OPT_android_memtag_mode);
|
||||
if (memtagModeArg.empty()) {
|
||||
if (ctx.arg.androidMemtagStack)
|
||||
warn("--android-memtag-mode is unspecified, leaving "
|
||||
"--android-memtag-stack a no-op");
|
||||
Warn(ctx) << "--android-memtag-mode is unspecified, leaving "
|
||||
"--android-memtag-stack a no-op";
|
||||
else if (ctx.arg.androidMemtagHeap)
|
||||
warn("--android-memtag-mode is unspecified, leaving "
|
||||
"--android-memtag-heap a no-op");
|
||||
Warn(ctx) << "--android-memtag-mode is unspecified, leaving "
|
||||
"--android-memtag-heap a no-op";
|
||||
return ELF::NT_MEMTAG_LEVEL_NONE;
|
||||
}
|
||||
|
||||
@ -981,7 +982,7 @@ static void readCallGraph(Ctx &ctx, MemoryBufferRef mb) {
|
||||
Symbol *sym = map.lookup(name);
|
||||
if (!sym) {
|
||||
if (ctx.arg.warnSymbolOrdering)
|
||||
warn(mb.getBufferIdentifier() + ": no such symbol: " + name);
|
||||
Warn(ctx) << mb.getBufferIdentifier() << ": no such symbol: " << name;
|
||||
return nullptr;
|
||||
}
|
||||
maybeWarnUnorderableSymbol(ctx, sym);
|
||||
@ -1054,7 +1055,8 @@ processCallGraphRelocations(Ctx &ctx, SmallVector<uint32_t, 32> &symbolIndices,
|
||||
}
|
||||
}
|
||||
if (symbolIndices.empty())
|
||||
warn("SHT_LLVM_CALL_GRAPH_PROFILE exists, but relocation section doesn't");
|
||||
Warn(ctx)
|
||||
<< "SHT_LLVM_CALL_GRAPH_PROFILE exists, but relocation section doesn't";
|
||||
return !symbolIndices.empty();
|
||||
}
|
||||
|
||||
@ -1210,7 +1212,8 @@ static SmallVector<StringRef, 0> getSymbolOrderingFile(Ctx &ctx,
|
||||
SetVector<StringRef, SmallVector<StringRef, 0>> names;
|
||||
for (StringRef s : args::getLines(mb))
|
||||
if (!names.insert(s) && ctx.arg.warnSymbolOrdering)
|
||||
warn(mb.getBufferIdentifier() + ": duplicate ordered symbol: " + s);
|
||||
Warn(ctx) << mb.getBufferIdentifier()
|
||||
<< ": duplicate ordered symbol: " << s;
|
||||
|
||||
return names.takeVector();
|
||||
}
|
||||
@ -2118,7 +2121,8 @@ static uint64_t getMaxPageSize(Ctx &ctx, opt::InputArgList &args) {
|
||||
}
|
||||
if (ctx.arg.nmagic || ctx.arg.omagic) {
|
||||
if (val != ctx.target->defaultMaxPageSize)
|
||||
warn("-z max-page-size set, but paging disabled by omagic or nmagic");
|
||||
Warn(ctx)
|
||||
<< "-z max-page-size set, but paging disabled by omagic or nmagic";
|
||||
return 1;
|
||||
}
|
||||
return val;
|
||||
@ -2135,7 +2139,8 @@ static uint64_t getCommonPageSize(Ctx &ctx, opt::InputArgList &args) {
|
||||
}
|
||||
if (ctx.arg.nmagic || ctx.arg.omagic) {
|
||||
if (val != ctx.target->defaultCommonPageSize)
|
||||
warn("-z common-page-size set, but paging disabled by omagic or nmagic");
|
||||
Warn(ctx)
|
||||
<< "-z common-page-size set, but paging disabled by omagic or nmagic";
|
||||
return 1;
|
||||
}
|
||||
// commonPageSize can't be larger than maxPageSize.
|
||||
@ -2159,7 +2164,7 @@ static std::optional<uint64_t> getImageBase(Ctx &ctx, opt::InputArgList &args) {
|
||||
return 0;
|
||||
}
|
||||
if ((v % ctx.arg.maxPageSize) != 0)
|
||||
warn("--image-base: address isn't multiple of page size: " + s);
|
||||
Warn(ctx) << "--image-base: address isn't multiple of page size: " << s;
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -2316,8 +2321,8 @@ static void reportBackrefs(Ctx &ctx) {
|
||||
break;
|
||||
}
|
||||
if (!exclude)
|
||||
warn("backward reference detected: " + sym.getName() + " in " +
|
||||
toString(ref.second.first) + " refers to " + to);
|
||||
Warn(ctx) << "backward reference detected: " << sym.getName() << " in "
|
||||
<< ref.second.first << " refers to " << to;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2434,7 +2439,7 @@ static void findKeepUniqueSections(Ctx &ctx, opt::InputArgList &args) {
|
||||
StringRef name = arg->getValue();
|
||||
auto *d = dyn_cast_or_null<Defined>(ctx.symtab->find(name));
|
||||
if (!d || !d->section) {
|
||||
warn("could not find symbol " + name + " to keep unique");
|
||||
Warn(ctx) << "could not find symbol " << name << " to keep unique";
|
||||
continue;
|
||||
}
|
||||
d->section->keepUnique = true;
|
||||
@ -2749,7 +2754,7 @@ static void reportMissingFeature(StringRef config, const Twine &report) {
|
||||
if (config == "error")
|
||||
ErrAlways(ctx) << report;
|
||||
else if (config == "warning")
|
||||
warn(report);
|
||||
Warn(ctx) << report;
|
||||
}
|
||||
|
||||
static void checkAndReportMissingFeature(StringRef config, uint32_t features,
|
||||
@ -2820,13 +2825,15 @@ static void readSecurityNotes(Ctx &ctx) {
|
||||
} else if (ctx.arg.zForceIbt &&
|
||||
!(features & GNU_PROPERTY_X86_FEATURE_1_IBT)) {
|
||||
if (ctx.arg.zCetReport == "none")
|
||||
warn(toString(f) + ": -z force-ibt: file does not have "
|
||||
"GNU_PROPERTY_X86_FEATURE_1_IBT property");
|
||||
Warn(ctx) << f
|
||||
<< ": -z force-ibt: file does not have "
|
||||
"GNU_PROPERTY_X86_FEATURE_1_IBT property";
|
||||
features |= GNU_PROPERTY_X86_FEATURE_1_IBT;
|
||||
}
|
||||
if (ctx.arg.zPacPlt && !(features & GNU_PROPERTY_AARCH64_FEATURE_1_PAC)) {
|
||||
warn(toString(f) + ": -z pac-plt: file does not have "
|
||||
"GNU_PROPERTY_AARCH64_FEATURE_1_PAC property");
|
||||
Warn(ctx) << f
|
||||
<< ": -z pac-plt: file does not have "
|
||||
"GNU_PROPERTY_AARCH64_FEATURE_1_PAC property";
|
||||
features |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC;
|
||||
}
|
||||
ctx.arg.andFeatures &= features;
|
||||
|
||||
@ -482,7 +482,7 @@ template <class ELFT> DWARFCache *ObjFile<ELFT>::getDwarf() {
|
||||
std::make_unique<LLDDwarfObj<ELFT>>(this), "",
|
||||
[&](Error err) { warn(getName() + ": " + toString(std::move(err))); },
|
||||
[&](Error warning) {
|
||||
warn(getName() + ": " + toString(std::move(warning)));
|
||||
Warn(ctx) << getName() << ": " << std::move(warning);
|
||||
}));
|
||||
});
|
||||
|
||||
@ -634,7 +634,7 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
|
||||
? llvm::endianness::little
|
||||
: llvm::endianness::big)) {
|
||||
InputSection isec(*this, sec, name);
|
||||
warn(toString(&isec) + ": " + llvm::toString(std::move(e)));
|
||||
Warn(ctx) << &isec << ": " << llvm::toString(std::move(e));
|
||||
} else {
|
||||
updateSupportedARMFeatures(ctx, attributes);
|
||||
updateARMVFPArgs(ctx, attributes, this);
|
||||
@ -802,12 +802,12 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
|
||||
if (sec.sh_link != 0)
|
||||
this->addrsigSec = &sec;
|
||||
else if (ctx.arg.icf == ICFLevel::Safe)
|
||||
warn(toString(this) +
|
||||
": --icf=safe conservatively ignores "
|
||||
"SHT_LLVM_ADDRSIG [index " +
|
||||
Twine(i) +
|
||||
"] with sh_link=0 "
|
||||
"(likely created using objcopy or ld -r)");
|
||||
Warn(ctx) << this
|
||||
<< ": --icf=safe conservatively ignores "
|
||||
"SHT_LLVM_ADDRSIG [index "
|
||||
<< Twine(i)
|
||||
<< "] with sh_link=0 "
|
||||
"(likely created using objcopy or ld -r)";
|
||||
}
|
||||
this->sections[i] = &InputSection::discarded;
|
||||
continue;
|
||||
|
||||
@ -485,9 +485,9 @@ void InputSection::copyRelocations(Ctx &ctx, uint8_t *buf,
|
||||
sec->name != ".toc") {
|
||||
uint32_t secIdx = cast<Undefined>(sym).discardedSecIdx;
|
||||
Elf_Shdr_Impl<ELFT> sec = file->template getELFShdrs<ELFT>()[secIdx];
|
||||
warn("relocation refers to a discarded section: " +
|
||||
CHECK(file->getObj().getSectionName(sec), file) +
|
||||
"\n>>> referenced by " + getObjMsg(p->r_offset));
|
||||
Warn(ctx) << "relocation refers to a discarded section: "
|
||||
<< CHECK(file->getObj().getSectionName(sec), file)
|
||||
<< "\n>>> referenced by " << getObjMsg(p->r_offset);
|
||||
}
|
||||
p->setSymbolAndType(0, 0, false);
|
||||
continue;
|
||||
@ -661,9 +661,9 @@ static Relocation *getRISCVPCRelHi20(const InputSectionBase *loSec,
|
||||
"'");
|
||||
|
||||
if (addend != 0)
|
||||
warn(loSec->getLocation(loReloc.offset) +
|
||||
": non-zero addend in R_RISCV_PCREL_LO12 relocation to " +
|
||||
hiSec->getObjMsg(d->value) + " is ignored");
|
||||
Warn(ctx) << loSec->getLocation(loReloc.offset)
|
||||
<< ": non-zero addend in R_RISCV_PCREL_LO12 relocation to "
|
||||
<< hiSec->getObjMsg(d->value) << " is ignored";
|
||||
|
||||
// Relocations are sorted by offset, so we can use std::equal_range to do
|
||||
// binary search.
|
||||
@ -1125,7 +1125,7 @@ void InputSection::relocateNonAlloc(Ctx &ctx, uint8_t *buf,
|
||||
// against _GLOBAL_OFFSET_TABLE_ for .debug_info. The bug has been fixed in
|
||||
// 2017 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630), but we need to
|
||||
// keep this bug-compatible code for a while.
|
||||
warn(msg);
|
||||
Warn(ctx) << msg;
|
||||
target.relocateNoSym(
|
||||
bufLoc, type,
|
||||
SignExtend64<bits>(sym.getVA(ctx, addend - offset - outSecOff)));
|
||||
|
||||
@ -70,8 +70,9 @@ static lto::Config createConfig(Ctx &ctx) {
|
||||
c.Options.BBSections = BasicBlockSection::All;
|
||||
} else if (ctx.arg.ltoBasicBlockSections == "labels") {
|
||||
c.Options.BBAddrMap = true;
|
||||
warn("'--lto-basic-block-sections=labels' is deprecated; Please use "
|
||||
"'--lto-basic-block-address-map' instead");
|
||||
Warn(ctx)
|
||||
<< "'--lto-basic-block-sections=labels' is deprecated; Please use "
|
||||
"'--lto-basic-block-address-map' instead";
|
||||
} else if (ctx.arg.ltoBasicBlockSections == "none") {
|
||||
c.Options.BBSections = BasicBlockSection::None;
|
||||
} else {
|
||||
|
||||
@ -746,7 +746,7 @@ void LinkerScript::processSectionCommands() {
|
||||
OutputSection *osec = &osd->osec;
|
||||
if (process(osec) &&
|
||||
!map.try_emplace(CachedHashStringRef(osec->name), osd).second)
|
||||
warn("OVERWRITE_SECTIONS specifies duplicate " + osec->name);
|
||||
Warn(ctx) << "OVERWRITE_SECTIONS specifies duplicate " << osec->name;
|
||||
}
|
||||
for (SectionCommand *&base : sectionCommands) {
|
||||
if (auto *osd = dyn_cast<OutputDesc>(base)) {
|
||||
@ -1055,7 +1055,7 @@ void LinkerScript::diagnoseOrphanHandling() const {
|
||||
if (ctx.arg.orphanHandling == OrphanHandlingPolicy::Error)
|
||||
ErrAlways(ctx) << sec << " is being placed in '" << name << "'";
|
||||
else
|
||||
warn(toString(sec) + " is being placed in '" + name + "'");
|
||||
Warn(ctx) << sec << " is being placed in '" << name << "'";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1084,8 +1084,9 @@ LinkerScript::findMemoryRegion(OutputSection *sec, MemoryRegion *hint) {
|
||||
return ByteCommand::classof(comm);
|
||||
});
|
||||
if (!sec->memoryRegionName.empty() && hasInputOrByteCommand)
|
||||
warn("ignoring memory region assignment for non-allocatable section '" +
|
||||
sec->name + "'");
|
||||
Warn(ctx)
|
||||
<< "ignoring memory region assignment for non-allocatable section '"
|
||||
<< sec->name << "'";
|
||||
return {nullptr, nullptr};
|
||||
}
|
||||
|
||||
|
||||
@ -519,8 +519,7 @@ int64_t RelocationScanner::computeMipsAddend(const RelTy &rel, RelExpr expr,
|
||||
ri->getSymbol(ctx.arg.isMips64EL) == symIndex)
|
||||
return ctx.target->getImplicitAddend(buf + ri->r_offset, pairTy);
|
||||
|
||||
warn("can't find matching " + toString(pairTy) + " relocation for " +
|
||||
toString(type));
|
||||
Warn(ctx) << "can't find matching " << pairTy << " relocation for " << type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -796,7 +795,7 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,
|
||||
}
|
||||
|
||||
if (undef.isWarning)
|
||||
warn(msg);
|
||||
Warn(ctx) << msg;
|
||||
else
|
||||
error(msg, ErrorTag::SymbolNotFound, {sym.getName()});
|
||||
}
|
||||
@ -1588,9 +1587,10 @@ static void checkPPC64TLSRelax(InputSectionBase &sec, Relocs<RelTy> rels) {
|
||||
}
|
||||
if (hasGDLD) {
|
||||
sec.file->ppc64DisableTLSRelax = true;
|
||||
warn(toString(sec.file) +
|
||||
": disable TLS relaxation due to R_PPC64_GOT_TLS* relocations without "
|
||||
"R_PPC64_TLSGD/R_PPC64_TLSLD relocations");
|
||||
Warn(ctx) << sec.file
|
||||
<< ": disable TLS relaxation due to R_PPC64_GOT_TLS* relocations "
|
||||
"without "
|
||||
"R_PPC64_TLSGD/R_PPC64_TLSLD relocations";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -306,7 +306,8 @@ void ScriptParser::readNoCrossRefs(bool to) {
|
||||
while (auto tok = till(")"))
|
||||
cmd.outputSections.push_back(unquote(tok));
|
||||
if (cmd.outputSections.size() < 2)
|
||||
warn(getCurrentLocation() + ": ignored with fewer than 2 output sections");
|
||||
Warn(ctx) << getCurrentLocation()
|
||||
<< ": ignored with fewer than 2 output sections";
|
||||
else
|
||||
ctx.script->noCrossRefs.push_back(std::move(cmd));
|
||||
}
|
||||
|
||||
@ -240,8 +240,8 @@ bool SymbolTable::assignExactVersion(SymbolVersion ver, uint16_t versionId,
|
||||
if (sym->versionId == versionId)
|
||||
continue;
|
||||
|
||||
warn("attempt to reassign symbol '" + ver.name + "' of " +
|
||||
getName(sym->versionId) + " to " + getName(versionId));
|
||||
Warn(ctx) << "attempt to reassign symbol '" << ver.name << "' of "
|
||||
<< getName(sym->versionId) << " to " << getName(versionId);
|
||||
}
|
||||
return !syms.empty();
|
||||
}
|
||||
@ -325,12 +325,14 @@ void SymbolTable::scanVersionScript() {
|
||||
if (!asteriskReported && (isLocal || ver->id > VER_NDX_LOCAL)) {
|
||||
if ((isLocal && globalAsteriskFound) ||
|
||||
(!isLocal && localAsteriskFound)) {
|
||||
warn("wildcard pattern '*' is used for both 'local' and 'global' "
|
||||
"scopes in version script");
|
||||
Warn(ctx)
|
||||
<< "wildcard pattern '*' is used for both 'local' and 'global' "
|
||||
"scopes in version script";
|
||||
asteriskReported = true;
|
||||
} else if (!isLocal && globalAsteriskFound) {
|
||||
warn("wildcard pattern '*' is used for multiple version definitions in "
|
||||
"version script");
|
||||
Warn(ctx) << "wildcard pattern '*' is used for multiple version "
|
||||
"definitions in "
|
||||
"version script";
|
||||
asteriskReported = true;
|
||||
} else {
|
||||
localAsteriskFound = isLocal;
|
||||
|
||||
@ -501,7 +501,7 @@ void Symbol::resolve(Ctx &ctx, const Undefined &other) {
|
||||
bool Symbol::shouldReplace(Ctx &ctx, const Defined &other) const {
|
||||
if (LLVM_UNLIKELY(isCommon())) {
|
||||
if (ctx.arg.warnCommon)
|
||||
warn("common " + getName() + " is overridden");
|
||||
Warn(ctx) << "common " << getName() << " is overridden";
|
||||
return !other.isWeak();
|
||||
}
|
||||
if (!isDefined())
|
||||
@ -574,13 +574,13 @@ void Symbol::resolve(Ctx &ctx, const CommonSymbol &other) {
|
||||
}
|
||||
if (isDefined() && !isWeak()) {
|
||||
if (ctx.arg.warnCommon)
|
||||
warn("common " + getName() + " is overridden");
|
||||
Warn(ctx) << "common " << getName() << " is overridden";
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommonSymbol *oldSym = dyn_cast<CommonSymbol>(this)) {
|
||||
if (ctx.arg.warnCommon)
|
||||
warn("multiple common of " + getName());
|
||||
Warn(ctx) << "multiple common of " << getName();
|
||||
oldSym->alignment = std::max(oldSym->alignment, other.alignment);
|
||||
if (oldSym->size < other.size) {
|
||||
oldSym->file = other.file;
|
||||
|
||||
@ -2964,8 +2964,8 @@ void DebugNamesBaseSection::computeHdrAndAbbrevTable(
|
||||
// TODO: We don't handle type units yet, so LocalTypeUnitCount &
|
||||
// ForeignTypeUnitCount are left as 0.
|
||||
if (nd.hdr.LocalTypeUnitCount || nd.hdr.ForeignTypeUnitCount)
|
||||
warn(toString(inputChunk.section.sec) +
|
||||
Twine(": type units are not implemented"));
|
||||
Warn(ctx) << inputChunk.section.sec
|
||||
<< Twine(": type units are not implemented");
|
||||
// If augmentation strings are not identical, use an empty string.
|
||||
if (i == 0) {
|
||||
hdr.AugmentationStringSize = nd.hdr.AugmentationStringSize;
|
||||
@ -3383,12 +3383,12 @@ readAddressAreas(DWARFContext &dwarf, InputSection *sec) {
|
||||
uint32_t cuIdx = 0;
|
||||
for (std::unique_ptr<DWARFUnit> &cu : dwarf.compile_units()) {
|
||||
if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
|
||||
warn(toString(sec) + ": " + toString(std::move(e)));
|
||||
Warn(ctx) << sec << ": " << std::move(e);
|
||||
return {};
|
||||
}
|
||||
Expected<DWARFAddressRangesVector> ranges = cu->collectAddressRanges();
|
||||
if (!ranges) {
|
||||
warn(toString(sec) + ": " + toString(ranges.takeError()));
|
||||
Warn(ctx) << sec << ": " << ranges.takeError();
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -3421,7 +3421,7 @@ readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj,
|
||||
ELFT::Is64Bits ? 8 : 4);
|
||||
DWARFDebugPubTable table;
|
||||
table.extract(data, /*GnuStyle=*/true, [&](Error e) {
|
||||
warn(toString(pub->sec) + ": " + toString(std::move(e)));
|
||||
Warn(ctx) << pub->sec << ": " << std::move(e);
|
||||
});
|
||||
for (const DWARFDebugPubTable::Set &set : table.getData()) {
|
||||
// The value written into the constant pool is kind << 24 | cuIndex. As we
|
||||
|
||||
@ -1121,7 +1121,8 @@ static DenseMap<const InputSectionBase *, int> buildSectionOrder(Ctx &ctx) {
|
||||
if (ctx.arg.warnSymbolOrdering)
|
||||
for (auto orderEntry : symbolOrder)
|
||||
if (!orderEntry.second.present)
|
||||
warn("symbol ordering file: no such symbol: " + orderEntry.first.val());
|
||||
Warn(ctx) << "symbol ordering file: no such symbol: "
|
||||
<< orderEntry.first.val();
|
||||
|
||||
return sectionOrder;
|
||||
}
|
||||
@ -1563,9 +1564,10 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
|
||||
if (auto *osd = dyn_cast<OutputDesc>(cmd)) {
|
||||
OutputSection *osec = &osd->osec;
|
||||
if (osec->addr % osec->addralign != 0)
|
||||
warn("address (0x" + Twine::utohexstr(osec->addr) + ") of section " +
|
||||
osec->name + " is not a multiple of alignment (" +
|
||||
Twine(osec->addralign) + ")");
|
||||
Warn(ctx) << "address (0x" << Twine::utohexstr(osec->addr)
|
||||
<< ") of section " << osec->name
|
||||
<< " is not a multiple of alignment ("
|
||||
<< Twine(osec->addralign) << ")";
|
||||
}
|
||||
|
||||
// Sizes are no longer allowed to grow, so all allowable spills have been
|
||||
@ -2722,8 +2724,8 @@ static uint64_t getEntryAddr(Ctx &ctx) {
|
||||
|
||||
// Case 5
|
||||
if (ctx.arg.warnMissingEntry)
|
||||
warn("cannot find entry symbol " + ctx.arg.entry +
|
||||
"; not setting start address");
|
||||
Warn(ctx) << "cannot find entry symbol " << ctx.arg.entry
|
||||
<< "; not setting start address";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user