@@ -1053,7 +1053,6 @@ def get_libcall_files(self):
1053
1053
filenames = ['emscripten_memcpy.c' , 'emscripten_memset.c' ,
1054
1054
'emscripten_scan_stack.c' ,
1055
1055
'emscripten_get_heap_size.c' , # needed by malloc
1056
- 'sbrk.c' , # needed by malloc
1057
1056
'emscripten_memmove.c' ])
1058
1057
# Calls to iprintf can be generated during codegen. Ideally we wouldn't
1059
1058
# compile these with -O2 like we do the rest of compiler-rt since its
@@ -1300,7 +1299,6 @@ def get_files(self):
1300
1299
'sigaction.c' ,
1301
1300
'sigtimedwait.c' ,
1302
1301
'wasi-helpers.c' ,
1303
- 'sbrk.c' ,
1304
1302
'system.c' ,
1305
1303
])
1306
1304
@@ -1733,7 +1731,9 @@ def get_files(self):
1733
1731
malloc = utils .path_from_root ('system/lib' , {
1734
1732
'dlmalloc' : 'dlmalloc.c' , 'emmalloc' : 'emmalloc.c' ,
1735
1733
}[malloc_base ])
1736
- return [malloc ]
1734
+ # Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
1735
+ sbrk = utils .path_from_root ('system/lib/libc/sbrk.c' )
1736
+ return [malloc , sbrk ]
1737
1737
1738
1738
def get_cflags (self ):
1739
1739
cflags = super ().get_cflags ()
@@ -1818,13 +1818,10 @@ class libmimalloc(MTLibrary):
1818
1818
# mimalloc includes some files at the source level, so exclude them here.
1819
1819
excludes = ['alloc-override.c' , 'page-queue.c' , 'static.c' ]
1820
1820
)
1821
- src_files += files_in_path (
1822
- path = 'system/lib/mimalloc/src/prim' ,
1823
- filenames = ['prim.c' ]
1824
- )
1825
- src_files += files_in_path (
1826
- path = 'system/lib/' ,
1827
- filenames = ['emmalloc.c' ])
1821
+ src_files += [utils .path_from_root ('system/lib/mimalloc/src/prim/prim.c' )]
1822
+ src_files += [utils .path_from_root ('system/lib/emmalloc.c' )]
1823
+ # Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
1824
+ src_files += [utils .path_from_root ('system/lib/libc/sbrk.c' )]
1828
1825
1829
1826
def can_use (self ):
1830
1827
return super ().can_use () and settings .MALLOC == 'mimalloc'
0 commit comments