diff options
author | Derek Schuff <dschuff@chromium.org> | 2016-06-03 15:48:53 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2016-06-03 15:48:53 -0700 |
commit | c8ec0cd6c053f9e68daf4ba4fdf8137957c1b236 (patch) | |
tree | 559bec6bc2bdc73ea654668b6767a5e0e57ba469 /test | |
parent | f6b5c1e5c1c0de26fd078d336782508dd0186820 (diff) | |
download | binaryen-c8ec0cd6c053f9e68daf4ba4fdf8137957c1b236.tar.gz binaryen-c8ec0cd6c053f9e68daf4ba4fdf8137957c1b236.tar.bz2 binaryen-c8ec0cd6c053f9e68daf4ba4fdf8137957c1b236.zip |
Do not generate duplicate import thunks at link time. (#569)
Previously every address-take of an import would cause a new thunk to be
generated. Now check in getImportThunk if the thunk exists already and
just return it if so.
Diffstat (limited to 'test')
-rw-r--r-- | test/dot_s/indirect-import.c | 6 | ||||
-rw-r--r-- | test/dot_s/indirect-import.s | 14 | ||||
-rw-r--r-- | test/dot_s/indirect-import.wast | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/test/dot_s/indirect-import.c b/test/dot_s/indirect-import.c index 006424d84..679d862c7 100644 --- a/test/dot_s/indirect-import.c +++ b/test/dot_s/indirect-import.c @@ -23,5 +23,9 @@ intptr_t bar() { ijidf(1LL, 2, 3.0, 4.0f); void (*vs)(struct big) = &extern_struct; struct big (*s)(void) = &extern_sret; - return (intptr_t)fd; + return (intptr_t)fd; +} + +intptr_t baz() { + return (intptr_t)extern_v; } diff --git a/test/dot_s/indirect-import.s b/test/dot_s/indirect-import.s index 5131d86f3..f09291d84 100644 --- a/test/dot_s/indirect-import.s +++ b/test/dot_s/indirect-import.s @@ -45,8 +45,20 @@ bar: # @bar .Lfunc_end0: .size bar, .Lfunc_end0-bar + .hidden baz + .globl baz + .type baz,@function +baz: # @baz + .result i32 +# BB#0: # %entry + i32.const $push0=, extern_v@FUNCTION + # fallthrough-return: $pop0 + .endfunc +.Lfunc_end1: + .size baz, .Lfunc_end1-baz + - .ident "clang version 3.9.0 (trunk 271427) (llvm/trunk 271429)" + .ident "clang version 3.9.0 (trunk 271579) (llvm/trunk 271699)" .functype extern_fd, f32, f64 .functype extern_vj, void, i64 .functype extern_v, void diff --git a/test/dot_s/indirect-import.wast b/test/dot_s/indirect-import.wast index f3a989461..b24b5cd59 100644 --- a/test/dot_s/indirect-import.wast +++ b/test/dot_s/indirect-import.wast @@ -13,6 +13,7 @@ (import $extern_struct "env" "extern_struct" (param i32)) (import $extern_sret "env" "extern_sret" (param i32)) (export "bar" $bar) + (export "baz" $baz) (export "dynCall_fd" $dynCall_fd) (export "dynCall_vj" $dynCall_vj) (export "dynCall_v" $dynCall_v) @@ -80,6 +81,9 @@ ) (get_local $1) ) + (func $baz (result i32) + (i32.const 2) + ) (func $__importThunk_extern_fd (type $FUNCSIG$fd) (param $0 f64) (result f32) (call_import $extern_fd (get_local $0) |