1 # RUN: split-file %s %t
2 # RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/main.o %t/main.s
3 # RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/liba_x.o %t/liba_x.s
4 # RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/liba_y.o %t/liba_y.s
6 # RUN: llvm-ar rcs %t/liba.a %t/liba_x.o %t/liba_y.o
7 # RUN: wasm-ld %t/main.o %t/liba.a --gc-sections -o %t/main.wasm --print-gc-sections | FileCheck %s --check-prefix=GC
8 # RUN: obj2yaml %t/main.wasm | FileCheck %s
10 # --gc-sections should remove non-retained and unused "weathers" section from live object liba_x.o
11 # GC: removing unused section {{.*}}/liba.a(liba_x.o):(weathers)
12 # Should not remove retained "greetings" sections from live objects main.o and liba_x.o
13 # GC-NOT: removing unused section %t/main.o:(greetings)
14 # GC-NOT: removing unused section %t/liba_x.o:(greetings)
16 # Note: All symbols are private so that they don't join the symbol table.
19 .functype grab_liba () -> ()
22 .functype _start () -> ()
26 .section greetings,"R",@
28 .section weathers,"R",@
34 .functype grab_liba () -> ()
37 .section greetings,"R",@
39 .section weathers,"",@
43 .section greetings,"R",@
50 # CHECK: - SectionOffset: 7
53 # CHECK: Opcode: I32_CONST
55 # CHECK: Content: 68656C6C6F00776F726C6400
57 # CHECK: - SectionOffset: 25
60 # CHECK: Opcode: I32_CONST
62 # CHECK: Content: 636C6F75647900