Skip to content

Commit

Permalink
feat: Update binaryen to version_104 (#42)
Browse files Browse the repository at this point in the history
chore: Update `flags` for dwarf & compact unwind
chore: Update README to mention additional flags on MacOS
  • Loading branch information
phated committed Feb 7, 2022
1 parent 618bf91 commit 2000604
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
24 changes: 24 additions & 0 deletions README.md
Expand Up @@ -45,6 +45,30 @@ Your stanza could look something like this:

These flags likely won't work on other operating systems, so you'll probably need to use `dune-configurator` to vary the flags per platform. You can see an example of this in our [tests/](./tests/dune).

## MacOS DWARF & Compact unwind

When including this library in your `dune` MacOS executables, you might want to specify `-cclib -Wl,-keep_dwarf_unwind -cclib -Wl,-no_compact_unwind` in your `(flags)` stanza. If you don't include them, you'll probably see warnings like:

```log
ld: warning: could not create compact unwind for _caml_start_program: dwarf uses DW_CFA_same_value
ld: warning: could not create compact unwind for _caml_raise_exn: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _caml_raise_exception: stack subq instruction is too different from dwarf stack size
```

Your stanza could look something like this:

```diff
(executable
(name example)
(public_name example)
(package example)
+ (flags -cclib -Wl,-keep_dwarf_unwind -cclib -Wl,-no_compact_unwind)
(modules example)
(libraries binaryen))
```

These flags likely won't work on other operating systems, so you'll probably need to use `dune-configurator` to vary the flags per platform. You can see an example of this in our [test/](./test/dune).

## Static Linking

If you are planning to create portable binaries for Windows, it will try to find Cygwin/MinGW locations in your `PATH`. To avoid this, you probably want to add this to your `(executable)` stanzas:
Expand Down
2 changes: 1 addition & 1 deletion binaryen
Submodule binaryen updated 44 files
+2 −2 .github/workflows/create_release.yml
+5 −0 CHANGELOG.md
+1 −1 CMakeLists.txt
+1 −0 src/ir/CMakeLists.txt
+40 −32 src/ir/effects.h
+99 −0 src/ir/lubs.cpp
+13 −0 src/ir/lubs.h
+1 −1 src/ir/properties.h
+1 −1 src/passes/CodeFolding.cpp
+11 −83 src/passes/DeadArgumentElimination.cpp
+1 −1 src/passes/LoopInvariantCodeMotion.cpp
+100 −13 src/passes/OptimizeInstructions.cpp
+0 −9 src/passes/Precompute.cpp
+70 −17 src/passes/SignatureRefining.cpp
+121 −41 src/passes/SimplifyGlobals.cpp
+1 −1 src/passes/SimplifyLocals.cpp
+1 −1 src/passes/Vacuum.cpp
+28 −24 src/tools/execution-results.h
+53 −0 src/tools/wasm-fuzz-types.cpp
+3 −0 src/wasm-type.h
+7 −7 src/wasm/wasm-binary.cpp
+243 −266 src/wasm/wasm-type.cpp
+7 −2 src/wasm2js.h
+0 −1 test/example/cpp-unit.cpp
+17 −2 test/exception-handling.wast
+16 −2 test/exception-handling.wast.from-wast
+19 −3 test/exception-handling.wast.fromBinary
+17 −1 test/exception-handling.wast.fromBinary.noDebugInfo
+6 −0 test/lit/binary/bad-ref-as.test
+ test/lit/binary/bad-ref-as.test.wasm
+64 −0 test/lit/exec/eh.wast
+14 −1 test/lit/passes/Oz.wast
+0 −0 test/lit/passes/catch-pop-fixup-eh.wast
+122 −10 test/lit/passes/code-pushing-eh.wast
+117 −0 test/lit/passes/optimize-instructions.wast
+134 −0 test/lit/passes/signature-refining.wast
+458 −40 test/lit/passes/simplify-globals-read_only_to_write.wast
+51 −0 test/lit/passes/vacuum-eh.wast
+4 −0 test/passes/fuzz-exec_all-features.txt
+6 −0 test/passes/optimize-instructions_fuzz-exec.txt
+3 −12 test/passes/precompute_all-features.txt
+1 −8 test/passes/precompute_all-features.wast
+7 −2 test/wasm2js/atomics_32.2asm.js
+7 −2 test/wasm2js/atomics_32.2asm.js.opt
9 changes: 8 additions & 1 deletion test/config/flags.ml
Expand Up @@ -8,7 +8,14 @@ let () =
match C.ocaml_config_var c "system" with
| Some "macosx" ->
(* These flags preserve the original C++ error behavior. Ref https://github.com/ocaml/ocaml/issues/10423 *)
[ "-cc"; "clang++" ]
[
"-cc";
"clang++";
"-cclib";
"-Wl,-keep_dwarf_unwind";
"-cclib";
"-Wl,-no_compact_unwind";
]
| Some _ -> default
| None -> default
in
Expand Down

0 comments on commit 2000604

Please sign in to comment.