Merge "Update x86 crtfiles from bionic with C versions"
This commit is contained in:
@@ -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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011 The Android Open Source Project
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,25 +24,12 @@
|
|||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Contributed by: Intel Corporation
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.text
|
extern void *__dso_handle;
|
||||||
.p2align 4,,15
|
|
||||||
.globl __stack_chk_fail_local
|
|
||||||
.hidden __stack_chk_fail_local
|
|
||||||
.type __stack_chk_fail_local, @function
|
|
||||||
|
|
||||||
__stack_chk_fail_local:
|
__attribute__ ((visibility ("hidden")))
|
||||||
#ifdef __PIC__
|
int atexit(void (*func)(void))
|
||||||
pushl %ebx
|
{
|
||||||
call __x86.get_pc_thunk.bx
|
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle));
|
||||||
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
}
|
||||||
call __stack_chk_fail@PLT
|
|
||||||
#else /* PIC */
|
|
||||||
jmp __stack_chk_fail
|
|
||||||
#endif /* not PIC */
|
|
||||||
|
|
||||||
.size __stack_chk_fail_local, .-__stack_chk_fail_local
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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
|
#include "../../bionic/libc_init_common.h"
|
||||||
.globl __x86.get_pc_thunk.bx
|
#include <stddef.h>
|
||||||
.hidden __x86.get_pc_thunk.bx
|
#include <stdint.h>
|
||||||
.type __x86.get_pc_thunk.bx, @function
|
|
||||||
__x86.get_pc_thunk.bx:
|
__attribute__ ((section (".preinit_array")))
|
||||||
nop
|
void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
nop
|
|
||||||
nop
|
__attribute__ ((section (".init_array")))
|
||||||
nop
|
void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
nop
|
|
||||||
nop
|
__attribute__ ((section (".fini_array")))
|
||||||
nop
|
void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
nop
|
|
||||||
movl (%esp), %ebx
|
__LIBC_HIDDEN__
|
||||||
ret
|
__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"
|
||||||
@@ -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"
|
|
||||||
@@ -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"
|
|
||||||
59
ndk/platforms/android-9/arch-x86/src/crtbegin_so.c
Normal file
59
ndk/platforms/android-9/arch-x86/src/crtbegin_so.c
Normal file
@@ -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
|
||||||
@@ -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"
|
|
||||||
1
ndk/platforms/android-9/arch-x86_64
Symbolic link
1
ndk/platforms/android-9/arch-x86_64
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
arch-x86
|
||||||
Reference in New Issue
Block a user