mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 01:06:32 +00:00
[ELF] Remove unneeded Twine in ELFSyncStream
This commit is contained in:
parent
c4dc5ed825
commit
1cd627562b
@ -557,8 +557,8 @@ void ARM::encodeAluGroup(uint8_t *loc, const Relocation &rel, uint64_t val,
|
||||
rot = (lz + 8) << 7;
|
||||
}
|
||||
if (check && imm > 0xff)
|
||||
Err(ctx) << getErrorLoc(ctx, loc) << "unencodeable immediate "
|
||||
<< Twine(val).str() << " for relocation " << rel.type;
|
||||
Err(ctx) << getErrorLoc(ctx, loc) << "unencodeable immediate " << val
|
||||
<< " for relocation " << rel.type;
|
||||
write32(ctx, loc,
|
||||
(read32(ctx, loc) & 0xff3ff000) | opcode | rot | (imm & 0xff));
|
||||
}
|
||||
@ -1238,8 +1238,8 @@ template <class ELFT> void ObjFile<ELFT>::importCmseSymbols() {
|
||||
|
||||
if (eSym.st_size != ACLESESYM_SIZE) {
|
||||
Warn(ctx) << "CMSE symbol '" << sym->getName() << "' in import library '"
|
||||
<< this << "' does not have correct size of "
|
||||
<< Twine(ACLESESYM_SIZE) << " bytes";
|
||||
<< this << "' does not have correct size of " << ACLESESYM_SIZE
|
||||
<< " bytes";
|
||||
}
|
||||
|
||||
ctx.symtab->cmseImportLib[sym->getName()] = sym;
|
||||
|
@ -775,8 +775,8 @@ static bool relax(Ctx &ctx, InputSection &sec) {
|
||||
if (LLVM_UNLIKELY(static_cast<int32_t>(remove) < 0)) {
|
||||
Err(ctx) << getErrorLoc(ctx, (const uint8_t *)loc)
|
||||
<< "insufficient padding bytes for " << r.type << ": "
|
||||
<< Twine(allBytes) << " bytes available for "
|
||||
<< "requested alignment of " << Twine(align) << " bytes";
|
||||
<< allBytes << " bytes available for "
|
||||
<< "requested alignment of " << align << " bytes";
|
||||
remove = 0;
|
||||
}
|
||||
break;
|
||||
@ -807,7 +807,7 @@ static bool relax(Ctx &ctx, InputSection &sec) {
|
||||
}
|
||||
// Inform assignAddresses that the size has changed.
|
||||
if (!isUInt<32>(delta))
|
||||
Fatal(ctx) << "section size decrease is too large: " << Twine(delta);
|
||||
Fatal(ctx) << "section size decrease is too large: " << delta;
|
||||
sec.bytesDropped = delta;
|
||||
return changed;
|
||||
}
|
||||
@ -838,7 +838,7 @@ bool LoongArch::relaxOnce(int pass) const {
|
||||
}
|
||||
|
||||
void LoongArch::finalizeRelax(int passes) const {
|
||||
Log(ctx) << "relaxation passes: " << Twine(passes);
|
||||
Log(ctx) << "relaxation passes: " << passes;
|
||||
SmallVector<InputSection *, 0> storage;
|
||||
for (OutputSection *osec : ctx.outputSections) {
|
||||
if (!(osec->flags & SHF_EXECINSTR))
|
||||
|
@ -503,7 +503,7 @@ calculateMipsRelChain(Ctx &ctx, uint8_t *loc, uint32_t type, uint64_t val) {
|
||||
if (type2 == R_MIPS_SUB && (type3 == R_MIPS_HI16 || type3 == R_MIPS_LO16))
|
||||
return std::make_pair(type3, -val);
|
||||
Err(ctx) << getErrorLoc(ctx, loc) << "unsupported relocations combination "
|
||||
<< Twine(type);
|
||||
<< type;
|
||||
return std::make_pair(type & 0xff, val);
|
||||
}
|
||||
|
||||
|
@ -658,9 +658,9 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
|
||||
auto val = rel.sym->getVA(ctx, rel.addend) -
|
||||
rel1.sym->getVA(ctx, rel1.addend);
|
||||
if (overwriteULEB128(loc, val) >= 0x80)
|
||||
Err(ctx) << sec.getLocation(rel.offset) << ": ULEB128 value "
|
||||
<< Twine(val) << " exceeds available space; references '"
|
||||
<< rel.sym << "'";
|
||||
Err(ctx) << sec.getLocation(rel.offset) << ": ULEB128 value " << val
|
||||
<< " exceeds available space; references '" << rel.sym
|
||||
<< "'";
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
@ -832,10 +832,10 @@ static bool relax(Ctx &ctx, InputSection &sec) {
|
||||
if (LLVM_UNLIKELY(static_cast<int32_t>(remove) < 0)) {
|
||||
Err(ctx) << getErrorLoc(ctx, (const uint8_t *)loc)
|
||||
<< "insufficient padding bytes for " << r.type << ": "
|
||||
<< Twine(r.addend)
|
||||
<< r.addend
|
||||
<< " bytes available "
|
||||
"for requested alignment of "
|
||||
<< Twine(align) << " bytes";
|
||||
<< align << " bytes";
|
||||
remove = 0;
|
||||
}
|
||||
break;
|
||||
@ -899,7 +899,7 @@ static bool relax(Ctx &ctx, InputSection &sec) {
|
||||
}
|
||||
// Inform assignAddresses that the size has changed.
|
||||
if (!isUInt<32>(delta))
|
||||
Fatal(ctx) << "section size decrease is too large: " << Twine(delta);
|
||||
Fatal(ctx) << "section size decrease is too large: " << delta;
|
||||
sec.bytesDropped = delta;
|
||||
return changed;
|
||||
}
|
||||
@ -932,7 +932,7 @@ bool RISCV::relaxOnce(int pass) const {
|
||||
|
||||
void RISCV::finalizeRelax(int passes) const {
|
||||
llvm::TimeTraceScope timeScope("Finalize RISC-V relaxation");
|
||||
Log(ctx) << "relaxation passes: " << Twine(passes);
|
||||
Log(ctx) << "relaxation passes: " << passes;
|
||||
SmallVector<InputSection *, 0> storage;
|
||||
for (OutputSection *osec : ctx.outputSections) {
|
||||
if (!(osec->flags & SHF_EXECINSTR))
|
||||
@ -1095,10 +1095,9 @@ static void mergeAtomic(Ctx &ctx, DenseMap<unsigned, unsigned>::iterator it,
|
||||
|
||||
auto reportAbiError = [&]() {
|
||||
Err(ctx) << "atomic abi mismatch for " << oldSection->name << "\n>>> "
|
||||
<< oldSection
|
||||
<< ": atomic_abi=" << Twine(static_cast<unsigned>(oldTag))
|
||||
<< oldSection << ": atomic_abi=" << static_cast<unsigned>(oldTag)
|
||||
<< "\n>>> " << newSection
|
||||
<< ": atomic_abi=" << Twine(static_cast<unsigned>(newTag));
|
||||
<< ": atomic_abi=" << static_cast<unsigned>(newTag);
|
||||
};
|
||||
|
||||
auto reportUnknownAbiError = [&](const InputSectionBase *section,
|
||||
@ -1111,7 +1110,7 @@ static void mergeAtomic(Ctx &ctx, DenseMap<unsigned, unsigned>::iterator it,
|
||||
return;
|
||||
};
|
||||
Err(ctx) << "unknown atomic abi for " << section->name << "\n>>> "
|
||||
<< section << ": atomic_abi=" << Twine(static_cast<unsigned>(tag));
|
||||
<< section << ": atomic_abi=" << static_cast<unsigned>(tag);
|
||||
};
|
||||
switch (oldTag) {
|
||||
case RISCVAtomicAbiTag::UNKNOWN:
|
||||
|
@ -1327,15 +1327,13 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
|
||||
OPT_no_lto_validate_all_vtables_have_type_infos, false);
|
||||
ctx.arg.ltoo = args::getInteger(args, OPT_lto_O, 2);
|
||||
if (ctx.arg.ltoo > 3)
|
||||
ErrAlways(ctx) << "invalid optimization level for LTO: "
|
||||
<< Twine(ctx.arg.ltoo);
|
||||
ErrAlways(ctx) << "invalid optimization level for LTO: " << ctx.arg.ltoo;
|
||||
unsigned ltoCgo =
|
||||
args::getInteger(args, OPT_lto_CGO, args::getCGOptLevel(ctx.arg.ltoo));
|
||||
if (auto level = CodeGenOpt::getLevel(ltoCgo))
|
||||
ctx.arg.ltoCgo = *level;
|
||||
else
|
||||
ErrAlways(ctx) << "invalid codegen optimization level for LTO: "
|
||||
<< Twine(ltoCgo);
|
||||
ErrAlways(ctx) << "invalid codegen optimization level for LTO: " << ltoCgo;
|
||||
ctx.arg.ltoObjPath = args.getLastArgValue(OPT_lto_obj_path_eq);
|
||||
ctx.arg.ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1);
|
||||
ctx.arg.ltoSampleProfile = args.getLastArgValue(OPT_lto_sample_profile);
|
||||
|
@ -542,7 +542,7 @@ template <class ELFT> void ICF<ELFT>::run() {
|
||||
});
|
||||
} while (repeat);
|
||||
|
||||
Log(ctx) << "ICF needed " << Twine(cnt) << " iterations";
|
||||
Log(ctx) << "ICF needed " << cnt << " iterations";
|
||||
|
||||
// Merge sections by the equivalence class.
|
||||
forEachClassRange(0, sections.size(), [&](size_t begin, size_t end) {
|
||||
|
@ -133,8 +133,7 @@ static void updateARMVFPArgs(Ctx &ctx, const ARMAttributeParser &attributes,
|
||||
// Object compatible with all conventions.
|
||||
return;
|
||||
default:
|
||||
ErrAlways(ctx) << f
|
||||
<< ": unknown Tag_ABI_VFP_args value: " << Twine(vfpArgs);
|
||||
ErrAlways(ctx) << f << ": unknown Tag_ABI_VFP_args value: " << vfpArgs;
|
||||
return;
|
||||
}
|
||||
// Follow ld.bfd and error if there is a mix of calling conventions.
|
||||
@ -691,8 +690,7 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
|
||||
// Otherwise, discard group members.
|
||||
for (uint32_t secIndex : entries.slice(1)) {
|
||||
if (secIndex >= size)
|
||||
Fatal(ctx) << this
|
||||
<< ": invalid section index in group: " << Twine(secIndex);
|
||||
Fatal(ctx) << this << ": invalid section index in group: " << secIndex;
|
||||
this->sections[secIndex] = &InputSection::discarded;
|
||||
}
|
||||
}
|
||||
@ -748,8 +746,8 @@ bool ObjFile<ELFT>::shouldMerge(const Elf_Shdr &sec, StringRef name) {
|
||||
return false;
|
||||
if (sec.sh_size % entSize)
|
||||
Fatal(ctx) << this << ":(" << name << "): SHF_MERGE section size ("
|
||||
<< Twine(sec.sh_size) << ") must be a multiple of sh_entsize ("
|
||||
<< Twine(entSize) << ")";
|
||||
<< uint64_t(sec.sh_size)
|
||||
<< ") must be a multiple of sh_entsize (" << entSize << ")";
|
||||
|
||||
if (sec.sh_flags & SHF_WRITE)
|
||||
Fatal(ctx) << this << ":(" << name
|
||||
@ -810,7 +808,7 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
|
||||
Warn(ctx) << this
|
||||
<< ": --icf=safe conservatively ignores "
|
||||
"SHT_LLVM_ADDRSIG [index "
|
||||
<< Twine(i)
|
||||
<< i
|
||||
<< "] with sh_link=0 "
|
||||
"(likely created using objcopy or ld -r)";
|
||||
}
|
||||
@ -939,7 +937,8 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
|
||||
if (sec.sh_link < size)
|
||||
linkSec = this->sections[sec.sh_link];
|
||||
if (!linkSec)
|
||||
Fatal(ctx) << this << ": invalid sh_link index: " << Twine(sec.sh_link);
|
||||
Fatal(ctx) << this
|
||||
<< ": invalid sh_link index: " << uint32_t(sec.sh_link);
|
||||
|
||||
// A SHF_LINK_ORDER section is discarded if its linked-to section is
|
||||
// discarded.
|
||||
@ -1167,7 +1166,7 @@ void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) {
|
||||
if (LLVM_UNLIKELY(eSym.st_shndx == SHN_COMMON)) {
|
||||
if (value == 0 || value >= UINT32_MAX)
|
||||
Fatal(ctx) << this << ": common symbol '" << sym->getName()
|
||||
<< "' has invalid alignment: " << Twine(value);
|
||||
<< "' has invalid alignment: " << value;
|
||||
hasCommonSyms = true;
|
||||
sym->resolve(ctx, CommonSymbol{ctx, this, StringRef(), binding, stOther,
|
||||
type, value, size});
|
||||
@ -1214,7 +1213,7 @@ void ObjFile<ELFT>::initSectionsAndLocalSyms(bool ignoreComdats) {
|
||||
else if (secIdx >= SHN_LORESERVE)
|
||||
secIdx = 0;
|
||||
if (LLVM_UNLIKELY(secIdx >= sections.size()))
|
||||
Fatal(ctx) << this << ": invalid section index: " << Twine(secIdx);
|
||||
Fatal(ctx) << this << ": invalid section index: " << secIdx;
|
||||
if (LLVM_UNLIKELY(eSym.getBinding() != STB_LOCAL))
|
||||
ErrAlways(ctx) << this << ": non-local symbol (" << i
|
||||
<< ") found at index < .symtab's sh_info (" << end << ")";
|
||||
@ -1274,7 +1273,7 @@ template <class ELFT> void ObjFile<ELFT>::postParse() {
|
||||
else if (secIdx >= SHN_LORESERVE)
|
||||
secIdx = 0;
|
||||
if (LLVM_UNLIKELY(secIdx >= sections.size()))
|
||||
Fatal(ctx) << this << ": invalid section index: " << Twine(secIdx);
|
||||
Fatal(ctx) << this << ": invalid section index: " << secIdx;
|
||||
InputSectionBase *sec = sections[secIdx];
|
||||
if (sec == &InputSection::discarded) {
|
||||
if (sym.traced) {
|
||||
@ -1577,8 +1576,8 @@ template <class ELFT> void SharedFile::parse() {
|
||||
// as of binutils 2.34, GNU ld produces VER_NDX_LOCAL.
|
||||
if (ver != VER_NDX_LOCAL && ver != VER_NDX_GLOBAL) {
|
||||
if (idx >= verneeds.size()) {
|
||||
ErrAlways(ctx) << "corrupt input file: version need index "
|
||||
<< Twine(idx) << " for symbol " << name
|
||||
ErrAlways(ctx) << "corrupt input file: version need index " << idx
|
||||
<< " for symbol " << name
|
||||
<< " is out of bounds\n>>> defined in " << this;
|
||||
continue;
|
||||
}
|
||||
@ -1602,8 +1601,8 @@ template <class ELFT> void SharedFile::parse() {
|
||||
// VER_NDX_LOCAL. Workaround this bug.
|
||||
if (ctx.arg.emachine == EM_MIPS && name == "_gp_disp")
|
||||
continue;
|
||||
ErrAlways(ctx) << "corrupt input file: version definition index "
|
||||
<< Twine(idx) << " for symbol " << name
|
||||
ErrAlways(ctx) << "corrupt input file: version definition index " << idx
|
||||
<< " for symbol " << name
|
||||
<< " is out of bounds\n>>> defined in " << this;
|
||||
continue;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ void InputSectionBase::parseCompressedHeader(Ctx &ctx) {
|
||||
"not built with zstd support";
|
||||
} else {
|
||||
ErrAlways(ctx) << this << ": unsupported compression type ("
|
||||
<< Twine(hdr->ch_type) << ")";
|
||||
<< uint32_t(hdr->ch_type) << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1784,7 +1784,7 @@ static void checkMemoryRegion(Ctx &ctx, const MemoryRegion *region,
|
||||
if (osecEnd > regionEnd) {
|
||||
ErrAlways(ctx) << "section '" << osec->name << "' will not fit in region '"
|
||||
<< region->name << "': overflowed by "
|
||||
<< Twine(osecEnd - regionEnd) << " bytes";
|
||||
<< (osecEnd - regionEnd) << " bytes";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2116,8 +2116,8 @@ template <class ELFT> bool RelrSection<ELFT>::updateAllocSize(Ctx &ctx) {
|
||||
// Don't allow the section to shrink; otherwise the size of the section can
|
||||
// oscillate infinitely. Trailing 1s do not decode to more relocations.
|
||||
if (relrRelocs.size() < oldSize) {
|
||||
Log(ctx) << ".relr.dyn needs " << Twine(oldSize - relrRelocs.size()) <<
|
||||
" padding word(s)";
|
||||
Log(ctx) << ".relr.dyn needs " << (oldSize - relrRelocs.size())
|
||||
<< " padding word(s)";
|
||||
relrRelocs.resize(oldSize, Elf_Relr(1));
|
||||
}
|
||||
|
||||
@ -2870,7 +2870,7 @@ void DebugNamesBaseSection::parseDebugNames(
|
||||
nd.hdr = ni.getHeader();
|
||||
if (nd.hdr.Format != DwarfFormat::DWARF32) {
|
||||
Err(ctx) << namesSec.sec
|
||||
<< Twine(": found DWARF64, which is currently unsupported");
|
||||
<< ": found DWARF64, which is currently unsupported";
|
||||
return;
|
||||
}
|
||||
if (nd.hdr.Version != 5) {
|
||||
@ -2880,8 +2880,7 @@ void DebugNamesBaseSection::parseDebugNames(
|
||||
uint32_t dwarfSize = dwarf::getDwarfOffsetByteSize(DwarfFormat::DWARF32);
|
||||
DWARFDebugNames::DWARFDebugNamesOffsets locs = ni.getOffsets();
|
||||
if (locs.EntriesBase > namesExtractor.getData().size()) {
|
||||
Err(ctx) << namesSec.sec
|
||||
<< Twine(": entry pool start is beyond end of section");
|
||||
Err(ctx) << namesSec.sec << ": entry pool start is beyond end of section";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2962,7 +2961,7 @@ void DebugNamesBaseSection::computeHdrAndAbbrevTable(
|
||||
// ForeignTypeUnitCount are left as 0.
|
||||
if (nd.hdr.LocalTypeUnitCount || nd.hdr.ForeignTypeUnitCount)
|
||||
Warn(ctx) << inputChunk.section.sec
|
||||
<< Twine(": type units are not implemented");
|
||||
<< ": type units are not implemented";
|
||||
// If augmentation strings are not identical, use an empty string.
|
||||
if (i == 0) {
|
||||
hdr.AugmentationStringSize = nd.hdr.AugmentationStringSize;
|
||||
|
@ -84,7 +84,7 @@ void elf::setTarget(Ctx &ctx) {
|
||||
case EM_X86_64:
|
||||
return setX86_64TargetInfo(ctx);
|
||||
default:
|
||||
Fatal(ctx) << "unsupported e_machine value: " << Twine(ctx.arg.emachine);
|
||||
Fatal(ctx) << "unsupported e_machine value: " << ctx.arg.emachine;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ inline void checkAlignment(Ctx &ctx, uint8_t *loc, uint64_t v, int n,
|
||||
if ((v & (n - 1)) != 0)
|
||||
Err(ctx) << getErrorLoc(ctx, loc) << "improper alignment for relocation "
|
||||
<< rel.type << ": 0x" << llvm::utohexstr(v)
|
||||
<< " is not aligned to " << Twine(n) << " bytes";
|
||||
<< " is not aligned to " << n << " bytes";
|
||||
}
|
||||
|
||||
// Endianness-aware read/write.
|
||||
|
@ -1572,8 +1572,8 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
|
||||
if (osec->addr % osec->addralign != 0)
|
||||
Warn(ctx) << "address (0x" << Twine::utohexstr(osec->addr)
|
||||
<< ") of section " << osec->name
|
||||
<< " is not a multiple of alignment ("
|
||||
<< Twine(osec->addralign) << ")";
|
||||
<< " is not a multiple of alignment (" << osec->addralign
|
||||
<< ")";
|
||||
}
|
||||
|
||||
// Sizes are no longer allowed to grow, so all allowable spills have been
|
||||
@ -2794,7 +2794,7 @@ template <class ELFT> void Writer<ELFT>::openFile() {
|
||||
if (fileSize != size_t(fileSize) || maxSize < fileSize) {
|
||||
std::string msg;
|
||||
raw_string_ostream s(msg);
|
||||
s << "output file too large: " << Twine(fileSize) << " bytes\n"
|
||||
s << "output file too large: " << fileSize << " bytes\n"
|
||||
<< "section sizes:\n";
|
||||
for (OutputSection *os : ctx.outputSections)
|
||||
s << os->name << ' ' << os->size << "\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user