xref: /llvm-project/lld/test/wasm/export-optional-lazy.test (revision fd1c894a4a3690b2e500bfdf71194e9cc3f1b399)
1Optional linker-synthetic symbols are only created if they are undefined
2in the final output.
3This test is for a regression where an explicit --export of an lazy archive
4symbol caused an undefined reference to an optional symbol to occur *after*
5the optional symbols were created.
6
7RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
8RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/optional-symbol.s -o %t.a1.o
9RUN: rm -f %t.a
10RUN: llvm-ar rcs %t.a %t.a1.o
11RUN: wasm-ld --export=get_optional %t.o %t.a -o %t.wasm
12RUN: obj2yaml %t.wasm | FileCheck %s
13
14CHECK:      FunctionNames:
15CHECK-NEXT:   - Index:           0
16CHECK-NEXT:     Name:            _start
17CHECK-NEXT:   - Index:           1
18CHECK-NEXT:     Name:            get_optional
19