summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/test/wasm/gc-sections.ll8
-rw-r--r--lld/wasm/InputChunks.cpp4
-rw-r--r--lld/wasm/InputChunks.h2
-rw-r--r--lld/wasm/MarkLive.cpp12
4 files changed, 14 insertions, 12 deletions
diff --git a/lld/test/wasm/gc-sections.ll b/lld/test/wasm/gc-sections.ll
index aaf2cda2ca2..0801767d617 100644
--- a/lld/test/wasm/gc-sections.ll
+++ b/lld/test/wasm/gc-sections.ll
@@ -1,9 +1,9 @@
; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -print-gc-sections -o %t1.wasm %t.o | FileCheck %s -check-prefix=PRINT-GC
-; PRINT-GC: removing unused section 'unused_function' in file '{{.*}}'
-; PRINT-GC-NOT: removing unused section 'used_function' in file '{{.*}}'
-; PRINT-GC: removing unused section '.data.unused_data' in file '{{.*}}'
-; PRINT-GC-NOT: removing unused section '.data.used_data' in file '{{.*}}'
+; PRINT-GC: removing unused section {{.*}}:(unused_function)
+; PRINT-GC-NOT: removing unused section {{.*}}:(used_function)
+; PRINT-GC: removing unused section {{.*}}:(.data.unused_data)
+; PRINT-GC-NOT: removing unused section {{.*}}:(.data.used_data)
target triple = "wasm32-unknown-unknown-wasm"
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 1d5f7336b28..e4ea0d2de78 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -22,6 +22,10 @@ using namespace llvm::support::endian;
using namespace lld;
using namespace lld::wasm;
+std::string lld::toString(const InputChunk *C) {
+ return (toString(C->File) + ":(" + C->getName() + ")").str();
+}
+
uint32_t InputSegment::translateVA(uint32_t Address) const {
assert(Address >= startVA() && Address < endVA());
int32_t Delta = OutputSeg->StartVA + OutputSegmentOffset - startVA();
diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h
index e9d86f0e52b..388e3b98057 100644
--- a/lld/wasm/InputChunks.h
+++ b/lld/wasm/InputChunks.h
@@ -174,6 +174,8 @@ protected:
};
} // namespace wasm
+
+std::string toString(const wasm::InputChunk *);
} // namespace lld
#endif // LLD_WASM_INPUT_CHUNKS_H
diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index 1a3372ef1f1..bba1b9d8b35 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -91,17 +91,13 @@ void lld::wasm::markLive() {
// Report garbage-collected sections.
if (Config->PrintGcSections) {
- auto CheckChunk = [](const InputChunk *C) {
- if (!C->Live)
- message("removing unused section '" + C->getName() + "' in file '" +
- C->File->getName() + "'");
- };
-
for (const ObjFile *Obj : Symtab->ObjectFiles) {
for (InputChunk *C : Obj->Functions)
- CheckChunk(C);
+ if (!C->Live)
+ message("removing unused section " + toString(C));
for (InputChunk *C : Obj->Segments)
- CheckChunk(C);
+ if (!C->Live)
+ message("removing unused section " + toString(C));
}
}
}
OpenPOWER on IntegriCloud