@@ -1053,7 +1053,6 @@ def get_libcall_files(self):
10531053 filenames = ['emscripten_memcpy.c' , 'emscripten_memset.c' ,
10541054 'emscripten_scan_stack.c' ,
10551055 'emscripten_get_heap_size.c' , # needed by malloc
1056- 'sbrk.c' , # needed by malloc
10571056 'emscripten_memmove.c' ])
10581057 # Calls to iprintf can be generated during codegen. Ideally we wouldn't
10591058 # compile these with -O2 like we do the rest of compiler-rt since its
@@ -1300,7 +1299,6 @@ def get_files(self):
13001299 'sigaction.c' ,
13011300 'sigtimedwait.c' ,
13021301 'wasi-helpers.c' ,
1303- 'sbrk.c' ,
13041302 'system.c' ,
13051303 ])
13061304
@@ -1733,7 +1731,9 @@ def get_files(self):
17331731 malloc = utils .path_from_root ('system/lib' , {
17341732 'dlmalloc' : 'dlmalloc.c' , 'emmalloc' : 'emmalloc.c' ,
17351733 }[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 ]
17371737
17381738 def get_cflags (self ):
17391739 cflags = super ().get_cflags ()
@@ -1818,13 +1818,10 @@ class libmimalloc(MTLibrary):
18181818 # mimalloc includes some files at the source level, so exclude them here.
18191819 excludes = ['alloc-override.c' , 'page-queue.c' , 'static.c' ]
18201820 )
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' )]
18281825
18291826 def can_use (self ):
18301827 return super ().can_use () and settings .MALLOC == 'mimalloc'
0 commit comments