1 /* $NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $ */
3 * Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <machine/asm.h>
33 RCSID("$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $")
35 .section .ctors, "aw", @progbits
40 .section .dtors, "aw", @progbits
45 .section .eh_frame, "a", @progbits
49 .section .jcr, "aw", @progbits
53 .section .data.rel, "aw", @progbits
55 .type __dso_handle, @object
76 .weak __deregister_frame_info
77 .weak __register_frame_info
78 .weak _Jv_RegisterClasses
80 __do_global_dtors_aux:
81 cmpb $0, __finished(%rip)
86 movb $1, __finished(%rip)
90 cmpq $0, __cxa_finalize@GOTPCREL(%rip)
92 movq __dso_handle(%rip), %rdi
93 call __cxa_finalize@PLT
97 leaq 8+__DTOR_LIST__(%rip), %rbx
107 cmpq $0, __deregister_frame_info@GOTPCREL(%rip)
109 leaq __EH_FRAME_LIST__(%rip), %rdi
110 call __deregister_frame_info@PLT
116 __do_global_ctors_aux:
117 cmpb $0, __initialized(%rip)
122 movb $1, __initialized(%rip)
124 cmpq $0, __register_frame_info@GOTPCREL(%rip)
126 leaq __dwarf_eh_object(%rip), %rsi
127 leaq __EH_FRAME_LIST__(%rip), %rdi
128 call __register_frame_info@PLT
131 cmpq $0, _Jv_RegisterClasses@GOTPCREL(%rip)
133 leaq __JCR_LIST__(%rip), %rdi
136 call _Jv_RegisterClasses@PLT
139 leaq -8+__CTOR_LIST_END__(%rip), %rbx
153 .section .init, "ax", @progbits
154 call __do_global_ctors_aux
155 .section .fini, "ax", @progbits
156 call __do_global_dtors_aux