[lld] [lld][WebAssembly] Preserve LTO stub deps for bitcode symbols (PR #173235)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 22 14:33:03 PST 2025
================
@@ -0,0 +1,33 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/stub-dependency-main.s -o %t.o
+; RUN: echo "#STUB" > %t.so
+; RUN: echo "A: B" >> %t.so
+; RUN: wasm-ld %t.o %t.bc %t.so -o %t.wasm
+; RUN: obj2yaml %t.wasm | FileCheck %s
+
+; Test if LTO stub dependencies are preserved if a symbol they depend on is
+; defined in bitcode and DCE'd and become undefined in the LTO process. Here 'B'
+; should be preserved and exported.
+
+target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
+target triple = "wasm32-unknown-unknown"
+
+define void @A() {
+ ret void
+}
+
+define void @B() {
+ ret void
+}
+
+; CHECK: - Type: EXPORT
+; CHECK-NEXT: Exports:
+; CHECK-NEXT: - Name: memory
+; CHECK-NEXT: Kind: MEMORY
+; CHECK-NEXT: Index: 0
+; CHECK-NEXT: - Name: _start
+; CHECK-NEXT: Kind: FUNCTION
+; CHECK-NEXT: Index: 0
+; CHECK-NEXT: - Name: B
+; CHECK-NEXT: Kind: FUNCTION
+; CHECK-NEXT: Index: 1
----------------
aheejin wrote:
Removed the new test and merged it into `stub-library.s`: https://github.com/llvm/llvm-project/pull/173235/commits/414e7a4f2dfe060143fd0dc660cc2a829108ee4b
https://github.com/llvm/llvm-project/pull/173235
More information about the llvm-commits
mailing list