getting the tls base address. unlike linux arm64, the tpidr_el0 returns always 0 (aka unused) thus using tpidrro_el0 instead clearing up the cpu id encoded in the lower bits.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Hi David, thanks for the patch! :)
I have no objections; before landing, can you help me understand and document in the commit message which problem this is solving or what it is improving?
I see that TlsBaseAddr() now also returns a non-zero value for arm64 and that it is only used in GetThreadStackAndTls() which has a couple of callers.
void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size, uptr *tls_addr, uptr *tls_size);
Comment Actions
Note, I am getting the following warning when compiling your patch:
compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:559:36: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] asm("mrs %0, tpidrro_el0" : "=r"(segbase)); ^ compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:559:12: note: use constraint modifier "w" asm("mrs %0, tpidrro_el0" : "=r"(segbase)); ^~ %w0
Comment Actions
the warning is weird, I do not get this on my mac M1 arm64, compiled with Xcode clang.
clang-format: please reformat the code