Init stdio in __libc_init_common.
Previously we call __sinit() lazily. But it is likely to cause data races like in https://android-review.googlesource.com/#/c/183237/. So we prefer to call __sinit() explicitly at libc initialization. Bug: 25392375 Change-Id: I181ea7a4b2e4c7350b45f2e6c86886ea023e80b8
This commit is contained in:
parent
8bd27182c5
commit
d68c9e5906
@ -54,6 +54,7 @@ extern "C" abort_msg_t** __abort_message_ptr;
|
||||
extern "C" int __system_properties_init(void);
|
||||
extern "C" int __set_tls(void* ptr);
|
||||
extern "C" int __set_tid_address(int* tid_address);
|
||||
extern "C" int __sinit(void);
|
||||
|
||||
__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
|
||||
|
||||
@ -133,6 +134,9 @@ void __libc_init_common(KernelArgumentBlock& args) {
|
||||
__pthread_internal_add(main_thread);
|
||||
|
||||
__system_properties_init(); // Requires 'environ'.
|
||||
// Initialize stdio here to get rid of data races caused by lazy initialization.
|
||||
// TODO: Remove other calls to __sinit().
|
||||
__sinit();
|
||||
}
|
||||
|
||||
__noreturn static void __early_abort(int line) {
|
||||
|
Loading…
Reference in New Issue
Block a user