Replies: 1 comment 2 replies
-
IIUC you would like -O0/-O1 builds to also error on addresses < 1024? The problem is that whether that range of addresses is valid or not depends on |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This example does not throw exception when using -sSAFE_HEAP because &(p->b) 's address is not zero.
I found that there's a better check when using --low-memory-unused.
https://github.com/WebAssembly/binaryen/blob/b3775b5e4e150439276ad3d34f1bb564b28e8ef5/src/passes/SafeHeap.cpp#L397
It checks address < 1024 instead of = 0 when using GLOBAL_BASE >= 1024.
But for now emcc.py checks if optimizing level >= 2 before passing --low-memory-unused, so -O2 -sSAFE_HEAP -sGLOBAL_BASE=1024 can work on this case but -O0 can't.
https://github.com/emscripten-core/emscripten/blob/e0bd10a0b61e08d1ed30966b6d8351ea06376fd4/tools/link.py#L349
I wonder if it is better to simply remove this check?
Beta Was this translation helpful? Give feedback.
All reactions