xref: /freebsd/lib/csu/powerpc64/crti.S (revision 734e82fe33aa764367791a7d603b383996c6b40b)
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#ifdef _CALL_ELF
28.abiversion _CALL_ELF
29#endif
30
31	.section .init,"ax",@progbits
32	.p2align	2
33	.globl	_init
34#if !defined(_CALL_ELF) || _CALL_ELF == 1
35	.section ".opd","aw"
36	.p2align	3
37_init:
38	.quad	.L._init,.TOC.@tocbase,0
39	.previous
40	.type	_init,@function
41
42	.p2align 4
43.L._init:
44#else
45	.p2align 4
46	.globl	_init
47	.type	_init,@function
48_init:
49	addis	%r2, %r12, (.TOC.-_init)@ha
50	addi	%r2, %r2, (.TOC.-_init)@l
51	.localentry _init, .-_init
52#endif
53	stdu 1,-48(1)
54	mflr 0
55	std 0,64(1)
56
57/* Fini */
58	.section .fini,"ax",@progbits
59	.p2align	2
60	.globl	_fini
61#if !defined(_CALL_ELF) || _CALL_ELF == 1
62	.section ".opd","aw"
63	.p2align	3
64_fini:
65	.quad	.L._fini,.TOC.@tocbase,0
66	.previous
67	.type	_fini,@function
68
69	.p2align 4
70.L._fini:
71#else
72	.p2align 4
73	.globl	_fini
74	.type	_fini,@function
75_fini:
76	addis	%r2, %r12, (.TOC.-_fini)@ha
77	addi	%r2, %r2, (.TOC.-_fini)@l
78	.localentry _fini, .-_fini
79#endif
80	stdu 1,-48(1)
81	mflr 0
82	std 0,64(1)
83
84	.section .note.GNU-stack,"",%progbits
85