@@ -655,7 +655,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
655
655
if not shared .SKIP_SUBPROCS :
656
656
shared .check_llvm_version ()
657
657
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
659
659
if autoconf :
660
660
# configure tests want a more shell-like style, where we emit return codes on exit()
661
661
settings .EXIT_RUNTIME = 1
@@ -899,7 +899,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
899
899
# PURE_WASI, or when we are linking without standard libraries because
900
900
# STACK_OVERFLOW_CHECK depends on emscripten_stack_get_end which is defined
901
901
# 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 :
903
903
default_setting ('STACK_OVERFLOW_CHECK' , max (settings .ASSERTIONS , settings .STACK_OVERFLOW_CHECK ))
904
904
905
905
# 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
1536
1536
if settings .SIDE_MODULE and shared .suffix (target ) == '.js' :
1537
1537
diagnostics .warning ('emcc' , 'output suffix .js requested, but wasm side modules are just wasm files; emitting only a .wasm, no .js' )
1538
1538
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 :
1548
1540
settings .USE_OFFSET_CONVERTER = 1
1549
1541
# These symbols are needed by `withBuiltinMalloc` which used to implement
1550
1542
# 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
1560
1552
'emscripten_builtin_free' ,
1561
1553
]
1562
1554
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 :
1564
1556
# Increase the minimum memory requirements to account for extra memory
1565
1557
# that the sanitizers might need (in addition to the shadow memory
1566
1558
# requirements handled below).
@@ -1576,17 +1568,17 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
1576
1568
exit_with_error ('wasm2js is not compatible with USE_OFFSET_CONVERTER (see #14630)' )
1577
1569
settings .DEFAULT_LIBRARY_FUNCS_TO_INCLUDE .append ('$UTF8ArrayToString' )
1578
1570
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 :
1581
1573
settings .UBSAN_RUNTIME = 1
1582
1574
else :
1583
1575
settings .UBSAN_RUNTIME = 2
1584
1576
1585
- if 'leak' in sanitize :
1577
+ if 'leak' in options . sanitize :
1586
1578
settings .USE_LSAN = 1
1587
1579
default_setting ('EXIT_RUNTIME' , 1 )
1588
1580
1589
- if 'address' in sanitize :
1581
+ if 'address' in options . sanitize :
1590
1582
settings .USE_ASAN = 1
1591
1583
default_setting ('EXIT_RUNTIME' , 1 )
1592
1584
if not settings .UBSAN_RUNTIME :
@@ -1661,7 +1653,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
1661
1653
# ASan and SAFE_HEAP check address 0 themselves
1662
1654
settings .CHECK_NULL_WRITES = 0
1663
1655
1664
- if sanitize and settings .GENERATE_SOURCE_MAP :
1656
+ if options . sanitize and settings .GENERATE_SOURCE_MAP :
1665
1657
settings .LOAD_SOURCE_MAP = 1
1666
1658
1667
1659
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):
1792
1784
settings .EMSCRIPTEN_VERSION = utils .EMSCRIPTEN_VERSION
1793
1785
settings .SOURCE_MAP_BASE = options .source_map_base or ''
1794
1786
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
1796
1788
1797
1789
# WASMFS itself is written in C++, and needs C++ standard libraries
1798
1790
if settings .WASMFS :
@@ -1867,13 +1859,13 @@ def get_full_import_name(name):
1867
1859
1868
1860
1869
1861
@ToolchainProfiler .profile_block ('calculate system libraries' )
1870
- def phase_calculate_system_libraries (state , linker_arguments ):
1862
+ def phase_calculate_system_libraries (options , linker_arguments ):
1871
1863
extra_files_to_link = []
1872
1864
# Link in ports and system libraries, if necessary
1873
1865
if not settings .SIDE_MODULE :
1874
1866
# Ports are always linked into the main module, never the side module.
1875
1867
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 )
1877
1869
linker_arguments .extend (extra_files_to_link )
1878
1870
1879
1871
@@ -3128,7 +3120,7 @@ def run(linker_inputs, options, state):
3128
3120
logger .debug ('stopping after linking to object file' )
3129
3121
return 0
3130
3122
3131
- phase_calculate_system_libraries (state , linker_arguments )
3123
+ phase_calculate_system_libraries (options , linker_arguments )
3132
3124
3133
3125
js_syms = {}
3134
3126
if (not settings .SIDE_MODULE or settings .ASYNCIFY ) and not shared .SKIP_SUBPROCS :
0 commit comments