forked from OSchip/llvm-project
[lld][WebAssembly] Cleanup output of --verbose
Remove some unnecessary logging from wasm-ld when running under `--verbose`. Unlike `-debug` this logging is available in release builds. This change makes it little more minimal/readable. Also, avoid compiling the `debugWrite` function in releaase builds where it does nothing. This should remove a lot debug strings from the binary, and avoid having to construct unused debug strings at runtime. Differential Revision: https://reviews.llvm.org/D109583
This commit is contained in:
parent
d727bd6962
commit
3a7bcba34b
|
@ -88,15 +88,6 @@ InputFile *createObjectFile(MemoryBufferRef mb, StringRef archiveName) {
|
|||
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).
|
||||
|
|
|
@ -116,8 +116,6 @@ public:
|
|||
// 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;
|
||||
|
|
|
@ -101,8 +101,8 @@ void CodeSection::finalizeContents() {
|
|||
}
|
||||
|
||||
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::finalizeContents() {
|
|||
}
|
||||
|
||||
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::finalizeContents() {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -33,10 +33,7 @@ public:
|
|||
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;
|
||||
|
|
|
@ -1513,8 +1513,6 @@ void Writer::run() {
|
|||
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();
|
||||
|
|
|
@ -80,9 +80,11 @@ std::string toString(const WasmTableType &type) {
|
|||
}
|
||||
|
||||
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) + "]");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue