Clean up TLS_SLOT_BIONIC_PREINIT usage a bit
- It is only needed for dynamic executables, so move the initialization out of __libc_init_main_thread and just before the solib constructor calls. For static executables, the slot was initialized, then never used or cleared. Instead, leave it clear. - For static executables, __libc_init_main_thread already initialized the stack guard, so remove the redundant __init_thread_stack_guard call. - Simplify the slot access/clearing a bit in __libc_preinit. - Remove the "__libc_init_common() will change the TLS area so the old one won't be accessible anyway." comment. AFAICT, it's incorrect -- the main thread's TLS area in a dynamic executable is initialized to a static pthread_internal_t object in the linker, then reused by libc.so. Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static Change-Id: Ie2da6f5be3ad563fa65b38eaadf8ba6ecc6a64b6
Loading
Please sign in to comment