From 3fbae879fc1b678e748ab3f8c24148e1c3818f45 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Thu, 4 Feb 2016 05:18:07 -0800 Subject: Support start As spec'd in: https://github.com/WebAssembly/design/pull/495 And discussed in: https://github.com/WebAssembly/spec/issues/231 This will make it simpler and more uniform to add a start entry point. s2wasm is the right place to add start because it'll eventually need to do other basic setup, e.g. put code in start to setup the stack, as dschuff is doing in: https://github.com/WebAssembly/binaryen/pull/179 Or rather, the linker is the right place and s2wasm happens to act as our linker right now. --- test/dot_s/start_main0.s | 8 ++++++++ test/dot_s/start_main0.wast | 12 ++++++++++++ test/dot_s/start_main2.s | 11 +++++++++++ test/dot_s/start_main2.wast | 20 ++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 test/dot_s/start_main0.s create mode 100644 test/dot_s/start_main0.wast create mode 100644 test/dot_s/start_main2.s create mode 100644 test/dot_s/start_main2.wast (limited to 'test') diff --git a/test/dot_s/start_main0.s b/test/dot_s/start_main0.s new file mode 100644 index 000000000..85323ee62 --- /dev/null +++ b/test/dot_s/start_main0.s @@ -0,0 +1,8 @@ + .text + .file "main0" + .globl main + .type main,@function +main: # @main +# BB#0: +.Lfunc_end0: + .size main, .Lfunc_end0-main diff --git a/test/dot_s/start_main0.wast b/test/dot_s/start_main0.wast new file mode 100644 index 000000000..d40390aee --- /dev/null +++ b/test/dot_s/start_main0.wast @@ -0,0 +1,12 @@ +(module + (memory 0 4294967295) + (start $_start) + (export "main" $main) + (export "_start" $_start) + (func $main + ) + (func $_start + (call $main) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 4 } diff --git a/test/dot_s/start_main2.s b/test/dot_s/start_main2.s new file mode 100644 index 000000000..7f77ec463 --- /dev/null +++ b/test/dot_s/start_main2.s @@ -0,0 +1,11 @@ + .text + .file "main2" + .globl main + .type main,@function +main: # @main + .param i32, i32 + .result i32 +# BB#0: + return $0 +.Lfunc_end0: + .size main, .Lfunc_end0-main diff --git a/test/dot_s/start_main2.wast b/test/dot_s/start_main2.wast new file mode 100644 index 000000000..42e8b4897 --- /dev/null +++ b/test/dot_s/start_main2.wast @@ -0,0 +1,20 @@ +(module + (memory 0 4294967295) + (start $_start) + (export "main" $main) + (export "_start" $_start) + (func $main (param $$0 i32) (param $$1 i32) (result i32) + (return + (get_local $$0) + ) + ) + (func $_start + (local $0 i32) + (local $1 i32) + (call $main + (get_local $0) + (get_local $1) + ) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 4 } -- cgit v1.2.3