]>
Commit | Line | Data |
---|---|---|
cc7232b9 | 1 | /* Declarations for C-SKY targets running Linux. |
a5544970 | 2 | Copyright (C) 2018-2019 Free Software Foundation, Inc. |
cc7232b9 J |
3 | Contributed by C-SKY Microsystems and Mentor Graphics. |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU General Public License as published | |
9 | by the Free Software Foundation; either version 3, or (at your | |
10 | option) any later version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
15 | License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GCC; see the file COPYING3. If not see | |
19 | <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | /****************************************************************** | |
22 | * Run-time Target Specification * | |
23 | ******************************************************************/ | |
24 | ||
25 | #undef STARTFILE_SPEC | |
26 | #define STARTFILE_SPEC \ | |
27 | "%{!shared: %{pie:Scrt1.o%s;:crt1.o%s}} \ | |
28 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" | |
29 | ||
30 | #undef ENDFILE_SPEC | |
31 | #define ENDFILE_SPEC \ | |
32 | "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" | |
33 | ||
34 | #undef CC1_SPEC | |
35 | #define CC1_SPEC \ | |
36 | "%{EB:-EB} \ | |
37 | %{EL:-EL} \ | |
6d6fbec5 | 38 | %{profile:-p} \ |
cc7232b9 J |
39 | " |
40 | ||
41 | #undef ASM_SPEC | |
42 | #define ASM_SPEC \ | |
43 | "%{mbig-endian:-mbig-endian} \ | |
44 | %{EB:-EB} \ | |
45 | %{EL:-EL} \ | |
46 | %{fpic|fPIC:-pic} \ | |
47 | %{mcpu=*:-mcpu=%*} \ | |
48 | %{march=*:-march=%*} \ | |
49 | %{mhard-float:-mhard-float} \ | |
50 | %{melrw:-melrw} \ | |
51 | %{mno-elrw:-mno-elrw} \ | |
52 | %{mistack:-mistack} \ | |
53 | %{mno-istack:-mno-istack} \ | |
54 | %{mmp:-mmp} \ | |
55 | %{mcp:-mcp} \ | |
56 | %{mcache:-mcache} \ | |
57 | %{msecurity|mmac:-msecurity} \ | |
58 | %{mtrust:-mtrust} \ | |
59 | %{mdsp:-mdsp} \ | |
60 | %{medsp:-medsp} \ | |
61 | %{mvdsp:-mvdsp} \ | |
62 | " | |
63 | ||
28209372 | 64 | #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mhard-float:-hf}%{mbig-endian:-be}.so.1" |
cc7232b9 J |
65 | |
66 | #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ | |
67 | %{b} \ | |
68 | %{static:-Bstatic} \ | |
69 | %{shared:-shared} \ | |
70 | %{symbolic:-Bsymbolic} \ | |
71 | %{!static: \ | |
72 | %{rdynamic:-export-dynamic} \ | |
28209372 | 73 | %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ |
cc7232b9 J |
74 | -X \ |
75 | %{mbig-endian:-EB} %{mlittle-endian:-EL} \ | |
76 | %{EB:-EB} %{EL:-EL}" | |
77 | ||
78 | ||
79 | #undef LINK_SPEC | |
80 | #define LINK_SPEC LINUX_TARGET_LINK_SPEC | |
81 | ||
82 | ||
83 | #undef LIB_SPEC | |
84 | #define LIB_SPEC \ | |
85 | "%{pthread:-lpthread} -lc %{mccrt:-lcc-rt}" | |
86 | /* FIXME add this to LIB_SPEC when need */ | |
87 | /* %{!shared:%{profile:-lc_p}%{!profile:-lc}}" */ | |
88 | ||
89 | #define TARGET_OS_CPP_BUILTINS() \ | |
90 | do \ | |
91 | { \ | |
92 | GNU_USER_TARGET_OS_CPP_BUILTINS (); \ | |
93 | } \ | |
94 | while (0) | |
95 | ||
96 | /* In crtstuff.c to control section in where code resides. | |
97 | We have to write it as asm code. */ | |
98 | #ifdef __PIC__ | |
99 | #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ | |
100 | asm (SECTION_OP "\n" \ | |
101 | "\tgrs\tr3, .Lgetpc_"#FUNC"\n\t" \ | |
102 | ".Lgetpc_"#FUNC":\n\t" \ | |
103 | "\tlrw\tr2,\t.Lgetpc_"#FUNC"@GOTPC\n\t" \ | |
104 | "\taddu\tr3, r2\n\t" \ | |
105 | "\tlrw\tr2, "#FUNC"@GOTOFF\n\t" \ | |
106 | "\taddu\tr2, r3\n\t" \ | |
107 | "\tjsr\tr2\n\t"); \ | |
108 | FORCE_CODE_SECTION_ALIGN \ | |
109 | asm (TEXT_SECTION_ASM_OP); | |
110 | #endif | |
111 | ||
112 | #undef CPP_SPEC | |
113 | #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" | |
114 | ||
115 | #undef FUNCTION_PROFILER | |
116 | #define SAVE_LR \ | |
117 | "push\tlr" | |
118 | #define FUNCTION_PROFILER(file, labelno) \ | |
119 | fprintf (file, "\t%s\n\tjbsr\t_mcount\n", SAVE_LR); | |
120 | #define NO_PROFILE_COUNTERS 1 | |
121 | ||
122 | /* Enable features only for Linux toolchains. */ | |
123 | #define TARGET_CSKY_LINUX 1 | |
124 | ||
125 | /* Clear the instruction cache from `BEG' to `END'. */ | |
126 | #define CLEAR_INSN_CACHE(BEG, END) \ | |
127 | cacheflush (BEG, END-BEG, 3) | |
128 | ||
129 | /* For __clear_cache in libgcc2.c. The declaration is copied from | |
130 | <sys/cachectl.h>. */ | |
131 | #ifdef IN_LIBGCC2 | |
132 | extern int cacheflush (void *__addr, const int __nbytes, const int __op); | |
133 | #endif |