@@ -1061,6 +1061,45 @@ def uniquename(name):
10611061 explicit_settings_changes , newargs = parse_s_args (newargs )
10621062 settings_changes += explicit_settings_changes
10631063
1064+ settings_map = {}
1065+ for s in settings_changes :
1066+ key , value = s .split ('=' , 1 )
1067+ settings_map [key ] = value
1068+
1069+ # Libraries are searched before settings_changes are applied, so apply the
1070+ # value for STRICT from command line already now.
1071+
1072+ strict_cmdline = settings_map .get ('STRICT' )
1073+ if strict_cmdline :
1074+ settings .STRICT = int (strict_cmdline )
1075+
1076+ # Apply optimization level settings
1077+
1078+ if settings .OPT_LEVEL >= 1 :
1079+ settings .ASSERTIONS = 0
1080+ if settings .SHRINK_LEVEL >= 2 :
1081+ settings .EVAL_CTORS = 1
1082+
1083+ # For users that opt out of WARN_ON_UNDEFINED_SYMBOLS we assume they also
1084+ # want to opt out of ERROR_ON_UNDEFINED_SYMBOLS.
1085+ if settings_map .get ('WARN_ON_UNDEFINED_SYMBOLS' ) == '0' :
1086+ settings .ERROR_ON_UNDEFINED_SYMBOLS = 0
1087+
1088+ if settings .MINIMAL_RUNTIME or settings_map .get ('MINIMAL_RUNTIME' ) in ('1' , '2' ):
1089+ # Remove the default exported functions 'malloc', 'free', etc. those should only be linked in if used
1090+ settings .DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = []
1091+
1092+ # Apply -s settings in newargs here (after optimization levels, so they can override them)
1093+ apply_settings (settings_map )
1094+
1095+ if settings .EXTRA_EXPORTED_RUNTIME_METHODS :
1096+ diagnostics .warning ('deprecated' , 'EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead' )
1097+ settings .EXPORTED_RUNTIME_METHODS += settings .EXTRA_EXPORTED_RUNTIME_METHODS
1098+
1099+ if settings .RUNTIME_LINKED_LIBS :
1100+ diagnostics .warning ('deprecated' , 'RUNTIME_LINKED_LIBS is deprecated; you can simply list the libraries directly on the commandline now' )
1101+ newargs += settings .RUNTIME_LINKED_LIBS
1102+
10641103 # Find input files
10651104
10661105 # These three arrays are used to store arguments of different types for
@@ -1165,37 +1204,6 @@ def add_link_flag(i, f):
11651204
11661205 newargs = [a for a in newargs if a ]
11671206
1168- settings_map = {}
1169- for s in settings_changes :
1170- key , value = s .split ('=' , 1 )
1171- settings_map [key ] = value
1172-
1173- # Libraries are searched before settings_changes are applied, so apply the
1174- # value for STRICT from command line already now.
1175-
1176- strict_cmdline = settings_map .get ('STRICT' )
1177- if strict_cmdline :
1178- settings .STRICT = int (strict_cmdline )
1179-
1180- # Apply optimization level settings
1181-
1182- if settings .OPT_LEVEL >= 1 :
1183- settings .ASSERTIONS = 0
1184- if settings .SHRINK_LEVEL >= 2 :
1185- settings .EVAL_CTORS = 1
1186-
1187- # For users that opt out of WARN_ON_UNDEFINED_SYMBOLS we assume they also
1188- # want to opt out of ERROR_ON_UNDEFINED_SYMBOLS.
1189- if settings_map .get ('WARN_ON_UNDEFINED_SYMBOLS' ) == '0' :
1190- settings .ERROR_ON_UNDEFINED_SYMBOLS = 0
1191-
1192- if settings .MINIMAL_RUNTIME or settings_map .get ('MINIMAL_RUNTIME' ) in ('1' , '2' ):
1193- # Remove the default exported functions 'malloc', 'free', etc. those should only be linked in if used
1194- settings .DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = []
1195-
1196- # Apply -s settings in newargs here (after optimization levels, so they can override them)
1197- apply_settings (settings_map )
1198-
11991207 specified_target = options .output_file
12001208
12011209 if os .environ .get ('EMMAKEN_JUST_CONFIGURE' ) or 'conftest.c' in args :
@@ -1227,10 +1235,6 @@ def add_link_flag(i, f):
12271235
12281236 settings .TARGET_BASENAME = target_basename = unsuffixed_basename (target )
12291237
1230- if settings .EXTRA_EXPORTED_RUNTIME_METHODS :
1231- diagnostics .warning ('deprecated' , 'EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead' )
1232- settings .EXPORTED_RUNTIME_METHODS += settings .EXTRA_EXPORTED_RUNTIME_METHODS
1233-
12341238 final_suffix = get_file_suffix (target )
12351239
12361240 if has_dash_c or has_dash_S or has_dash_E or '-M' in newargs or '-MM' in newargs :
@@ -2925,10 +2929,6 @@ def do_binaryen(target, options, wasm_target):
29252929
29262930 # after generating the wasm, do some final operations
29272931
2928- # Add extra dylibs if needed.
2929- if settings .RUNTIME_LINKED_LIBS :
2930- webassembly .update_dylink_section (wasm_target , settings .RUNTIME_LINKED_LIBS )
2931-
29322932 if settings .EMIT_EMSCRIPTEN_METADATA :
29332933 diagnostics .warning ('deprecated' , 'We hope to remove support for EMIT_EMSCRIPTEN_METADATA. See https://github.com/emscripten-core/emscripten/issues/12231' )
29342934 webassembly .add_emscripten_metadata (wasm_target )
0 commit comments