mimalloc: Segmentation fault on Apple Silicon / arm64
Building mimalloc fails in the TLS initialization with a segmentation fault:
% lldb ./mimalloc-test-api
(lldb) target create "./mimalloc-test-api"
Current executable set to '/Users/uwe/Development/mimalloc/build/mimalloc-test-api' (arm64).
(lldb) run
Process 17703 launched: '/Users/uwe/Development/mimalloc/build/mimalloc-test-api' (arm64)
mimalloc-test-api was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 17703 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000010001f264 mimalloc-test-api`_mi_process_init [inlined] mi_tls_slot(slot=0) at mimalloc-internal.h:711:9 [opt]
708 #elif defined(__aarch64__)
709 void** tcb; UNUSED(ofs);
710 __asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
-> 711 res = tcb[slot];
712 #endif
713 return res;
714 }
Target 0: (mimalloc-test-api) stopped.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 26 (18 by maintainers)
Commits related to this issue
- Use tpidrro_el0 for thread local storage in macOS-arm64 Fixes #343 — committed to xhochy/mimalloc by xhochy 4 years ago
- Use tpidrro_el0 for thread local storage in macOS-arm64 Fixes #343 — committed to xhochy/mimalloc by xhochy 4 years ago
tpidrro_el0seems to work fine on macOS, Linux only seems to settpidr_el0so I special cased that.