summaryrefslogtreecommitdiff
path: root/test/passes/safe-heap_start-function.wast
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-12-04 10:43:07 -0800
committerGitHub <noreply@github.com>2020-12-04 10:43:07 -0800
commit7f09ac527f59834fd5cca9311cb92ff28aad99d5 (patch)
treed16f5e3f3e66bdd7e17aeeebd7bc766ea64facdf /test/passes/safe-heap_start-function.wast
parentbd9872ddf850bf177298a5274a15807e6227cd3d (diff)
downloadbinaryen-7f09ac527f59834fd5cca9311cb92ff28aad99d5.tar.gz
binaryen-7f09ac527f59834fd5cca9311cb92ff28aad99d5.tar.bz2
binaryen-7f09ac527f59834fd5cca9311cb92ff28aad99d5.zip
Don't apply SafeHeap to wasm start function (#3424)
In relocable code (MAIN/SIDE modules) we use the start function to run `__wasm_init_memory` which loads the data segments into place. We can't call get_sbkr pointer during that function because the sbrk pointer itself lives in static data segment.
Diffstat (limited to 'test/passes/safe-heap_start-function.wast')
-rw-r--r--test/passes/safe-heap_start-function.wast11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/passes/safe-heap_start-function.wast b/test/passes/safe-heap_start-function.wast
new file mode 100644
index 000000000..ddc947f7e
--- /dev/null
+++ b/test/passes/safe-heap_start-function.wast
@@ -0,0 +1,11 @@
+(module
+ (memory 1 1)
+ (func $foo
+ ;; should not be modified because its the start function
+ (i32.store (i32.load (i32.const 1234)) (i32.const 5678))
+ )
+ (func $bar
+ (i32.store (i32.load (i32.const 1234)) (i32.const 5678))
+ )
+ (start $foo)
+)