Skip to content

Commit a2d0b4e

Browse files
authored
Fix a system library build issue, where .S files would not be built with the same cmdline args as the other files. (#16417)
In particular, this would cause the .S files to not get the same preprocessor defines as .c and .cpp files have, so customizing .S files on preprocessor conditions was not possible.
1 parent 93677b2 commit a2d0b4e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/report_result.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#ifndef REPORT_RESULT_H_
1111
#define REPORT_RESULT_H_
1212

13+
#ifndef __ASSEMBLER__ // Emit this file only to C/C++ language headers and not when preprocessing .S files
14+
1315
#ifdef __cplusplus
1416
extern "C" {
1517
#endif
@@ -35,4 +37,6 @@ void _MaybeReportResult(int result, int sync);
3537
#define MAYBE_REPORT_RESULT_SYNC(result) _MaybeReportResult((result), 1)
3638
#endif
3739

40+
#endif
41+
3842
#endif // REPORT_RESULT_H_

tools/system_libs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ def build_objects(self, build_dir):
290290
commands = []
291291
objects = []
292292
cflags = self.get_cflags()
293-
base_flags = get_base_cflags()
294293
case_insensitive = is_case_insensitive(build_dir)
295294
for src in self.get_files():
296295
object_basename = shared.unsuffixed_basename(src)
@@ -310,13 +309,12 @@ def build_objects(self, build_dir):
310309
cmd = [shared.EMCC]
311310
else:
312311
cmd = [shared.EMXX]
312+
313+
cmd += cflags
313314
if ext in ('.s', '.S'):
314-
cmd += base_flags
315315
# TODO(sbc) There is an llvm bug that causes a crash when `-g` is used with
316316
# assembly files that define wasm globals.
317-
cmd.remove('-g')
318-
else:
319-
cmd += cflags
317+
cmd = [arg for arg in cmd if arg != '-g']
320318
cmd = self.customize_build_cmd(cmd, src)
321319
commands.append(cmd + ['-c', src, '-o', o])
322320
objects.append(o)

0 commit comments

Comments
 (0)