From e5948a939eb6610f1cb7742df8c54f6d17389b83 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 11 Jan 2024 11:11:15 -0800 Subject: wasm-merge: Sort globals to ensure proper validation (#6221) If the first module has a global that reads from a global that appears in a later module, then we need to reorder the globals, because if we just append the globals from the later module we'd end up with a global reading from another that is not before it. Changes to the existing renamings test are just due to the global sorting pass that now runs (it not only fixes up validation errors but also tries to sort in a more optimal order for size). Fixes #6220 --- test/lit/merge/global-ordering.wat.second | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/lit/merge/global-ordering.wat.second (limited to 'test/lit/merge/global-ordering.wat.second') diff --git a/test/lit/merge/global-ordering.wat.second b/test/lit/merge/global-ordering.wat.second new file mode 100644 index 000000000..7676599e4 --- /dev/null +++ b/test/lit/merge/global-ordering.wat.second @@ -0,0 +1,3 @@ +(module + (global $second.global (export "second.global.export") i32 (i32.const 42)) +) -- cgit v1.2.3