From 4c672fb0d26fff4dfbf0eeaa091495893f7efb44 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Thu, 15 Aug 2024 19:58:42 +0800 Subject: [PATCH] runtest.py: Normallize option handling for XIP mode --- .../spec-test-script/runtest.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/wamr-test-suites/spec-test-script/runtest.py b/tests/wamr-test-suites/spec-test-script/runtest.py index 2680243235..011578fce1 100755 --- a/tests/wamr-test-suites/spec-test-script/runtest.py +++ b/tests/wamr-test-suites/spec-test-script/runtest.py @@ -62,6 +62,12 @@ "xtensa": ["--target=xtensa"], } +# AOT compilation options mapping for XIP mode +aot_target_options_map_xip = { + # avoid l32r relocations for xtensa + "xtensa": ["--mllvm=-mtext-section-literals"] +} + def debug(data): if debug_file: debug_file.write(data) @@ -1122,10 +1128,8 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r, output = ' if opts.xip: cmd.append("--xip") - - # avoid l32r relocations for xtensa - if opts.target == "xtensa": - cmd.append("--mllvm=-mtext-section-literals") + if test_target in aot_target_options_map_xip: + cmd += aot_target_options_map_xip[test_target] if opts.multi_thread: cmd.append("--enable-multi-thread") @@ -1308,8 +1312,8 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile, if test_aot: aot_tempfile = create_tmp_file(".aot") # could be potientially compiled to aot - # with the future following call test_assert_xxx, - # add them to temp_file_repo now even if no actual following file, + # with the future following call test_assert_xxx, + # add them to temp_file_repo now even if no actual following file, # it will be simple ignore during final deletion if not exist prefix = wasm_tempfile.split(".wasm")[0] temp_file_repo.append(prefix + ".aot") @@ -1436,8 +1440,8 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile, if test_aot: r = compile_wasm_to_aot(temp_files[1], temp_files[2], True, opts, r) # could be potientially compiled to aot - # with the future following call test_assert_xxx, - # add them to temp_file_repo now even if no actual following file, + # with the future following call test_assert_xxx, + # add them to temp_file_repo now even if no actual following file, # it will be simple ignore during final deletion if not exist prefix = temp_files[1].split(".wasm")[0] temp_file_repo.append(prefix + ".aot")