Skip to content

Commit 8adf838

Browse files
authored
[wasm backend] Add compiler-rt libs just like any others (#6880)
I'm not sure where these were being special cases really. Previously there were being added by calculate() and then assumed to exist. But calculate() isn't called in all cases, and in those cases these cache accesses would fail.
1 parent dd42cc0 commit 8adf838

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

tools/shared.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,13 +1916,6 @@ def llvm_backend_args():
19161916

19171917
@staticmethod
19181918
def link_lld(files, target, opts=[], lto_level=0):
1919-
def wasm_rt_fail(archive_file):
1920-
def wrapped():
1921-
raise FatalError('Expected {} to already be built'.format(archive_file))
1922-
return wrapped
1923-
1924-
libc_rt_lib = Cache.get('wasm_libc_rt.a', wasm_rt_fail('wasm_libc_rt.a'), 'a')
1925-
compiler_rt_lib = Cache.get('wasm_compiler_rt.a', wasm_rt_fail('wasm_compiler_rt.a'), 'a')
19261919
cmd = [
19271920
WASM_LD,
19281921
'-z',
@@ -1937,7 +1930,7 @@ def wrapped():
19371930
'--export',
19381931
'__wasm_call_ctors',
19391932
'--lto-O%d' % lto_level,
1940-
] + files + [libc_rt_lib, compiler_rt_lib]
1933+
] + files
19411934

19421935
if Settings.WASM_MEM_MAX != -1:
19431936
cmd.append('--max-memory=%d' % Settings.WASM_MEM_MAX)

tools/system_libs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,9 @@ def do_create():
614614
force = force.union(deps)
615615
ret.sort(key=lambda x: x.endswith('.a')) # make sure to put .a files at the end.
616616

617-
# Handle backend compiler_rt separately because it is not a bitcode system lib like the others.
618-
# Here, just ensure that it's in the cache.
619-
if shared.Settings.WASM and shared.Settings.WASM_BACKEND:
620-
shared.Cache.get('wasm_compiler_rt.a', lambda: create_wasm_compiler_rt('wasm_compiler_rt.a'), extension='a')
621-
shared.Cache.get('wasm_libc_rt.a', lambda: create_wasm_libc_rt('wasm_libc_rt.a'), extension='a')
617+
if shared.Settings.WASM_BACKEND:
618+
ret.append(shared.Cache.get('wasm_compiler_rt.a', lambda: create_wasm_compiler_rt('wasm_compiler_rt.a'), extension='a'))
619+
ret.append(shared.Cache.get('wasm_libc_rt.a', lambda: create_wasm_libc_rt('wasm_libc_rt.a'), extension='a'))
622620

623621
for actual in ret:
624622
if os.path.basename(actual) == 'libcxxabi.bc':

0 commit comments

Comments
 (0)