Skip to content

Commit fa04a98

Browse files
sbc100MPurscheUnity
authored andcommitted
Fix sbrk tracing (emscripten-core#22787)
This effectively reverts emscripten-core#19174 Fixes: emscripten-core#21223
1 parent 077a39c commit fa04a98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/code_size/hello_wasm_worker_wasm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"a.wasm.gz": 1040,
88
"total": 3314,
99
"total_gz": 1938
10-
}
10+
}

tools/system_libs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,6 @@ def get_libcall_files(self):
982982
filenames=['emscripten_memcpy.c', 'emscripten_memset.c',
983983
'emscripten_scan_stack.c',
984984
'emscripten_get_heap_size.c', # needed by malloc
985-
'sbrk.c', # needed by malloc
986985
'emscripten_memmove.c'])
987986
# Calls to iprintf can be generated during codegen. Ideally we wouldn't
988987
# compile these with -O2 like we do the rest of compiler-rt since its
@@ -1220,7 +1219,6 @@ def get_files(self):
12201219
'sigaction.c',
12211220
'sigtimedwait.c',
12221221
'wasi-helpers.c',
1223-
'sbrk.c',
12241222
])
12251223

12261224
if settings.RELOCATABLE:
@@ -1627,7 +1625,9 @@ def get_files(self):
16271625
malloc = utils.path_from_root('system/lib', {
16281626
'dlmalloc': 'dlmalloc.c', 'emmalloc': 'emmalloc.c',
16291627
}[malloc_base])
1630-
return [malloc]
1628+
# Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
1629+
sbrk = utils.path_from_root('system/lib/libc/sbrk.c')
1630+
return [malloc, sbrk]
16311631

16321632
def get_cflags(self):
16331633
cflags = super().get_cflags()

0 commit comments

Comments
 (0)