summaryrefslogtreecommitdiff
path: root/test/lld/gdollar_mainmodule.wat
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-04-08 13:59:21 -0700
committerGitHub <noreply@github.com>2020-04-08 13:59:21 -0700
commit2f9d019267bd792e1df09a00648eb4d8edb39ac1 (patch)
tree5542994773bf4d34a53bd938fa8c628cf3c8dd5f /test/lld/gdollar_mainmodule.wat
parent95a66b5b3ad34b47703131207bbab739366408c4 (diff)
downloadbinaryen-2f9d019267bd792e1df09a00648eb4d8edb39ac1.tar.gz
binaryen-2f9d019267bd792e1df09a00648eb4d8edb39ac1.tar.bz2
binaryen-2f9d019267bd792e1df09a00648eb4d8edb39ac1.zip
Avoid g$ in main modules where possible (#2721)
We realized it is not valid to do these f$, g$ optimizations in main and side modules, as a symbol might appear in both (like RTTI or a weak symbol). We do need one of the appearances to "win". This does the g$ optimization in main modules only, that is, if a global appears in a main module then we can avoid a g$ import and instead compute its location directly in the module, since we will "win" over other modules with the same symbol anyhow.
Diffstat (limited to 'test/lld/gdollar_mainmodule.wat')
-rw-r--r--test/lld/gdollar_mainmodule.wat20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lld/gdollar_mainmodule.wat b/test/lld/gdollar_mainmodule.wat
new file mode 100644
index 000000000..2b9a30439
--- /dev/null
+++ b/test/lld/gdollar_mainmodule.wat
@@ -0,0 +1,20 @@
+(module
+ (import "env" "memory" (memory $0 0))
+ (data (global.get $gimport$3) "")
+ (import "env" "__indirect_function_table" (table $timport$1 0 funcref))
+ (import "env" "__stack_pointer" (global $gimport$2 (mut i32)))
+ (import "env" "__memory_base" (global $gimport$3 i32))
+ (import "env" "__table_base" (global $gimport$4 i32))
+ (import "GOT.mem" "someglobal1" (global $gimport$6 (mut i32)))
+ (import "GOT.mem" "someglobal2" (global $gimport$7 (mut i32)))
+ (import "GOT.mem" "someglobal3" (global $gimport$8 (mut i32)))
+ (global $global$1 i32 (i32.const 54))
+ (global $global$2 i32 (i32.const 0))
+ (export "someglobal2" (global $global$1))
+ (export "main" (func $main))
+ (export "__data_end" (global $global$2))
+ (func $main (param $0 i32) (param $1 i32) (result i32)
+ (i32.const 0)
+ )
+)
+