summaryrefslogtreecommitdiff
path: root/test/lld/recursive.c
diff options
context:
space:
mode:
authorJacob Gravelle <jgravelle@google.com>2018-01-22 12:50:36 -0800
committerGitHub <noreply@github.com>2018-01-22 12:50:36 -0800
commit02729a12e1735f629d3066b51c96a056f712b080 (patch)
tree353a495836776695d0f86f08b6292635c4dba101 /test/lld/recursive.c
parentb01f2bb237e086fe4ae852c6004297fa8f8b39c2 (diff)
downloadbinaryen-02729a12e1735f629d3066b51c96a056f712b080.tar.gz
binaryen-02729a12e1735f629d3066b51c96a056f712b080.tar.bz2
binaryen-02729a12e1735f629d3066b51c96a056f712b080.zip
First pass at LLD support for Emscripten (#1346)
* Skeleton of a beginning of o2wasm, WIP and probably not going to be used * Get building post-cherry-pick * ast->ir, remove commented out code, include a debug module print because linking * Read linking section, print emscripten metadata json * WasmBinaryWriter emits user sections on Module * Remove debugging prints, everything that isn't needed to build metadata * Rename o2wasm to lld-metadata * lld-metadata support for outputting to file * Use tables index instead of function index for initializer functions * Add lld-emscripten tool to add emscripten-runtime functions to wasm modules (built with lld) * Handle EM_ASM in lld-emscripten * Add a list of functions to forcibly export (for initializer functions) * Disable incorrect initializer function reading * Add error printing when parsing .o files in lld-metadata * Remove ';; METADATA: ' prefix from lld-metadata, output is now standalone json * Support em_asm consts that aren't at the start of a segment * Initial test framework for lld-metadata tool * Add em_asm test * Add support for WASM_INIT_FUNCS in the linking section * Remove reloc section parsing because it's unused * lld-emscripten can read and write text * Add test harness for lld-emscripten * Export all functions for now * Add missing lld test output * Add support for reading object files differently Only difference so far is in importing mutable globals being an object file representation for symbols, but invalid wasm. * Update help strings * Update linking tests for stackAlloc fix * Rename lld-emscripten,lld-metadata to wasm-emscripten-finalize,wasm-link-metadata * Add help text to header comments * auto& instead of auto & * Extract LinkType to abi/wasm-object.h * Remove special handling for wasm object file reading, allow mutable globals * Add braces around default switch case * Fix flake8 errors * Handle generating dyncall thunks for imports as well * Use explicit bool for stackPointerGlobal * Use glob patterns for lld file iteration * Use __wasm_call_ctors for all initializer functions
Diffstat (limited to 'test/lld/recursive.c')
-rw-r--r--test/lld/recursive.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lld/recursive.c b/test/lld/recursive.c
new file mode 100644
index 000000000..c0cdaa425
--- /dev/null
+++ b/test/lld/recursive.c
@@ -0,0 +1,15 @@
+// This test emits a stack pointer, which tests global importing in object files
+// (which are mutable and not normally allowed).
+
+int printf(const char* fmt, ...);
+
+__attribute__((noinline))
+int foo(int a, int b) {
+ printf("%d:%d\n", a, b);
+ return a + b;
+}
+
+int main() {
+ printf("Result: %d\n", foo(1, 2));
+ return 0;
+}