Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1889,8 +1889,6 @@ class libmimalloc(MTLibrary):
'-DNDEBUG',
# Emscripten uses musl libc internally
'-DMI_LIBC_MUSL',
# enable use of `__builtin_thread_pointer()`
'-DMI_USE_BUILTIN_THREAD_POINTER',
]

# malloc/free/calloc are runtime functions and can be generated during LTO
Expand All @@ -1913,6 +1911,13 @@ class libmimalloc(MTLibrary):
# Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
src_files += [utils.path_from_root('system/lib/libc/sbrk.c')]

def get_cflags(self):
cflags = super().get_cflags()
if self.is_mt:
# enable use of `__builtin_thread_pointer()` in multithreaded builds
cflags += ['-DMI_USE_BUILTIN_THREAD_POINTER']
return cflags

def can_use(self):
return super().can_use() and settings.MALLOC == 'mimalloc'

Expand Down
Loading