1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the 13 * distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 .text 29 .align 4 30 .type __start,@function 31 .globl __start 32 .globl _start 33 34# this is the small startup code that is first run when 35# any executable that is dynamically-linked with Bionic 36# runs. 37# 38# it's purpose is to call __libc_init with appropriate 39# arguments, which are: 40# 41# - the address of the raw data block setup by the Linux 42# kernel ELF loader 43# 44# - address of an "onexit" function, not used on any 45# platform supported by Bionic 46# 47# - address of the "main" function of the program. 48# 49# - address of the constructor list 50# 51 52 .ent __start 53__start: 54_start: 55 bal 1f 561: 57 .set noreorder 58 .cpload $ra 59 .set reorder 60 61 move $a0, $sp 62 move $a1, $0 63 la $a2, main 64 la $a3, 1f 65 subu $sp, 32 66 la $t9, __libc_init 67 j $t9 68 .end __start 69 701: .long __PREINIT_ARRAY__ 71 .long __INIT_ARRAY__ 72 .long __FINI_ARRAY__ 73 .long __CTOR_LIST__ 74 .long __DTOR_LIST__ 75 76 .section .preinit_array, "aw" 77 .type __PREINIT_ARRAY__, @object 78 .globl __PREINIT_ARRAY__ 79__PREINIT_ARRAY__: 80 .long -1 81 82 .section .init_array, "aw" 83 .type __INIT_ARRAY__, @object 84 .globl __INIT_ARRAY__ 85__INIT_ARRAY__: 86 .long -1 87 88 .section .fini_array, "aw" 89 .type __FINI_ARRAY__, @object 90 .globl __FINI_ARRAY__ 91__FINI_ARRAY__: 92 .long -1 93 .long __do_global_dtors_aux 94 95 .section .ctors, "aw" 96 .type __CTOR_LIST__, @object 97 .globl __CTOR_LIST__ 98__CTOR_LIST__: 99 .long -1 100 101 .section .dtors, "aw" 102 .type __DTOR_LIST__, @object 103 .globl __DTOR_LIST__ 104__DTOR_LIST__: 105 .long -1 106 107 .abicalls 108 .section .eh_frame,"a",@progbits 109 .align 2 110 .type __EH_FRAME_BEGIN__, @object 111 .size __EH_FRAME_BEGIN__, 0 112__EH_FRAME_BEGIN__: 113 .text 114 .align 2 115 .set nomips16 116 .ent __do_global_dtors_aux 117 .type __do_global_dtors_aux, @function 118__do_global_dtors_aux: 119 .frame $sp,32,$31 # vars= 0, regs= 1/0, args= 16, gp= 8 120 .mask 0x80000000,-4 121 .fmask 0x00000000,0 122 .set noreorder 123 .cpload $25 124 .set nomacro 125 addiu $sp,$sp,-32 126 sw $31,28($sp) 127 .cprestore 16 128 lw $2,%got(completed.1269)($28) 129 lbu $2,%lo(completed.1269)($2) 130 bne $2,$0,$L8 131 nop 132 133$L4: 134 lw $2,%got(__cxa_finalize)($28) 135 beq $2,$0,$L6 136 nop 137 138 lw $2,%got(__dso_handle)($28) 139 lw $4,0($2) 140 lw $25,%call16(__cxa_finalize)($28) 141 .reloc 1f,R_MIPS_JALR,__cxa_finalize 1421: jalr $25 143 nop 144 145 lw $28,16($sp) 146$L6: 147 lw $2,%got(completed.1269)($28) 148 li $3,1 # 0x1 149 sb $3,%lo(completed.1269)($2) 150$L8: 151 lw $31,28($sp) 152 addiu $sp,$sp,32 153 j $31 154 nop 155 156 .set macro 157 .set reorder 158 .end __do_global_dtors_aux 159 .size __do_global_dtors_aux, .-__do_global_dtors_aux 160 .local completed.1269 161 .comm completed.1269,1,1 162 .local object.1265 163 .comm object.1265,24,4 164 .weak __cxa_finalize 165 166.include "__dso_handle.S" 167.include "atexit.S" 168 169