1; Test that the --stack-first option places the stack at the start of linear
2; memory.  In this case the --stack-first option is being passed along with a
3; stack size of 512.  This means (since the stack grows down) the stack pointer
4; global should be initialized to 512.
5
6RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
7RUN: wasm-ld -z stack-size=512 --stack-first --export=__data_end --export=__heap_base -o %t.wasm %t.o
8RUN: obj2yaml %t.wasm | FileCheck %s
9
10CHECK:        - Type:            GLOBAL
11CHECK-NEXT:     Globals:
12CHECK-NEXT:       - Index:           0
13CHECK-NEXT:         Type:            I32
14CHECK-NEXT:         Mutable:         true
15CHECK-NEXT:         InitExpr:
16CHECK-NEXT:           Opcode:          I32_CONST
17CHECK-NEXT:           Value:           512
18CHECK-NEXT:       - Index:           1
19CHECK-NEXT:         Type:            I32
20CHECK-NEXT:         Mutable:         false
21CHECK-NEXT:         InitExpr:
22CHECK-NEXT:           Opcode:          I32_CONST
23CHECK-NEXT:           Value:           512
24CHECK-NEXT:       - Index:           2
25CHECK-NEXT:         Type:            I32
26CHECK-NEXT:         Mutable:         false
27CHECK-NEXT:         InitExpr:
28CHECK-NEXT:           Opcode:          I32_CONST
29CHECK-NEXT:           Value:           512
30CHECK-NEXT:   - Type:            EXPORT
31CHECK-NEXT:     Exports:
32CHECK-NEXT:       - Name:            memory
33CHECK-NEXT:         Kind:            MEMORY
34CHECK-NEXT:         Index:           0
35CHECK-NEXT:       - Name:            _start
36CHECK-NEXT:         Kind:            FUNCTION
37CHECK-NEXT:         Index:           0
38CHECK-NEXT:       - Name:            __data_end
39CHECK-NEXT:         Kind:            GLOBAL
40CHECK-NEXT:         Index:           1
41CHECK-NEXT:       - Name:            __heap_base
42CHECK-NEXT:         Kind:            GLOBAL
43CHECK-NEXT:         Index:           2
44