xref: /freebsd/lib/csu/powerpc64/crti.S (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1/*-
2 * Copyright 2001 David E. O'Brien
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 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <machine/asm.h>
27__FBSDID("$FreeBSD$");
28
29#ifdef _CALL_ELF
30.abiversion _CALL_ELF
31#endif
32
33	.section .init,"ax",@progbits
34	.p2align	2
35	.globl	_init
36#if !defined(_CALL_ELF) || _CALL_ELF == 1
37	.section ".opd","aw"
38	.p2align	3
39_init:
40	.quad	.L._init,.TOC.@tocbase,0
41	.previous
42	.type	_init,@function
43
44	.p2align 4
45.L._init:
46#else
47	.p2align 4
48	.globl	_init
49	.type	_init,@function
50_init:
51	addis	%r2, %r12, (.TOC.-_init)@ha
52	addi	%r2, %r2, (.TOC.-_init)@l
53	.localentry _init, .-_init
54#endif
55	stdu 1,-48(1)
56	mflr 0
57	std 0,64(1)
58
59/* Fini */
60	.section .fini,"ax",@progbits
61	.p2align	2
62	.globl	_fini
63#if !defined(_CALL_ELF) || _CALL_ELF == 1
64	.section ".opd","aw"
65	.p2align	3
66_fini:
67	.quad	.L._fini,.TOC.@tocbase,0
68	.previous
69	.type	_fini,@function
70
71	.p2align 4
72.L._fini:
73#else
74	.p2align 4
75	.globl	_fini
76	.type	_fini,@function
77_fini:
78	addis	%r2, %r12, (.TOC.-_fini)@ha
79	addi	%r2, %r2, (.TOC.-_fini)@l
80	.localentry _fini, .-_fini
81#endif
82	stdu 1,-48(1)
83	mflr 0
84	std 0,64(1)
85
86	.section .note.GNU-stack,"",%progbits
87