diff --git a/scripts/test/lld.py b/scripts/test/lld.py index 4f1bbc0eec6..91c7e57d671 100644 --- a/scripts/test/lld.py +++ b/scripts/test/lld.py @@ -18,7 +18,7 @@ def args_for_finalize(filename): - ret = ['--global-base=568'] + ret = [] if 'safe_stack' in filename: ret += ['--check-stack-overflow'] if 'shared' in filename: @@ -30,38 +30,19 @@ def args_for_finalize(filename): def run_test(input_path): print('..', input_path) - is_passive = '.passive.' in input_path - mem_file = input_path + '.mem' - extension_arg_map = { - '.out': [], - } - if not is_passive: - extension_arg_map.update({ - '.mem.out': ['--separate-data-segments', mem_file], - }) - for ext, args in extension_arg_map.items(): - expected_file = input_path + ext - if not os.path.exists(expected_file): - if ext == '.out': - shared.fail_with_error('output ' + expected_file + - ' does not exist') - else: - continue - - cmd = shared.WASM_EMSCRIPTEN_FINALIZE + args - if '64' in input_path: - cmd += ['--enable-memory64', '--bigint'] - cmd += [input_path, '-S'] - cmd += args_for_finalize(os.path.basename(input_path)) - actual = support.run_command(cmd) + expected_file = input_path + '.out' + if not os.path.exists(expected_file): + shared.fail_with_error('output ' + expected_file + + ' does not exist') - shared.fail_if_not_identical_to_file(actual, expected_file) + cmd = list(shared.WASM_EMSCRIPTEN_FINALIZE) + if '64' in input_path: + cmd += ['--enable-memory64', '--bigint'] + cmd += [input_path, '-S'] + cmd += args_for_finalize(os.path.basename(input_path)) + actual = support.run_command(cmd) - if ext == '.mem.out': - with open(mem_file) as mf: - mem = mf.read() - shared.fail_if_not_identical_to_file(mem, input_path + '.mem.mem') - os.remove(mem_file) + shared.fail_if_not_identical_to_file(actual, expected_file) def test_wasm_emscripten_finalize(): @@ -76,15 +57,9 @@ def update_lld_tests(): for input_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat', '.wasm']): print('..', input_path) - is_passive = '.passive.' in input_path - mem_file = input_path + '.mem' extension_arg_map = { '.out': [], } - if not is_passive: - extension_arg_map.update({ - '.mem.out': ['--separate-data-segments', mem_file + '.mem'], - }) for ext, ext_args in extension_arg_map.items(): out_path = input_path + ext if ext != '.out' and not os.path.exists(out_path): diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp index 5ec4d245efd..39b9e8e3af5 100644 --- a/src/tools/wasm-emscripten-finalize.cpp +++ b/src/tools/wasm-emscripten-finalize.cpp @@ -37,14 +37,11 @@ using namespace wasm; int main(int argc, const char* argv[]) { - const uint64_t INVALID_BASE = -1; - std::string infile; std::string outfile; std::string inputSourceMapFilename; std::string outputSourceMapFilename; std::string outputSourceMapUrl; - std::string dataSegmentFile; bool emitBinary = true; bool debugInfo = false; bool DWARF = false; @@ -52,7 +49,6 @@ int main(int argc, const char* argv[]) { bool legalizeJavaScriptFFI = true; bool bigInt = false; bool checkStackOverflow = false; - uint64_t globalBase = INVALID_BASE; bool standaloneWasm = false; // TODO: remove after https://github.com/WebAssembly/binaryen/issues/3043 bool minimizeWasmChanges = false; @@ -93,14 +89,6 @@ int main(int argc, const char* argv[]) { WasmEmscriptenFinalizeOption, Options::Arguments::Zero, [&emitBinary](Options*, const std::string&) { emitBinary = false; }) - .add("--global-base", - "", - "The address at which static globals were placed", - WasmEmscriptenFinalizeOption, - Options::Arguments::One, - [&globalBase](Options*, const std::string& argument) { - globalBase = std::stoull(argument); - }) .add("--side-module", "", "Input is an emscripten side module", @@ -150,14 +138,6 @@ int main(int argc, const char* argv[]) { [&outputSourceMapUrl](Options* o, const std::string& argument) { outputSourceMapUrl = argument; }) - .add("--separate-data-segments", - "", - "Separate data segments to a file", - WasmEmscriptenFinalizeOption, - Options::Arguments::One, - [&dataSegmentFile](Options* o, const std::string& argument) { - dataSegmentFile = argument; - }) .add("--check-stack-overflow", "", "Check for stack overflows every time the stack is extended", @@ -294,14 +274,6 @@ int main(int argc, const char* argv[]) { passRunner.add("strip-dwarf"); } - // Finally, separate out data segments if relevant - if (!dataSegmentFile.empty()) { - passRunner.options.arguments["separate-data-segments"] = dataSegmentFile; - passRunner.options.arguments["separate-data-segments-global-base"] = - std::to_string(globalBase); - passRunner.add("separate-data-segments"); - } - passRunner.run(); BYN_TRACE_WITH_TYPE("emscripten-dump", "Module after:\n"); diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index 9b391312986..8666c2ea122 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -20,9 +20,6 @@ ;; CHECK-NEXT: output file. In this mode if no output ;; CHECK-NEXT: file is specified, we write to stdout. ;; CHECK-NEXT: -;; CHECK-NEXT: --global-base The address at which static globals were -;; CHECK-NEXT: placed -;; CHECK-NEXT: ;; CHECK-NEXT: --side-module Input is an emscripten side module ;; CHECK-NEXT: ;; CHECK-NEXT: --input-source-map,-ism Consume source map from the specified @@ -42,8 +39,6 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --output-source-map-url,-osu Emit specified string as source map URL ;; CHECK-NEXT: -;; CHECK-NEXT: --separate-data-segments Separate data segments to a file -;; CHECK-NEXT: ;; CHECK-NEXT: --check-stack-overflow Check for stack overflows every time the ;; CHECK-NEXT: stack is extended ;; CHECK-NEXT: diff --git a/test/lld/em_asm.wat.mem.mem b/test/lld/em_asm.wat.mem.mem deleted file mode 100644 index bc55b64528b..00000000000 Binary files a/test/lld/em_asm.wat.mem.mem and /dev/null differ diff --git a/test/lld/em_asm.wat.mem.out b/test/lld/em_asm.wat.mem.out deleted file mode 100644 index 6647b397cf9..00000000000 --- a/test/lld/em_asm.wat.mem.out +++ /dev/null @@ -1,68 +0,0 @@ -(module - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) - (global $__stack_pointer (mut i32) (i32.const 66208)) - (global $global$1 i32 (i32.const 574)) - (global $global$2 i32 (i32.const 665)) - (memory $0 2) - (table $0 1 1 funcref) - (export "memory" (memory $0)) - (export "__wasm_call_ctors" (func $__wasm_call_ctors)) - (export "main" (func $main)) - (func $__wasm_call_ctors - (nop) - ) - (func $__original_main (result i32) - (local $0 i32) - (global.set $__stack_pointer - (local.tee $0 - (i32.sub - (global.get $__stack_pointer) - (i32.const 32) - ) - ) - ) - (drop - (call $emscripten_asm_const_int - (i32.const 574) - (i32.const 568) - (i32.const 0) - ) - ) - (i64.store offset=16 - (local.get $0) - (i64.const 115964117005) - ) - (i32.store - (local.get $0) - (call $emscripten_asm_const_int - (i32.const 614) - (i32.const 569) - (i32.add - (local.get $0) - (i32.const 16) - ) - ) - ) - (drop - (call $emscripten_asm_const_int - (i32.const 634) - (i32.const 572) - (local.get $0) - ) - ) - (global.set $__stack_pointer - (i32.add - (local.get $0) - (i32.const 32) - ) - ) - (i32.const 0) - ) - (func $main (param $0 i32) (param $1 i32) (result i32) - (call $__original_main) - ) -) diff --git a/test/lld/hello_world.wat.mem.mem b/test/lld/hello_world.wat.mem.mem deleted file mode 100644 index 2bc1f1ee661..00000000000 Binary files a/test/lld/hello_world.wat.mem.mem and /dev/null differ diff --git a/test/lld/hello_world.wat.mem.out b/test/lld/hello_world.wat.mem.out deleted file mode 100644 index c482a7465ae..00000000000 --- a/test/lld/hello_world.wat.mem.out +++ /dev/null @@ -1,27 +0,0 @@ -(module - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (import "env" "puts" (func $puts (param i32) (result i32))) - (global $__stack_pointer (mut i32) (i32.const 66128)) - (memory $0 2) - (table $0 1 1 funcref) - (export "memory" (memory $0)) - (export "__wasm_call_ctors" (func $__wasm_call_ctors)) - (export "main" (func $main)) - (func $__wasm_call_ctors - (nop) - ) - (func $__original_main (result i32) - (drop - (call $puts - (i32.const 568) - ) - ) - (i32.const 0) - ) - (func $main (param $0 i32) (param $1 i32) (result i32) - (call $__original_main) - ) -) diff --git a/test/unit/test_finalize.py b/test/unit/test_finalize.py index 4f5029bd58c..6b173f6c625 100644 --- a/test/unit/test_finalize.py +++ b/test/unit/test_finalize.py @@ -6,7 +6,7 @@ class EmscriptenFinalizeTest(utils.BinaryenTestCase): def do_output_test(self, args): # without any output file specified, don't error, don't write the wasm p = shared.run_process(shared.WASM_EMSCRIPTEN_FINALIZE + [ - self.input_path('empty_lld.wat'), '--global-base=1024' + self.input_path('empty_lld.wat') ] + args, capture_output=True) return p.stdout