@@ -1050,7 +1050,7 @@ def run(args):
1050
1050
if state .mode == Mode .POST_LINK_ONLY :
1051
1051
settings .limit_settings (None )
1052
1052
target , wasm_target = phase_linker_setup (options , state , newargs , settings_map )
1053
- process_libraries (state . link_flags , state . lib_dirs , [])
1053
+ process_libraries (state , [])
1054
1054
if len (input_files ) != 1 :
1055
1055
exit_with_error ('--post-link requires a single input file' )
1056
1056
phase_post_link (options , state , input_files [0 ][1 ], wasm_target , target )
@@ -1113,7 +1113,7 @@ def phase_calculate_linker_inputs(options, state, linker_inputs):
1113
1113
state .link_flags = filter_link_flags (state .link_flags , using_lld )
1114
1114
1115
1115
# Decide what we will link
1116
- state . link_flags = process_libraries (state . link_flags , state . lib_dirs , linker_inputs )
1116
+ process_libraries (state , linker_inputs )
1117
1117
1118
1118
linker_args = [val for _ , val in sorted (linker_inputs + state .link_flags )]
1119
1119
@@ -3502,14 +3502,14 @@ def find_library(lib, lib_dirs):
3502
3502
return None
3503
3503
3504
3504
3505
- def process_libraries (link_flags , lib_dirs , linker_inputs ):
3505
+ def process_libraries (state , linker_inputs ):
3506
3506
new_flags = []
3507
3507
libraries = []
3508
3508
suffixes = STATICLIB_ENDINGS + DYNAMICLIB_ENDINGS
3509
3509
system_libs_map = system_libs .Library .get_usable_variations ()
3510
3510
3511
3511
# Find library files
3512
- for i , flag in link_flags :
3512
+ for i , flag in state . link_flags :
3513
3513
if not flag .startswith ('-l' ):
3514
3514
new_flags .append ((i , flag ))
3515
3515
continue
@@ -3527,7 +3527,7 @@ def process_libraries(link_flags, lib_dirs, linker_inputs):
3527
3527
path = None
3528
3528
for suff in suffixes :
3529
3529
name = 'lib' + lib + suff
3530
- path = find_library (name , lib_dirs )
3530
+ path = find_library (name , state . lib_dirs )
3531
3531
if path :
3532
3532
break
3533
3533
@@ -3546,7 +3546,7 @@ def process_libraries(link_flags, lib_dirs, linker_inputs):
3546
3546
# Sort the input list from (order, lib_name) pairs to a flat array in the right order.
3547
3547
settings .SYSTEM_JS_LIBRARIES .sort (key = lambda lib : lib [0 ])
3548
3548
settings .SYSTEM_JS_LIBRARIES = [lib [1 ] for lib in settings .SYSTEM_JS_LIBRARIES ]
3549
- return new_flags
3549
+ state . link_flags = new_flags
3550
3550
3551
3551
3552
3552
class ScriptSource :
0 commit comments