1 ; RUN: llc -filetype=obj -o %t.o %s
2 ; RUN: llc -filetype=obj %p/Inputs/explicit-section.ll -o %t2.o
3 ; RUN: wasm-ld --export=get_start --export=get_end --export=foo --export=var1 %t.o %t2.o -o %t.wasm
4 ; RUN: obj2yaml %t.wasm | FileCheck %s
5 ; RUN: llvm-objdump -d --no-show-raw-insn %t.wasm | FileCheck %s --check-prefix=ASM
7 target triple = "wasm32-unknown-unknown"
9 @foo = global i32 3, section "mysection", align 4
10 @bar = global i32 4, section "mysection", align 4
12 @__start_mysection = external global ptr
13 @__stop_mysection = external global ptr
15 define ptr @get_start() {
16 ret ptr @__start_mysection
19 define ptr @get_end() {
20 ret ptr @__stop_mysection
23 define void @_start() {
29 ; CHECK-NEXT: Segments:
30 ; CHECK-NEXT: - SectionOffset: 7
31 ; CHECK-NEXT: InitFlags: 0
33 ; CHECK-NEXT: Opcode: I32_CONST
34 ; CHECK-NEXT: Value: 1024
35 ; CHECK-NEXT: Content: 03000000040000002A0000002B000000
37 ; ASM: 00000001 <get_start>:
39 ; ASM-NEXT: 3: i32.const 1024
42 ; ASM: 0000000a <get_end>:
44 ; ASM-NEXT: c: i32.const 1040