Skip to content

Commit 5c14ce0

Browse files
committed
Avoid use of EMCC_FORCE_STDLIBS in gen_struct_info.py
Using `-nostdlib` instead means we can remove the special handling in system_libs.py too.
1 parent 8862ad5 commit 5c14ce0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tools/gen_struct_info.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8989

9090
from tools import shared
91+
from tools import system_libs
9192

9293
QUIET = (__name__ != '__main__')
9394
DEBUG = False
@@ -231,15 +232,13 @@ def inspect_headers(headers, cpp_opts):
231232

232233
js_file = tempfile.mkstemp('.js')
233234

235+
shared.check_sanity()
236+
system_libs.Library.get_usable_variations()['libcompiler_rt'].get_path()
237+
234238
# Close all unneeded FDs.
235239
os.close(src_file[0])
236240
os.close(js_file[0])
237241

238-
# Remove dangerous env modifications
239-
env = os.environ.copy()
240-
env['EMCC_FORCE_STDLIBS'] = 'libcompiler_rt'
241-
env['EMCC_ONLY_FORCED_STDLIBS'] = '1'
242-
243242
info = []
244243
# Compile the program.
245244
show('Compiling generated code...')
@@ -248,6 +247,8 @@ def inspect_headers(headers, cpp_opts):
248247
'-O0',
249248
'-Werror',
250249
'-Wno-format',
250+
'-nostdlib',
251+
'-lcompiler_rt',
251252
'-I', shared.path_from_root(),
252253
'-s', 'BOOTSTRAPPING_STRUCT_INFO=1',
253254
'-s', 'WARN_ON_UNDEFINED_SYMBOLS=0',
@@ -268,7 +269,7 @@ def inspect_headers(headers, cpp_opts):
268269

269270
show(shared.shlex_join(cmd))
270271
try:
271-
subprocess.check_call(cmd, env=env)
272+
subprocess.check_call(cmd)
272273
except subprocess.CalledProcessError as e:
273274
sys.stderr.write('FAIL: Compilation failed!: %s\n' % e.cmd)
274275
sys.exit(1)

tools/system_libs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,8 +1458,7 @@ def add_library(lib):
14581458
add_library(system_libs_map[forced])
14591459

14601460
if only_forced:
1461-
if not shared.Settings.BOOTSTRAPPING_STRUCT_INFO:
1462-
add_library(system_libs_map['libc_rt_wasm'])
1461+
add_library(system_libs_map['libc_rt_wasm'])
14631462
add_library(system_libs_map['libcompiler_rt'])
14641463
else:
14651464
if shared.Settings.AUTO_NATIVE_LIBRARIES:

0 commit comments

Comments
 (0)