diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h --- a/lld/wasm/InputChunks.h +++ b/lld/wasm/InputChunks.h @@ -49,8 +49,6 @@ StringRef name; StringRef debugName; - StringRef getName() const { return name; } - StringRef getDebugName() const { return debugName; } Kind kind() const { return (Kind)sectionKind; } uint32_t getSize() const; diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp --- a/lld/wasm/InputChunks.cpp +++ b/lld/wasm/InputChunks.cpp @@ -51,7 +51,7 @@ } std::string toString(const wasm::InputChunk *c) { - return (toString(c->file) + ":(" + c->getName() + ")").str(); + return (toString(c->file) + ":(" + c->name + ")").str(); } namespace wasm { @@ -196,14 +196,14 @@ } void InputFunction::setFunctionIndex(uint32_t index) { - LLVM_DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << getName() - << " -> " << index << "\n"); + LLVM_DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << name << " -> " + << index << "\n"); assert(!hasFunctionIndex()); functionIndex = index; } void InputFunction::setTableIndex(uint32_t index) { - LLVM_DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> " + LLVM_DEBUG(dbgs() << "InputFunction::setTableIndex: " << name << " -> " << index << "\n"); assert(!hasTableIndex()); tableIndex = index; @@ -271,7 +271,7 @@ if (!file || !config->compressRelocations) return; - LLVM_DEBUG(dbgs() << "calculateSize: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "calculateSize: " << name << "\n"); const uint8_t *secStart = file->codeSection->Content.data(); const uint8_t *funcStart = secStart + getInputSectionOffset(); @@ -318,7 +318,7 @@ decodeULEB128(funcStart, &count); funcStart += count; - LLVM_DEBUG(dbgs() << "write func: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "write func: " << name << "\n"); buf += encodeULEB128(compressedFuncSize, buf); const uint8_t *lastRelocEnd = funcStart; for (const WasmRelocation &rel : relocations) { @@ -339,7 +339,7 @@ uint64_t InputChunk::getChunkOffset(uint64_t offset) const { if (const auto *ms = dyn_cast(this)) { - LLVM_DEBUG(dbgs() << "getChunkOffset(merged): " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "getChunkOffset(merged): " << name << "\n"); LLVM_DEBUG(dbgs() << "offset: " << offset << "\n"); LLVM_DEBUG(dbgs() << "parentOffset: " << ms->getParentOffset(offset) << "\n"); @@ -361,7 +361,7 @@ // This is only called when generating shared libraries (PIC) where address are // not known at static link time. void InputChunk::generateRelocationCode(raw_ostream &os) const { - LLVM_DEBUG(dbgs() << "generating runtime relocations: " << getName() + LLVM_DEBUG(dbgs() << "generating runtime relocations: " << name << " count=" << relocations.size() << "\n"); bool is64 = config->is64.getValueOr(false); diff --git a/lld/wasm/OutputSegment.cpp b/lld/wasm/OutputSegment.cpp --- a/lld/wasm/OutputSegment.cpp +++ b/lld/wasm/OutputSegment.cpp @@ -23,8 +23,8 @@ alignment = std::max(alignment, inSeg->alignment); inputSegments.push_back(inSeg); size = llvm::alignTo(size, 1ULL << inSeg->alignment); - LLVM_DEBUG(dbgs() << "addInputSegment: " << inSeg->getName() - << " oname=" << name << " size=" << inSeg->getSize() + LLVM_DEBUG(dbgs() << "addInputSegment: " << inSeg->name << " oname=" << name + << " size=" << inSeg->getSize() << " align=" << inSeg->alignment << " at:" << size << "\n"); inSeg->outputSeg = this; inSeg->outputSegmentOffset = size; @@ -75,7 +75,7 @@ size = 0; for (InputChunk *seg : inputSegments) { size = llvm::alignTo(size, 1ULL << seg->alignment); - LLVM_DEBUG(llvm::dbgs() << "outputSegmentOffset set: " << seg->getName() + LLVM_DEBUG(llvm::dbgs() << "outputSegmentOffset set: " << seg->name << " -> " << size << "\n"); seg->outputSegmentOffset = size; size += seg->getSize(); diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -735,7 +735,7 @@ unsigned numNames = out.importSec->getNumImportedFunctions(); for (const InputFunction *f : out.functionSec->inputFunctions) - if (!f->getName().empty() || !f->getDebugName().empty()) + if (!f->name.empty() || !f->debugName.empty()) ++numNames; return numNames; @@ -779,12 +779,12 @@ } } for (const InputFunction *f : out.functionSec->inputFunctions) { - if (!f->getName().empty()) { + if (!f->name.empty()) { writeUleb128(sub.os, f->getFunctionIndex(), "func index"); - if (!f->getDebugName().empty()) { - writeStr(sub.os, f->getDebugName(), "symbol name"); + if (!f->debugName.empty()) { + writeStr(sub.os, f->debugName, "symbol name"); } else { - writeStr(sub.os, maybeDemangleSymbol(f->getName()), "symbol name"); + writeStr(sub.os, maybeDemangleSymbol(f->name), "symbol name"); } } } diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -130,7 +130,7 @@ // Exclude COMDAT sections that are not selected for inclusion if (section->discarded) continue; - StringRef name = section->getName(); + StringRef name = section->name; // These custom sections are known the linker and synthesized rather than // blindly copied. if (name == "linking" || name == "name" || name == "producers" || @@ -859,18 +859,17 @@ // symbols are be relative to single __tls_base. if (seg.isTLS()) return ".tdata"; - StringRef name = seg.getName(); if (!config->mergeDataSegments) - return name; - if (name.startswith(".text.")) + return seg.name; + if (seg.name.startswith(".text.")) return ".text"; - if (name.startswith(".data.")) + if (seg.name.startswith(".data.")) return ".data"; - if (name.startswith(".bss.")) + if (seg.name.startswith(".bss.")) return ".bss"; - if (name.startswith(".rodata.")) + if (seg.name.startswith(".rodata.")) return ".rodata"; - return name; + return seg.name; } OutputSegment *Writer::createOutputSegment(StringRef name) { @@ -952,7 +951,7 @@ combined->addInputSegment(inSeg); #ifndef NDEBUG uint64_t newVA = inSeg->getVA(); - LLVM_DEBUG(dbgs() << "added input segment. name=" << inSeg->getName() + LLVM_DEBUG(dbgs() << "added input segment. name=" << inSeg->name << " oldVA=" << oldVA << " newVA=" << newVA << "\n"); assert(oldVA == newVA); #endif