63 lines · plain
1# RUN: split-file %s %t2# RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/main.o %t/main.s3# RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/liba_x.o %t/liba_x.s4# RUN: llvm-mc -filetype=obj --triple=wasm32-unknown-unknown -o %t/liba_y.o %t/liba_y.s5# RUN: rm -f %t/liba.a6# RUN: llvm-ar rcs %t/liba.a %t/liba_x.o %t/liba_y.o7# RUN: wasm-ld %t/main.o %t/liba.a --gc-sections -o %t/main.wasm --print-gc-sections | FileCheck %s --check-prefix=GC8# RUN: obj2yaml %t/main.wasm | FileCheck %s9 10# --gc-sections should remove non-retained and unused "weathers" section from live object liba_x.o11# 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.o13# GC-NOT: removing unused section %t/main.o:(greetings)14# GC-NOT: removing unused section %t/liba_x.o:(greetings)15 16# Note: All symbols are private so that they don't join the symbol table.17 18#--- main.s19 .functype grab_liba () -> ()20 .globl _start21_start:22 .functype _start () -> ()23 call grab_liba24 end_function25 26 .section greetings,"R",@27 .asciz "hello"28 .section weathers,"R",@29 .asciz "cloudy"30 31#--- liba_x.s32 .globl grab_liba33grab_liba:34 .functype grab_liba () -> ()35 end_function36 37 .section greetings,"R",@38 .asciz "world"39 .section weathers,"",@40 .asciz "rainy"41 42#--- liba_y.s43 .section greetings,"R",@44 .asciz "bye"45 46 47# "greetings" section48# CHECK: - Type: DATA49# CHECK: Segments:50# CHECK: - SectionOffset: 851# CHECK: InitFlags: 052# CHECK: Offset:53# CHECK: Opcode: I32_CONST54# CHECK: Value: 6553655# CHECK: Content: 68656C6C6F00776F726C640056# "weahters" section.57# CHECK: - SectionOffset: 2758# CHECK: InitFlags: 059# CHECK: Offset:60# CHECK: Opcode: I32_CONST61# CHECK: Value: 6554862# CHECK: Content: 636C6F7564790063