diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -116,8 +116,6 @@ // Returns the underlying wasm file. const WasmObjectFile *getWasmObj() const { return wasmObj.get(); } - void dumpInfo() const; - uint32_t calcNewIndex(const WasmRelocation &reloc) const; uint64_t calcNewValue(const WasmRelocation &reloc, uint64_t tombstone, const InputChunk *chunk) const; diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -88,15 +88,6 @@ fatal("unknown file type: " + mb.getBufferIdentifier()); } -void ObjFile::dumpInfo() const { - log("info for: " + toString(this) + - "\n Symbols : " + Twine(symbols.size()) + - "\n Function Imports : " + Twine(wasmObj->getNumImportedFunctions()) + - "\n Global Imports : " + Twine(wasmObj->getNumImportedGlobals()) + - "\n Tag Imports : " + Twine(wasmObj->getNumImportedTags()) + - "\n Table Imports : " + Twine(wasmObj->getNumImportedTables())); -} - // Relocations contain either symbol or type indices. This function takes a // relocation and returns relocated index (i.e. translates from the input // symbol/type space to the output symbol/type space). diff --git a/lld/wasm/OutputSections.h b/lld/wasm/OutputSections.h --- a/lld/wasm/OutputSections.h +++ b/lld/wasm/OutputSections.h @@ -33,10 +33,7 @@ virtual ~OutputSection() = default; StringRef getSectionName() const; - void setOffset(size_t newOffset) { - log("setOffset: " + toString(*this) + ": " + Twine(newOffset)); - offset = newOffset; - } + void setOffset(size_t newOffset) { offset = newOffset; } void createHeader(size_t bodySize); virtual bool isNeeded() const { return true; } virtual size_t getSize() const = 0; diff --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp --- a/lld/wasm/OutputSections.cpp +++ b/lld/wasm/OutputSections.cpp @@ -101,8 +101,8 @@ } void CodeSection::writeTo(uint8_t *buf) { - log("writing " + toString(*this)); - log(" size=" + Twine(getSize())); + log("writing " + toString(*this) + " offset=" + Twine(offset) + + " size=" + Twine(getSize())); log(" headersize=" + Twine(header.size())); log(" codeheadersize=" + Twine(codeSectionHeader.size())); buf += offset; @@ -187,8 +187,8 @@ } void DataSection::writeTo(uint8_t *buf) { - log("writing " + toString(*this) + " size=" + Twine(getSize()) + - " body=" + Twine(bodySize)); + log("writing " + toString(*this) + " offset=" + Twine(offset) + + " size=" + Twine(getSize()) + " body=" + Twine(bodySize)); buf += offset; // Write section header @@ -279,8 +279,8 @@ } void CustomSection::writeTo(uint8_t *buf) { - log("writing " + toString(*this) + " size=" + Twine(getSize()) + - " chunks=" + Twine(inputSections.size())); + log("writing " + toString(*this) + " offset=" + Twine(offset) + + " size=" + Twine(getSize()) + " chunks=" + Twine(inputSections.size())); assert(offset); buf += offset; diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -1513,8 +1513,6 @@ log("Global Imports : " + Twine(out.importSec->getNumImportedGlobals())); log("Tag Imports : " + Twine(out.importSec->getNumImportedTags())); log("Table Imports : " + Twine(out.importSec->getNumImportedTables())); - for (ObjFile *file : symtab->objectFiles) - file->dumpInfo(); } createHeader(); diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h --- a/lld/wasm/WriterUtils.h +++ b/lld/wasm/WriterUtils.h @@ -16,7 +16,11 @@ namespace lld { namespace wasm { +#ifdef LLVM_DEBUG void debugWrite(uint64_t offset, const Twine &msg); +#else +#define debugWrite(...) (void *)0 +#endif void writeUleb128(raw_ostream &os, uint64_t number, const Twine &msg); diff --git a/lld/wasm/WriterUtils.cpp b/lld/wasm/WriterUtils.cpp --- a/lld/wasm/WriterUtils.cpp +++ b/lld/wasm/WriterUtils.cpp @@ -80,9 +80,11 @@ } namespace wasm { +#ifdef LLVM_DEBUG void debugWrite(uint64_t offset, const Twine &msg) { LLVM_DEBUG(dbgs() << format(" | %08lld: ", offset) << msg << "\n"); } +#endif void writeUleb128(raw_ostream &os, uint64_t number, const Twine &msg) { debugWrite(os.tell(), msg + "[" + utohexstr(number) + "]");