@@ -49,14 +49,16 @@ def glob_in_path(path, glob_pattern, excludes=()):
49
49
return sorted (f for f in files if os .path .basename (f ) not in excludes )
50
50
51
51
52
- def get_base_cflags (force_object_files = False ):
52
+ def get_base_cflags (force_object_files = False , preprocess = True ):
53
53
# Always build system libraries with debug information. Non-debug builds
54
54
# will ignore this at link time because we link with `-strip-debug`.
55
- flags = ['-g' , '-sSTRICT' ]
55
+ flags = ['-g' , '-sSTRICT' , '-Werror' ]
56
56
if settings .LTO and not force_object_files :
57
57
flags += ['-flto=' + settings .LTO ]
58
58
if settings .RELOCATABLE :
59
- flags += ['-sRELOCATABLE' , '-DEMSCRIPTEN_DYNAMIC_LINKING' ]
59
+ flags += ['-sRELOCATABLE' ]
60
+ if preprocess :
61
+ flags += ['-DEMSCRIPTEN_DYNAMIC_LINKING' ]
60
62
if settings .MEMORY64 :
61
63
flags += ['-Wno-experimental' , '-sMEMORY64=' + str (settings .MEMORY64 )]
62
64
return flags
@@ -339,7 +341,7 @@ def get_default_variation(cls, **kwargs):
339
341
# extra code size. The -fno-unroll-loops flags was added here when loop
340
342
# unrolling landed upstream in LLVM to avoid changing behavior but was not
341
343
# specifically evaluated.
342
- cflags = ['-O2' , '-Wall' , '-Werror' , '- fno-unroll-loops' ]
344
+ cflags = ['-O2' , '-Wall' , '-fno-unroll-loops' ]
343
345
344
346
# A list of directories to put in the include path when building.
345
347
# This is a list of tuples of path components.
@@ -460,7 +462,7 @@ def generate_ninja(self, build_dir, libname):
460
462
source_dir = utils .path_from_root ()
461
463
cflags += [f'-ffile-prefix-map={ source_dir } =/emsdk/emscripten' ,
462
464
'-fdebug-compilation-dir=/emsdk/emscripten' ]
463
- asflags = get_base_cflags ()
465
+ asflags = get_base_cflags (preprocess = False )
464
466
input_files = self .get_files ()
465
467
ninja_file = os .path .join (build_dir , 'build.ninja' )
466
468
create_ninja_file (input_files , ninja_file , libname , cflags , asflags = asflags , customize_build_flags = self .customize_build_cmd )
@@ -503,7 +505,7 @@ def build_objects(self, build_dir):
503
505
# .s files are processed directly by the assembler. In this case we can't pass
504
506
# pre-processor flags such as `-I` and `-D` but we still want core flags such as
505
507
# `-sMEMORY64`.
506
- cmd += get_base_cflags ()
508
+ cmd += get_base_cflags (preprocess = False )
507
509
else :
508
510
cmd += cflags
509
511
if ext in ('.s' , '.S' ):
0 commit comments