summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2013-07-25 20:55:38 +0400
committerPavel Chupin <pavel.v.chupin@intel.com>2013-07-25 20:55:38 +0400
commite5c9f8ec5addd6100e78730fabf41b4d10151ac0 (patch)
tree458965017fb0b4c6d9b152e4f1bd8c1beb95960e
parentf05c9f97b39d4d17658577416dcc16d85c7582db (diff)
downloadandroid_development-e5c9f8ec5addd6100e78730fabf41b4d10151ac0.tar.gz
android_development-e5c9f8ec5addd6100e78730fabf41b4d10151ac0.tar.bz2
android_development-e5c9f8ec5addd6100e78730fabf41b4d10151ac0.zip
Update x86 crtfiles from bionic with C versions
Files are copied as is from bionic head. Also adding arch-x86_64 symlink to be able to generate arch-x86_64 crtfiles/libs. Change-Id: I0b40c1c19bb4e3b24b25fa2bcb9236469fa32a3e Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
-rw-r--r--ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.h60
-rw-r--r--ndk/platforms/android-9/arch-x86/src/atexit.h (renamed from ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.S)27
-rw-r--r--ndk/platforms/android-9/arch-x86/src/crtbegin.c (renamed from ndk/platforms/android-9/arch-x86/src/atexit.S)68
-rw-r--r--ndk/platforms/android-9/arch-x86/src/crtbegin_dynamic.S138
-rw-r--r--ndk/platforms/android-9/arch-x86/src/crtbegin_so.S111
-rw-r--r--ndk/platforms/android-9/arch-x86/src/crtbegin_so.c59
-rw-r--r--ndk/platforms/android-9/arch-x86/src/crtbegin_static.S138
l---------ndk/platforms/android-9/arch-x86_641
8 files changed, 156 insertions, 446 deletions
diff --git a/ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.h b/ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.h
new file mode 100644
index 000000000..4f3699a35
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+/*
+ __stack_chk_fail routine is runtime part of stack protector compiler
+ feature. It's implemented in libc and represents die routine when stack
+ corruption is detected.
+
+ Calls are generated by compiler and injected into user functions when
+ -fstack-protector* options are used.
+
+ __stack_chk_fail_local is wrapper for __stack_chk_fail. Compiler generates
+ wrapper calls instead for PIC code only and only on IA32 for optimization
+ purpose (see gcc/config/i386/i386.c). Wrapper body is always included into
+ executable or library. This is the idea of optimization.
+
+ Glibc is doing this via libc_nonshared.a which is linked automatically
+ everytime with libc.so. In bionic we have to bring it within crtfiles
+ because libc.so is real library and not a link script like libc.so at glibc.
+
+ For x86_64 or non-PIC code compiler always generates __stack_chk_fail calls.
+*/
+
+#ifdef __i386__
+#ifdef __PIC__
+extern void __stack_chk_fail();
+
+__attribute__ ((visibility ("hidden")))
+void __stack_chk_fail_local()
+{
+ __stack_chk_fail();
+}
+#endif
+#endif
diff --git a/ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.S b/ndk/platforms/android-9/arch-x86/src/atexit.h
index 59fe86ec3..bc776a8b4 100644
--- a/ndk/platforms/android-9/arch-x86/src/__stack_chk_fail_local.S
+++ b/ndk/platforms/android-9/arch-x86/src/atexit.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,24 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/*
- * Contributed by: Intel Corporation
- */
-
- .text
- .p2align 4,,15
- .globl __stack_chk_fail_local
- .hidden __stack_chk_fail_local
- .type __stack_chk_fail_local, @function
-__stack_chk_fail_local:
-#ifdef __PIC__
- pushl %ebx
- call __x86.get_pc_thunk.bx
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
- call __stack_chk_fail@PLT
-#else /* PIC */
- jmp __stack_chk_fail
-#endif /* not PIC */
+extern void *__dso_handle;
- .size __stack_chk_fail_local, .-__stack_chk_fail_local
+__attribute__ ((visibility ("hidden")))
+int atexit(void (*func)(void))
+{
+ return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle));
+}
diff --git a/ndk/platforms/android-9/arch-x86/src/atexit.S b/ndk/platforms/android-9/arch-x86/src/crtbegin.c
index b28f40bb6..43e9306ba 100644
--- a/ndk/platforms/android-9/arch-x86/src/atexit.S
+++ b/ndk/platforms/android-9/arch-x86/src/crtbegin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,42 +25,32 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
- .text
- .p2align 4,,15
- .globl atexit
- .hidden atexit
- .type atexit, @function
-atexit:
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- call __x86.get_pc_thunk.bx
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
- subl $20, %esp
- movl $0, 4(%esp)
- movl __dso_handle@GOTOFF(%ebx), %eax
- movl %eax, 8(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
- call __cxa_atexit@PLT
- addl $20, %esp
- popl %ebx
- popl %ebp
- ret
- .size atexit, .-atexit
- .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
- .globl __x86.get_pc_thunk.bx
- .hidden __x86.get_pc_thunk.bx
- .type __x86.get_pc_thunk.bx, @function
-__x86.get_pc_thunk.bx:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- movl (%esp), %ebx
- ret
+#include "../../bionic/libc_init_common.h"
+#include <stddef.h>
+#include <stdint.h>
+
+__attribute__ ((section (".preinit_array")))
+void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
+
+__attribute__ ((section (".init_array")))
+void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
+
+__attribute__ ((section (".fini_array")))
+void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
+
+__LIBC_HIDDEN__
+__attribute__((force_align_arg_pointer))
+void _start() {
+ structors_array_t array;
+ array.preinit_array = &__PREINIT_ARRAY__;
+ array.init_array = &__INIT_ARRAY__;
+ array.fini_array = &__FINI_ARRAY__;
+
+ void* raw_args = (void*) ((uintptr_t) __builtin_frame_address(0) + sizeof(void*));
+ __libc_init(raw_args, NULL, &main, &array);
+}
+
+#include "__dso_handle.h"
+#include "atexit.h"
+#include "__stack_chk_fail_local.h"
diff --git a/ndk/platforms/android-9/arch-x86/src/crtbegin_dynamic.S b/ndk/platforms/android-9/arch-x86/src/crtbegin_dynamic.S
deleted file mode 100644
index 0ccad70a4..000000000
--- a/ndk/platforms/android-9/arch-x86/src/crtbegin_dynamic.S
+++ /dev/null
@@ -1,138 +0,0 @@
-# bionic/arch-x86/bionic/crtbegin_dynamic.S
-#
-# Copyright 2006, The Android Open Source Project
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may
-# be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- .text
- .align 4
- .type _start, @function
- .globl _start
-
-# this is the small startup code that is first run when
-# any executable that is dynamically-linked with Bionic
-# runs.
-#
-# it's purpose is to call __libc_init with appropriate
-# arguments, which are:
-#
-# - the address of the raw data block setup by the Linux
-# kernel ELF loader
-#
-# - address of an "onexit" function, not used on any
-# platform supported by Bionic
-#
-# - address of the "main" function of the program. We
-# can't hard-code it in the adr pseudo instruction
-# so we use a tiny trampoline that will get relocated
-# by the dynamic linker before this code runs
-#
-# - address of the constructor list
-#
-_start:
- mov %esp, %eax
- # before push arguments, align the stack to a 16 byte boundary
- andl $~15, %esp
- mov $1f, %edx
- pushl %edx
- mov $0f, %edx
- pushl %edx
- mov $0, %edx
- pushl %edx
- pushl %eax
- call __libc_init
-
-0: jmp main
-
-1: .long __PREINIT_ARRAY__
- .long __INIT_ARRAY__
- .long __FINI_ARRAY__
-
- .section .preinit_array, "aw"
- .globl __PREINIT_ARRAY__
-__PREINIT_ARRAY__:
- .long -1
-
- .section .init_array, "aw"
- .globl __INIT_ARRAY__
-__INIT_ARRAY__:
- .long -1
- .long frame_dummy
-
- .section .fini_array, "aw"
- .globl __FINI_ARRAY__
-__FINI_ARRAY__:
- .long -1
- .long __do_global_dtors_aux
-
- .section .eh_frame,"a",@progbits
- .align 4
- .type __EH_FRAME_BEGIN__, @object
-__EH_FRAME_BEGIN__:
- .text
- .p2align 4,,15
- .type __do_global_dtors_aux, @function
-__do_global_dtors_aux:
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp
- cmpb $0, completed.4454
- jne .L4
- movl $__deregister_frame_info_bases, %eax
- testl %eax, %eax
- je .L3
- movl $__EH_FRAME_BEGIN__, (%esp)
- call __deregister_frame_info_bases
-.L3:
- movb $1, completed.4454
-.L4:
- leave
- ret
- .text
- .p2align 4,,15
- .type frame_dummy, @function
-frame_dummy:
- pushl %ebp
- movl $__register_frame_info_bases, %eax
- movl %esp, %ebp
- subl $24, %esp
- testl %eax, %eax
- je .L7
- movl %ebx, 12(%esp)
- movl $0, 8(%esp)
- movl $object.4466, 4(%esp)
- movl $__EH_FRAME_BEGIN__, (%esp)
- call __register_frame_info_bases
-.L7:
- leave
- ret
- .local completed.4454
- .comm completed.4454,1,1
- .local object.4466
- .comm object.4466,24,4
- .weak __register_frame_info_bases
- .weak __deregister_frame_info_bases
-
-#include "__dso_handle.S"
-#include "atexit.S"
-#include "__stack_chk_fail_local.S"
diff --git a/ndk/platforms/android-9/arch-x86/src/crtbegin_so.S b/ndk/platforms/android-9/arch-x86/src/crtbegin_so.S
deleted file mode 100644
index 99662fe16..000000000
--- a/ndk/platforms/android-9/arch-x86/src/crtbegin_so.S
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-.section .init_array, "aw"
-.align 4
-.type __INIT_ARRAY__, @object
-.globl __INIT_ARRAY__
-__INIT_ARRAY__:
- .long -1
- .long frame_dummy
-
-.section .fini_array, "aw"
-.align 4
-.type __FINI_ARRAY__, @object
-.globl __FINI_ARRAY__
-__FINI_ARRAY__:
- .long -1
- .long __do_global_dtors_aux
-
- .section .eh_frame,"a",@progbits
- .align 4
- .type __EH_FRAME_BEGIN__, @object
-__EH_FRAME_BEGIN__:
- .text
- .p2align 4,,15
- .type __do_global_dtors_aux, @function
-__do_global_dtors_aux:
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- call __x86.get_pc_thunk.bx
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
- subl $20, %esp
- cmpb $0, completed.4454@GOTOFF(%ebx)
- jne .L5
- movl __dso_handle@GOTOFF(%ebx), %eax
- movl %eax, (%esp)
- call __cxa_finalize@PLT
- movl __deregister_frame_info_bases@GOT(%ebx), %eax
- testl %eax, %eax
- je .L4
- leal __EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
- movl %eax, (%esp)
- call __deregister_frame_info_bases@PLT
-.L4:
- movb $1, completed.4454@GOTOFF(%ebx)
-.L5:
- addl $20, %esp
- popl %ebx
- popl %ebp
- ret
- .text
- .p2align 4,,15
- .type frame_dummy, @function
-frame_dummy:
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- call __x86.get_pc_thunk.bx
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
- subl $20, %esp
- movl __register_frame_info_bases@GOT(%ebx), %eax
- testl %eax, %eax
- je .L8
- leal object.4469@GOTOFF(%ebx), %eax
- movl %eax, 4(%esp)
- leal __EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
- movl %ebx, 12(%esp)
- movl $0, 8(%esp)
- movl %eax, (%esp)
- call __register_frame_info_bases@PLT
-.L8:
- addl $20, %esp
- popl %ebx
- popl %ebp
- ret
- .local completed.4454
- .comm completed.4454,1,1
- .local object.4469
- .comm object.4469,24,4
- .weak __register_frame_info_bases
- .weak __deregister_frame_info_bases
-
-#include "__dso_handle_so.S"
-#include "atexit.S"
-#include "__stack_chk_fail_local.S"
diff --git a/ndk/platforms/android-9/arch-x86/src/crtbegin_so.c b/ndk/platforms/android-9/arch-x86/src/crtbegin_so.c
new file mode 100644
index 000000000..30de6af19
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/src/crtbegin_so.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+extern void __cxa_finalize(void *);
+extern void *__dso_handle;
+
+__attribute__((visibility("hidden"),destructor))
+void __on_dlclose() {
+ __cxa_finalize(&__dso_handle);
+}
+
+/* CRT_LEGACY_WORKAROUND should only be defined when building
+ * this file as part of the platform's C library.
+ *
+ * The C library already defines a function named 'atexit()'
+ * for backwards compatibility with older NDK-generated binaries.
+ *
+ * For newer ones, 'atexit' is actually embedded in the C
+ * runtime objects that are linked into the final ELF
+ * binary (shared library or executable), and will call
+ * __cxa_atexit() in order to un-register any atexit()
+ * handler when a library is unloaded.
+ *
+ * This function must be global *and* hidden. Only the
+ * code inside the same ELF binary should be able to access it.
+ */
+
+#ifdef CRT_LEGACY_WORKAROUND
+#include "__dso_handle.h"
+#else
+#include "__dso_handle_so.h"
+#include "atexit.h"
+#include "__stack_chk_fail_local.h"
+#endif
diff --git a/ndk/platforms/android-9/arch-x86/src/crtbegin_static.S b/ndk/platforms/android-9/arch-x86/src/crtbegin_static.S
deleted file mode 100644
index 4fffecdc8..000000000
--- a/ndk/platforms/android-9/arch-x86/src/crtbegin_static.S
+++ /dev/null
@@ -1,138 +0,0 @@
-# bionic/arch-x86/bionic/crtbegin_static.S
-#
-# Copyright 2006, The Android Open Source Project
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may
-# be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- .text
- .align 4
- .type _start, @function
- .globl _start
-
-# this is the small startup code that is first run when
-# any executable that is statically-linked with Bionic
-# runs.
-#
-# it's purpose is to call __libc_init with appropriate
-# arguments, which are:
-#
-# - the address of the raw data block setup by the Linux
-# kernel ELF loader
-#
-# - address of an "onexit" function, not used on any
-# platform supported by Bionic
-#
-# - address of the "main" function of the program. We
-# can't hard-code it in the adr pseudo instruction
-# so we use a tiny trampoline that will get relocated
-# by the dynamic linker before this code runs
-#
-# - address of the constructor list
-#
-_start:
- mov %esp, %eax
- # before push arguments, align the stack to a 16 byte boundary
- andl $~15, %esp
- mov $1f, %edx
- pushl %edx
- mov $0f, %edx
- pushl %edx
- mov $0, %edx
- pushl %edx
- pushl %eax
- call __libc_init
-
-0: jmp main
-
-1: .long __PREINIT_ARRAY__
- .long __INIT_ARRAY__
- .long __FINI_ARRAY__
-
- .section .preinit_array, "aw"
- .globl __PREINIT_ARRAY__
-__PREINIT_ARRAY__:
- .long -1
-
- .section .init_array, "aw"
- .globl __INIT_ARRAY__
-__INIT_ARRAY__:
- .long -1
- .long frame_dummy
-
- .section .fini_array, "aw"
- .globl __FINI_ARRAY__
-__FINI_ARRAY__:
- .long -1
- .long __do_global_dtors_aux
-
- .section .eh_frame,"a",@progbits
- .align 4
- .type __EH_FRAME_BEGIN__, @object
-__EH_FRAME_BEGIN__:
- .text
- .p2align 4,,15
- .type __do_global_dtors_aux, @function
-__do_global_dtors_aux:
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp
- cmpb $0, completed.4454
- jne .L4
- movl $__deregister_frame_info_bases, %eax
- testl %eax, %eax
- je .L3
- movl $__EH_FRAME_BEGIN__, (%esp)
- call __deregister_frame_info_bases
-.L3:
- movb $1, completed.4454
-.L4:
- leave
- ret
- .text
- .p2align 4,,15
- .type frame_dummy, @function
-frame_dummy:
- pushl %ebp
- movl $__register_frame_info_bases, %eax
- movl %esp, %ebp
- subl $24, %esp
- testl %eax, %eax
- je .L7
- movl %ebx, 12(%esp)
- movl $0, 8(%esp)
- movl $object.4466, 4(%esp)
- movl $__EH_FRAME_BEGIN__, (%esp)
- call __register_frame_info_bases
-.L7:
- leave
- ret
- .local completed.4454
- .comm completed.4454,1,1
- .local object.4466
- .comm object.4466,24,4
- .weak __register_frame_info_bases
- .weak __deregister_frame_info_bases
-
-#include "__dso_handle.S"
-#include "atexit.S"
-#include "__stack_chk_fail_local.S"
diff --git a/ndk/platforms/android-9/arch-x86_64 b/ndk/platforms/android-9/arch-x86_64
new file mode 120000
index 000000000..fb7033ca8
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86_64
@@ -0,0 +1 @@
+arch-x86 \ No newline at end of file