Skip to content

Commit

Permalink
[test] Don't pass -O compiler flags when building assembly files. NFC
Browse files Browse the repository at this point in the history
This starting failing after an llvm change:
llvm/llvm-project#90013

```
clang: error: argument unused during compilation: '-O2' [-Werror,-Wunused-command-line-argument]
```
  • Loading branch information
sbc100 committed Apr 26, 2024
1 parent 0368ae1 commit 8a6a177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,14 @@ def add_on_exit(self, code):
# param @main_file whether this is the main file of the test. some arguments
# (like --pre-js) do not need to be passed when building
# libraries, for example
def get_emcc_args(self, main_file=False, compile_only=False):
def get_emcc_args(self, main_file=False, compile_only=False, asm_only=False):
def is_ldflag(f):
return any(f.startswith(s) for s in ['-sENVIRONMENT=', '--pre-js=', '--post-js='])

args = self.serialize_settings(compile_only) + self.emcc_args
if compile_only:
args = self.serialize_settings(compile_only or asm_only) + self.emcc_args
if asm_only:
args = [a for a in args if not a.startswith('-O')]
if compile_only or asm_only:
args = [a for a in args if not is_ldflag(a)]
else:
args += self.ldflags
Expand Down
2 changes: 1 addition & 1 deletion test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9613,7 +9613,7 @@ def test_em_async_js(self):
@no_wasm2js('wasm2js does not support reference types')
@no_sanitize('.s files cannot be sanitized')
def test_externref(self):
self.run_process([EMCC, '-c', test_file('core/test_externref.s'), '-o', 'asm.o'] + self.get_emcc_args(compile_only=True))
self.run_process([EMCC, '-c', test_file('core/test_externref.s'), '-o', 'asm.o'] + self.get_emcc_args(asm_only=True))
self.emcc_args += ['--js-library', test_file('core/test_externref.js')]
self.emcc_args += ['-mreference-types']
self.do_core_test('test_externref.c', libraries=['asm.o'])
Expand Down

0 comments on commit 8a6a177

Please sign in to comment.