Skip to content

Commit 1d1133a

Browse files
authored
[test] Don't pass -O compiler flags when building assembly files. NFC (#21841)
This starting failing after an llvm change: llvm/llvm-project#90013 ``` clang: error: argument unused during compilation: '-O2' [-Werror,-Wunused-command-line-argument] ```
1 parent 0368ae1 commit 1d1133a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,12 +1109,14 @@ def add_on_exit(self, code):
11091109
# param @main_file whether this is the main file of the test. some arguments
11101110
# (like --pre-js) do not need to be passed when building
11111111
# libraries, for example
1112-
def get_emcc_args(self, main_file=False, compile_only=False):
1112+
def get_emcc_args(self, main_file=False, compile_only=False, asm_only=False):
11131113
def is_ldflag(f):
11141114
return any(f.startswith(s) for s in ['-sENVIRONMENT=', '--pre-js=', '--post-js='])
11151115

1116-
args = self.serialize_settings(compile_only) + self.emcc_args
1117-
if compile_only:
1116+
args = self.serialize_settings(compile_only or asm_only) + self.emcc_args
1117+
if asm_only:
1118+
args = [a for a in args if not a.startswith('-O')]
1119+
if compile_only or asm_only:
11181120
args = [a for a in args if not is_ldflag(a)]
11191121
else:
11201122
args += self.ldflags

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9613,7 +9613,7 @@ def test_em_async_js(self):
96139613
@no_wasm2js('wasm2js does not support reference types')
96149614
@no_sanitize('.s files cannot be sanitized')
96159615
def test_externref(self):
9616-
self.run_process([EMCC, '-c', test_file('core/test_externref.s'), '-o', 'asm.o'] + self.get_emcc_args(compile_only=True))
9616+
self.run_process([EMCC, '-c', test_file('core/test_externref.s'), '-o', 'asm.o'] + self.get_emcc_args(asm_only=True))
96179617
self.emcc_args += ['--js-library', test_file('core/test_externref.js')]
96189618
self.emcc_args += ['-mreference-types']
96199619
self.do_core_test('test_externref.c', libraries=['asm.o'])

0 commit comments

Comments
 (0)