1 RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
2 RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
4 RUN: llvm-ar rcs %t.a %t.ret32.o
6 Should not add symbols from the archive by default as they are not required
7 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o %t.a
8 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s
9 NOTADDED: FunctionNames:
10 NOTADDED-NOT: Name: ret32
13 Should add symbols from the archive if --whole-archive is used
14 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive %t.a
15 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=ADDED %s
20 --no-whole-archive should restore default behaviour
21 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive --no-whole-archive %t.a
22 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s
24 --whole-archive and --no-whole-archive should affect only archives which follow them
25 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o %t.a --whole-archive --no-whole-archive
26 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s
27 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive %t.a --no-whole-archive
28 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=ADDED %s
30 --whole-archive should also work with thin archives
32 RUN: llvm-ar --format=gnu rcsT %tthin.a %t.ret32.o
33 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive %tthin.a
34 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=ADDED %s