81 lines · plain
1; Test that the --stack-first option places the stack at the start of linear2; memory. In this case the --stack-first option is being passed along with a3; stack size of 512. This means (since the stack grows down) the stack pointer4; global should be initialized to 512.5; Also test that __heap_base is still aligned with the --stack-first option.6 7RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/stack-first.s -o %t.o8 9; Check that the default is `--stack-first`10RUN: wasm-ld -z stack-size=512 --export=__data_end --export=__heap_base --export=someByte -o %t.wasm %t.o11RUN: obj2yaml %t.wasm | FileCheck %s12 13; Check `--no-stack-first`14RUN: wasm-ld -z stack-size=512 --no-stack-first --export=__data_end --export=__heap_base --export=someByte -o %t.wasm %t.o15RUN: obj2yaml %t.wasm | FileCheck %s --check-prefix=NOT-FIRST16 17; Check `--stack-first`18RUN: wasm-ld -z stack-size=512 --no-stack-first --stack-first --export=__data_end --export=__heap_base --export=someByte -o %t.wasm %t.o19RUN: obj2yaml %t.wasm | FileCheck %s20 21 22CHECK: - Type: GLOBAL23CHECK-NEXT: Globals: 24CHECK-NEXT: - Index: 025CHECK-NEXT: Type: I3226CHECK-NEXT: Mutable: true27CHECK-NEXT: InitExpr: 28CHECK-NEXT: Opcode: I32_CONST29CHECK-NEXT: Value: 51230CHECK-NEXT: - Index: 131CHECK-NEXT: Type: I3232CHECK-NEXT: Mutable: false33CHECK-NEXT: InitExpr: 34CHECK-NEXT: Opcode: I32_CONST35CHECK-NEXT: Value: 51236CHECK-NEXT: - Index: 237CHECK-NEXT: Type: I3238CHECK-NEXT: Mutable: false39CHECK-NEXT: InitExpr: 40CHECK-NEXT: Opcode: I32_CONST41CHECK-NEXT: Value: 51342CHECK-NEXT: - Index: 343CHECK-NEXT: Type: I3244CHECK-NEXT: Mutable: false45CHECK-NEXT: InitExpr: 46CHECK-NEXT: Opcode: I32_CONST47CHECK-NEXT: Value: 52848CHECK-NEXT: - Type: EXPORT49CHECK-NEXT: Exports: 50CHECK-NEXT: - Name: memory51CHECK-NEXT: Kind: MEMORY52CHECK-NEXT: Index: 053CHECK-NEXT: - Name: _start54CHECK-NEXT: Kind: FUNCTION55CHECK-NEXT: Index: 056CHECK-NEXT: - Name: someByte57CHECK-NEXT: Kind: GLOBAL58CHECK-NEXT: Index: 159CHECK-NEXT: - Name: __data_end60CHECK-NEXT: Kind: GLOBAL61CHECK-NEXT: Index: 262CHECK-NEXT: - Name: __heap_base63CHECK-NEXT: Kind: GLOBAL64CHECK-NEXT: Index: 365 66NOT-FIRST: - Type: GLOBAL67NOT-FIRST-NEXT: Globals:68NOT-FIRST-NEXT: - Index: 069NOT-FIRST-NEXT: Type: I3270NOT-FIRST-NEXT: Mutable: true71NOT-FIRST-NEXT: InitExpr:72NOT-FIRST-NEXT: Opcode: I32_CONST73NOT-FIRST-NEXT: Value: 155274NOT-FIRST-NEXT: - Index: 175NOT-FIRST-NEXT: Type: I3276NOT-FIRST-NEXT: Mutable: false77NOT-FIRST-NEXT: InitExpr:78NOT-FIRST-NEXT: Opcode: I32_CONST79NOT-FIRST-NEXT: Value: 102480 81