@@ -655,7 +655,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
655655 if not shared .SKIP_SUBPROCS :
656656 shared .check_llvm_version ()
657657
658- autoconf = os .environ .get ('EMMAKEN_JUST_CONFIGURE' ) or 'conftest.c' in state . orig_args or 'conftest.cpp' in state . orig_args
658+ autoconf = os .environ .get ('EMMAKEN_JUST_CONFIGURE' ) or 'conftest.c' in options . input_files or 'conftest.cpp' in options . input_files
659659 if autoconf :
660660 # configure tests want a more shell-like style, where we emit return codes on exit()
661661 settings .EXIT_RUNTIME = 1
@@ -899,7 +899,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
899899 # PURE_WASI, or when we are linking without standard libraries because
900900 # STACK_OVERFLOW_CHECK depends on emscripten_stack_get_end which is defined
901901 # in libcompiler-rt.
902- if not settings .PURE_WASI and '-nostdlib' not in state . orig_args and '-nodefaultlibs' not in state . orig_args :
902+ if not settings .PURE_WASI and not options . nostdlib and not options . nodefaultlibs :
903903 default_setting ('STACK_OVERFLOW_CHECK' , max (settings .ASSERTIONS , settings .STACK_OVERFLOW_CHECK ))
904904
905905 # For users that opt out of WARN_ON_UNDEFINED_SYMBOLS we assume they also
@@ -1536,15 +1536,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
15361536 if settings .SIDE_MODULE and shared .suffix (target ) == '.js' :
15371537 diagnostics .warning ('emcc' , 'output suffix .js requested, but wasm side modules are just wasm files; emitting only a .wasm, no .js' )
15381538
1539- sanitize = set ()
1540-
1541- for arg in state .orig_args :
1542- if arg .startswith ('-fsanitize=' ):
1543- sanitize .update (arg .split ('=' , 1 )[1 ].split (',' ))
1544- elif arg .startswith ('-fno-sanitize=' ):
1545- sanitize .difference_update (arg .split ('=' , 1 )[1 ].split (',' ))
1546-
1547- if sanitize :
1539+ if options .sanitize :
15481540 settings .USE_OFFSET_CONVERTER = 1
15491541 # These symbols are needed by `withBuiltinMalloc` which used to implement
15501542 # the `__noleakcheck` attribute. However this dependency is not yet represented in the JS
@@ -1560,7 +1552,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
15601552 'emscripten_builtin_free' ,
15611553 ]
15621554
1563- if ('leak' in sanitize or 'address' in sanitize ) and not settings .ALLOW_MEMORY_GROWTH :
1555+ if ('leak' in options . sanitize or 'address' in options . sanitize ) and not settings .ALLOW_MEMORY_GROWTH :
15641556 # Increase the minimum memory requirements to account for extra memory
15651557 # that the sanitizers might need (in addition to the shadow memory
15661558 # requirements handled below).
@@ -1576,17 +1568,17 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
15761568 exit_with_error ('wasm2js is not compatible with USE_OFFSET_CONVERTER (see #14630)' )
15771569 settings .DEFAULT_LIBRARY_FUNCS_TO_INCLUDE .append ('$UTF8ArrayToString' )
15781570
1579- if sanitize & UBSAN_SANITIZERS :
1580- if '-fsanitize-minimal-runtime' in state . orig_args :
1571+ if options . sanitize & UBSAN_SANITIZERS :
1572+ if options . sanitize_minimal_runtime :
15811573 settings .UBSAN_RUNTIME = 1
15821574 else :
15831575 settings .UBSAN_RUNTIME = 2
15841576
1585- if 'leak' in sanitize :
1577+ if 'leak' in options . sanitize :
15861578 settings .USE_LSAN = 1
15871579 default_setting ('EXIT_RUNTIME' , 1 )
15881580
1589- if 'address' in sanitize :
1581+ if 'address' in options . sanitize :
15901582 settings .USE_ASAN = 1
15911583 default_setting ('EXIT_RUNTIME' , 1 )
15921584 if not settings .UBSAN_RUNTIME :
@@ -1661,7 +1653,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
16611653 # ASan and SAFE_HEAP check address 0 themselves
16621654 settings .CHECK_NULL_WRITES = 0
16631655
1664- if sanitize and settings .GENERATE_SOURCE_MAP :
1656+ if options . sanitize and settings .GENERATE_SOURCE_MAP :
16651657 settings .LOAD_SOURCE_MAP = 1
16661658
16671659 if 'GLOBAL_BASE' not in user_settings and not settings .SHRINK_LEVEL and not settings .OPT_LEVEL and not settings .USE_ASAN :
@@ -1792,7 +1784,7 @@ def get_full_import_name(name):
17921784 settings .EMSCRIPTEN_VERSION = utils .EMSCRIPTEN_VERSION
17931785 settings .SOURCE_MAP_BASE = options .source_map_base or ''
17941786
1795- settings .LINK_AS_CXX = (shared .run_via_emxx or settings .DEFAULT_TO_CXX ) and '-nostdlib++' not in state . orig_args
1787+ settings .LINK_AS_CXX = (shared .run_via_emxx or settings .DEFAULT_TO_CXX ) and not options . nostdlibxx
17961788
17971789 # WASMFS itself is written in C++, and needs C++ standard libraries
17981790 if settings .WASMFS :
@@ -1867,13 +1859,13 @@ def get_full_import_name(name):
18671859
18681860
18691861@ToolchainProfiler .profile_block ('calculate system libraries' )
1870- def phase_calculate_system_libraries (state , linker_arguments ):
1862+ def phase_calculate_system_libraries (options , linker_arguments ):
18711863 extra_files_to_link = []
18721864 # Link in ports and system libraries, if necessary
18731865 if not settings .SIDE_MODULE :
18741866 # Ports are always linked into the main module, never the side module.
18751867 extra_files_to_link += ports .get_libs (settings )
1876- extra_files_to_link += system_libs .calculate (state . orig_args )
1868+ extra_files_to_link += system_libs .calculate (options )
18771869 linker_arguments .extend (extra_files_to_link )
18781870
18791871
@@ -3128,7 +3120,7 @@ def run(linker_inputs, options, state):
31283120 logger .debug ('stopping after linking to object file' )
31293121 return 0
31303122
3131- phase_calculate_system_libraries (state , linker_arguments )
3123+ phase_calculate_system_libraries (options , linker_arguments )
31323124
31333125 js_syms = {}
31343126 if (not settings .SIDE_MODULE or settings .ASYNCIFY ) and not shared .SKIP_SUBPROCS :
0 commit comments