Index: test/wasm/undefined-weak-call.ll =================================================================== --- test/wasm/undefined-weak-call.ll +++ test/wasm/undefined-weak-call.ll @@ -1,5 +1,6 @@ ; RUN: llc -filetype=obj %s -o %t.o -; RUN: wasm-ld --check-signatures --no-entry %t.o -o %t.wasm +; RUN: wasm-ld --check-signatures --no-entry --print-gc-sections %t.o \ +; RUN: -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-GC %s ; RUN: obj2yaml %t.wasm | FileCheck %s ; Check that calling an undefined weak function generates an appropriate stub @@ -12,6 +13,8 @@ declare extern_weak void @weakFunc3(i32 %arg) ; different declare extern_weak void @weakFunc4() ; should be GC'd as not called +; CHECK-GC: removing unused section {{.*}}:(undefined function weakFunc4) + define i32 @callWeakFuncs() { call void @weakFunc1() call void @weakFunc2() Index: wasm/MarkLive.cpp =================================================================== --- wasm/MarkLive.cpp +++ wasm/MarkLive.cpp @@ -105,5 +105,8 @@ if (!C->Live) message("removing unused section " + toString(C)); } + for (InputChunk *C : Symtab->SyntheticFunctions) + if (!C->Live) + message("removing unused section " + toString(C)); } }