Home | History | Annotate | Line # | Download | only in x86_64
      1  1.2  joerg /*	$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $	*/
      2  1.1  joerg /*-
      3  1.1  joerg  * Copyright (c) 2010 Joerg Sonnenberger <joerg (at) NetBSD.org>
      4  1.1  joerg  * All rights reserved.
      5  1.1  joerg  *
      6  1.1  joerg  * Redistribution and use in source and binary forms, with or without
      7  1.1  joerg  * modification, are permitted provided that the following conditions
      8  1.1  joerg  * are met:
      9  1.1  joerg  *
     10  1.1  joerg  * 1. Redistributions of source code must retain the above copyright
     11  1.1  joerg  *    notice, this list of conditions and the following disclaimer.
     12  1.1  joerg  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  joerg  *    notice, this list of conditions and the following disclaimer in
     14  1.1  joerg  *    the documentation and/or other materials provided with the
     15  1.1  joerg  *    distribution.
     16  1.1  joerg  *
     17  1.1  joerg  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     18  1.1  joerg  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     19  1.1  joerg  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     20  1.1  joerg  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
     21  1.1  joerg  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     22  1.1  joerg  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
     23  1.1  joerg  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24  1.1  joerg  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     25  1.1  joerg  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     26  1.1  joerg  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     27  1.1  joerg  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28  1.1  joerg  * SUCH DAMAGE.
     29  1.1  joerg  */
     30  1.1  joerg 
     31  1.1  joerg #include <machine/asm.h>
     32  1.1  joerg 
     33  1.2  joerg RCSID("$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $")
     34  1.1  joerg 
     35  1.1  joerg 	.section	.ctors, "aw", @progbits
     36  1.1  joerg 	.align 8
     37  1.1  joerg __CTOR_LIST__:
     38  1.1  joerg 	.quad -1
     39  1.1  joerg 
     40  1.1  joerg 	.section	.dtors, "aw", @progbits
     41  1.1  joerg 	.align 8
     42  1.1  joerg __DTOR_LIST__:
     43  1.1  joerg 	.quad -1
     44  1.1  joerg 
     45  1.1  joerg 	.section	.eh_frame, "a", @progbits
     46  1.1  joerg 	.align 8
     47  1.1  joerg __EH_FRAME_LIST__:
     48  1.1  joerg 
     49  1.1  joerg 	.section	.jcr, "aw", @progbits
     50  1.1  joerg 	.align 8
     51  1.1  joerg __JCR_LIST__:
     52  1.1  joerg 
     53  1.1  joerg 	.section	.data.rel, "aw", @progbits
     54  1.1  joerg 	.align 8
     55  1.1  joerg 	.type	__dso_handle, @object
     56  1.1  joerg 	.size	__dso_handle, 8
     57  1.1  joerg 	.globl	__dso_handle
     58  1.1  joerg 	.hidden	__dso_handle
     59  1.1  joerg __dso_handle:
     60  1.1  joerg #ifdef SHARED
     61  1.1  joerg 	.quad	__dso_handle
     62  1.1  joerg #else
     63  1.1  joerg 	.quad	0
     64  1.1  joerg #endif
     65  1.1  joerg 
     66  1.1  joerg __dwarf_eh_object:
     67  1.1  joerg 	.zero	64
     68  1.1  joerg 
     69  1.1  joerg __initialized:
     70  1.1  joerg 	.zero	1
     71  1.1  joerg __finished:
     72  1.1  joerg 	.zero	1
     73  1.1  joerg 
     74  1.1  joerg 	.text
     75  1.1  joerg 	.weak	__cxa_finalize
     76  1.1  joerg 	.weak	__deregister_frame_info
     77  1.1  joerg 	.weak	__register_frame_info
     78  1.1  joerg 	.weak	_Jv_RegisterClasses
     79  1.1  joerg 
     80  1.1  joerg __do_global_dtors_aux:
     81  1.1  joerg 	cmpb	$0, __finished(%rip)
     82  1.1  joerg 	je	1f
     83  1.1  joerg 	ret
     84  1.1  joerg 1:
     85  1.2  joerg 	pushq	%rbx
     86  1.1  joerg 	movb	$1, __finished(%rip)
     87  1.1  joerg 
     88  1.1  joerg 
     89  1.1  joerg #ifdef SHARED
     90  1.1  joerg 	cmpq	$0, __cxa_finalize@GOTPCREL(%rip)
     91  1.1  joerg 	je	2f
     92  1.1  joerg 	movq	__dso_handle(%rip), %rdi
     93  1.1  joerg 	call	__cxa_finalize@PLT
     94  1.1  joerg 2:
     95  1.1  joerg #endif
     96  1.1  joerg 
     97  1.1  joerg 	leaq	8+__DTOR_LIST__(%rip), %rbx
     98  1.1  joerg 3:
     99  1.1  joerg 	movq	(%rbx), %rax
    100  1.1  joerg 	testq	%rax, %rax
    101  1.1  joerg 	je	4f
    102  1.1  joerg 	call	*%rax
    103  1.1  joerg 	addq	$8, %rbx
    104  1.1  joerg 	jmp	3b
    105  1.1  joerg 4:
    106  1.1  joerg 
    107  1.1  joerg 	cmpq	$0, __deregister_frame_info@GOTPCREL(%rip)
    108  1.1  joerg 	je	5f
    109  1.1  joerg 	leaq	__EH_FRAME_LIST__(%rip), %rdi
    110  1.1  joerg 	call	__deregister_frame_info@PLT
    111  1.1  joerg 5:
    112  1.2  joerg 	popq	%rbx
    113  1.1  joerg 	ret
    114  1.1  joerg 
    115  1.1  joerg 
    116  1.1  joerg __do_global_ctors_aux:
    117  1.1  joerg 	cmpb	$0, __initialized(%rip)
    118  1.1  joerg 	je	1f
    119  1.1  joerg 	ret
    120  1.1  joerg 1:
    121  1.2  joerg 	pushq	%rbx
    122  1.1  joerg 	movb	$1, __initialized(%rip)
    123  1.1  joerg 
    124  1.1  joerg 	cmpq	$0, __register_frame_info@GOTPCREL(%rip)
    125  1.1  joerg 	je	2f
    126  1.1  joerg 	leaq	__dwarf_eh_object(%rip), %rsi
    127  1.1  joerg 	leaq	__EH_FRAME_LIST__(%rip), %rdi
    128  1.1  joerg 	call	__register_frame_info@PLT
    129  1.1  joerg 
    130  1.1  joerg 2:
    131  1.1  joerg 	cmpq	$0, _Jv_RegisterClasses@GOTPCREL(%rip)
    132  1.1  joerg 	je	3f
    133  1.1  joerg 	leaq	__JCR_LIST__(%rip), %rdi
    134  1.1  joerg 	cmpq	$0, (%rdi)
    135  1.1  joerg 	je 	3f
    136  1.1  joerg 	call	_Jv_RegisterClasses@PLT
    137  1.1  joerg 3:
    138  1.1  joerg 
    139  1.1  joerg 	leaq	-8+__CTOR_LIST_END__(%rip), %rbx
    140  1.1  joerg 4:
    141  1.1  joerg 	movq	(%rbx), %rax
    142  1.1  joerg 	cmpq	$-1, %rax
    143  1.1  joerg 	je	5f
    144  1.1  joerg 	call	*%rax
    145  1.1  joerg 	subq	$8, %rbx
    146  1.1  joerg 	jmp	4b
    147  1.1  joerg 
    148  1.1  joerg 5:
    149  1.1  joerg 	popq	%rbx
    150  1.1  joerg 
    151  1.1  joerg 	ret
    152  1.1  joerg 
    153  1.1  joerg 	.section	.init, "ax", @progbits
    154  1.1  joerg 	call	__do_global_ctors_aux
    155  1.1  joerg 	.section	.fini, "ax", @progbits
    156  1.1  joerg 	call	__do_global_dtors_aux
    157