Pre-M and GCC compatibility for crtbegin.
We're going to start using the bionic sources for the NDK CRT objects, so we need to avoid using symbols that weren't around in early versions of Android. The NDK is currently building the CRT objects with GCC as well (there were some segfaults that have yet to be diagnosed), so move `__used` to the GCC compatible location. Test: treehugger Bug: None Change-Id: I1f5c23eafadc2e3bc0b84bc3305f79a04d35c7d8
This commit is contained in:
parent
73871ad09b
commit
2e2c72d61f
|
@ -36,7 +36,7 @@ SECTION(".init_array") void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
|
|||
SECTION(".fini_array") void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
|
||||
#undef SECTION
|
||||
|
||||
static void _start_main(void* raw_args) __used {
|
||||
__used static void _start_main(void* raw_args) {
|
||||
structors_array_t array;
|
||||
array.preinit_array = &__PREINIT_ARRAY__;
|
||||
array.init_array = &__INIT_ARRAY__;
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android/api-level.h>
|
||||
|
||||
// __register_atfork wasn't available until android-23. We need to build a
|
||||
// pre-23 and 23+ version of crtbegin.
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
|
||||
extern void* __dso_handle;
|
||||
|
||||
extern int __register_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void), void* dso);
|
||||
|
@ -27,3 +33,4 @@ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(vo
|
|||
return __register_atfork(prepare, parent, child, &__dso_handle);
|
||||
}
|
||||
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
|
|
Loading…
Reference in New Issue