]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/csu/mips/crt.h
MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, r339912...
[FreeBSD/FreeBSD.git] / lib / csu / mips / crt.h
1 /*-
2  * SPDX-License-Identifier: BSD-1-Clause
3  *
4  * Copyright 2018 Andrew Turner
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22  *
23  * $FreeBSD$
24  */
25
26 #ifndef _CRT_H_
27 #define _CRT_H_
28
29 #define HAVE_CTORS
30 #define CTORS_CONSTRUCTORS
31 #ifdef __mips_o32
32 #define INIT_CALL_SEQ(func)                                             \
33     ".set noreorder             \n"                                     \
34     "bal        1f              \n"                                     \
35     "nop                        \n"                                     \
36     "1:                         \n"                                     \
37     ".cpload $ra                \n"                                     \
38     ".set reorder               \n"                                     \
39     ".local     " __STRING(func) "\n"                                   \
40     "jal        " __STRING(func)
41 #else
42 #define INIT_CALL_SEQ(func)                                             \
43     ".set noreorder             \n"                                     \
44     "bal        1f              \n"                                     \
45     "nop                        \n"                                     \
46     "1:                         \n"                                     \
47     ".set reorder               \n"                                     \
48     ".cpsetup $ra, $v0, 1b      \n"                                     \
49     ".local     " __STRING(func) "\n"                                   \
50     "jal        " __STRING(func)
51 #endif
52
53 #endif