Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/vxworks.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Common VxWorks target definitions for GNU compiler. | 1 /* Common VxWorks target definitions for GNU compiler. |
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2010 | 2 Copyright (C) 1999-2017 Free Software Foundation, Inc. |
3 Free Software Foundation, Inc. | |
4 Contributed by Wind River Systems. | 3 Contributed by Wind River Systems. |
5 Rewritten by CodeSourcery, LLC. | 4 Rewritten by CodeSourcery, LLC. |
6 | 5 |
7 This file is part of GCC. | 6 This file is part of GCC. |
8 | 7 |
18 | 17 |
19 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
20 along with GCC; see the file COPYING3. If not see | 19 along with GCC; see the file COPYING3. If not see |
21 <http://www.gnu.org/licenses/>. */ | 20 <http://www.gnu.org/licenses/>. */ |
22 | 21 |
23 /* Assert that we are targetting VxWorks. */ | 22 /* Assert that we are targeting VxWorks. */ |
24 #undef TARGET_VXWORKS | 23 #undef TARGET_VXWORKS |
25 #define TARGET_VXWORKS 1 | 24 #define TARGET_VXWORKS 1 |
25 | |
26 /* If TARGET_VXWORKS7 is undefined, then we're not targeting it. */ | |
27 #ifndef TARGET_VXWORKS7 | |
28 #define TARGET_VXWORKS7 0 | |
29 #endif | |
26 | 30 |
27 /* In kernel mode, VxWorks provides all the libraries itself, as well as | 31 /* In kernel mode, VxWorks provides all the libraries itself, as well as |
28 the functionality of startup files, etc. In RTP mode, it behaves more | 32 the functionality of startup files, etc. In RTP mode, it behaves more |
29 like a traditional Unix, with more external files. Most of our specs | 33 like a traditional Unix, with more external files. Most of our specs |
30 must be aware of the difference. */ | 34 must be aware of the difference. */ |
35 header-file directories (containing <stddef.h>, etc.) come before | 39 header-file directories (containing <stddef.h>, etc.) come before |
36 the VxWorks system header directories. */ | 40 the VxWorks system header directories. */ |
37 | 41 |
38 /* Since we provide a default -isystem, expand -isystem on the command | 42 /* Since we provide a default -isystem, expand -isystem on the command |
39 line early. */ | 43 line early. */ |
44 #if TARGET_VXWORKS7 | |
45 | |
46 #undef VXWORKS_ADDITIONAL_CPP_SPEC | |
47 #define VXWORKS_ADDITIONAL_CPP_SPEC \ | |
48 "%{!nostdinc: \ | |
49 %{isystem*} \ | |
50 %{mrtp: -idirafter %:getenv(VSB_DIR /h) \ | |
51 -idirafter %:getenv(VSB_DIR /share/h) \ | |
52 -idirafter %:getenv(VSB_DIR /usr/h/public) \ | |
53 -idirafter %:getenv(VSB_DIR /usr/h) \ | |
54 ;: -idirafter %:getenv(VSB_DIR /h) \ | |
55 -idirafter %:getenv(VSB_DIR /share/h) \ | |
56 -idirafter %:getenv(VSB_DIR /krnl/h/system) \ | |
57 -idirafter %:getenv(VSB_DIR /krnl/h/public)}}" | |
58 | |
59 #else /* TARGET_VXWORKS7 */ | |
60 | |
40 #undef VXWORKS_ADDITIONAL_CPP_SPEC | 61 #undef VXWORKS_ADDITIONAL_CPP_SPEC |
41 #define VXWORKS_ADDITIONAL_CPP_SPEC \ | 62 #define VXWORKS_ADDITIONAL_CPP_SPEC \ |
42 "%{!nostdinc: \ | 63 "%{!nostdinc: \ |
43 %{isystem*} -idirafter \ | 64 %{isystem*} -idirafter \ |
44 %{mrtp: %:getenv(WIND_USR /h) \ | 65 %{mrtp: %:getenv(WIND_USR /h) \ |
45 ;: %:getenv(WIND_BASE /target/h)}}" | 66 ;: %:getenv(WIND_BASE /target/h)}}" |
46 | 67 |
68 #endif | |
69 | |
47 /* The references to __init and __fini will be satisfied by | 70 /* The references to __init and __fini will be satisfied by |
48 libc_internal.a. */ | 71 libc_internal.a, and some versions of VxWorks rely on explicit |
72 extra libraries for system calls. */ | |
73 | |
74 #define VXWORKS_SYSCALL_LIBS_RTP | |
75 | |
76 #define VXWORKS_LIBS_RTP \ | |
77 VXWORKS_SYSCALL_LIBS_RTP " -lc -lgcc -lc_internal -lnet -ldsi" | |
78 | |
79 /* On Vx6 and previous, the libraries to pick up depends on the architecture, | |
80 so cannot be defined for all archs at once. On Vx7, a VSB is always needed | |
81 and its structure is fixed and does not depend on the arch. We can thus | |
82 tell gcc where to look for when linking with RTP libraries. */ | |
83 | |
84 /* On Vx7 RTP, we need to drag the __tls__ symbol to trigger initialization of | |
85 tlsLib, responsible for TLS support by the OS. */ | |
86 | |
87 #if TARGET_VXWORKS7 | |
88 #define VXWORKS_LIBS_DIR_RTP "-L%:getenv(VSB_DIR /usr/lib/common)" | |
89 #define TLS_SYM "-u __tls__" | |
90 #else | |
91 #define VXWORKS_LIBS_DIR_RTP "" | |
92 #define TLS_SYM "" | |
93 #endif | |
94 | |
49 #undef VXWORKS_LIB_SPEC | 95 #undef VXWORKS_LIB_SPEC |
50 #define VXWORKS_LIB_SPEC \ | 96 #define VXWORKS_LIB_SPEC \ |
51 "%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \ | 97 "%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \ |
52 %{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \ | 98 %{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \ |
53 --start-group -lc -lgcc -lc_internal -lnet -ldsi \ | 99 " TLS_SYM " \ |
54 --end-group}}" | 100 --start-group " VXWORKS_LIBS_RTP " --end-group} \ |
101 " VXWORKS_LIBS_DIR_RTP "}" | |
55 | 102 |
56 /* The no-op spec for "-shared" below is present because otherwise GCC | 103 /* The no-op spec for "-shared" below is present because otherwise GCC |
57 will treat it as an unrecognized option. */ | 104 will treat it as an unrecognized option. */ |
58 #undef VXWORKS_LINK_SPEC | 105 #undef VXWORKS_LINK_SPEC |
59 #define VXWORKS_LINK_SPEC \ | 106 #define VXWORKS_LINK_SPEC \ |
70 %{Xbind-now:%{Xbind-lazy: \ | 117 %{Xbind-now:%{Xbind-lazy: \ |
71 %e-Xbind-now and -Xbind-lazy are incompatible}} \ | 118 %e-Xbind-now and -Xbind-lazy are incompatible}} \ |
72 %{mrtp:%{!shared:%{!non-static:-static} \ | 119 %{mrtp:%{!shared:%{!non-static:-static} \ |
73 %{non-static:--force-dynamic --export-dynamic}}}" | 120 %{non-static:--force-dynamic --export-dynamic}}}" |
74 | 121 |
75 /* For VxWorks, the system provides libc_internal.a. This is a superset | 122 /* For VxWorks static rtps, the system provides libc_internal.a, a superset |
76 of libgcc.a; we want to use it. Make sure not to dynamically export | 123 of libgcc.a that we want to use. Make sure not to dynamically export any |
77 any of its symbols, though. Always look for libgcc.a first so that | 124 of its symbols, though, and always look for libgcc.a first so that we get |
78 we get the latest versions of the GNU intrinsics during our builds. */ | 125 the latest versions of the GNU intrinsics during our builds. */ |
79 #undef VXWORKS_LIBGCC_SPEC | 126 #undef VXWORKS_LIBGCC_SPEC |
80 #define VXWORKS_LIBGCC_SPEC \ | 127 #define VXWORKS_LIBGCC_SPEC \ |
81 "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}" | 128 "-lgcc %{mrtp:%{!shared:--exclude-libs=libc_internal,libgcc -lc_internal}}" |
82 | 129 |
83 #undef VXWORKS_STARTFILE_SPEC | 130 #undef VXWORKS_STARTFILE_SPEC |
84 #define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}" | 131 #define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}" |
85 #define VXWORKS_ENDFILE_SPEC "" | 132 #define VXWORKS_ENDFILE_SPEC "" |
86 | 133 |
87 /* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ | 134 /* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ |
135 | |
136 #define VXWORKS_HAVE_TLS (TARGET_VXWORKS7 && TARGET_VXWORKS_RTP) | |
137 | |
88 #undef VXWORKS_OVERRIDE_OPTIONS | 138 #undef VXWORKS_OVERRIDE_OPTIONS |
89 #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options () | 139 #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options () |
90 extern void vxworks_override_options (void); | 140 extern void vxworks_override_options (void); |
91 | 141 |
92 /* Only RTPs support prioritized constructors and destructors: | 142 /* Only RTPs support prioritized constructors and destructors: |
112 #undef PTRDIFF_TYPE | 162 #undef PTRDIFF_TYPE |
113 #define PTRDIFF_TYPE "int" | 163 #define PTRDIFF_TYPE "int" |
114 | 164 |
115 #undef SIZE_TYPE | 165 #undef SIZE_TYPE |
116 #define SIZE_TYPE "unsigned int" | 166 #define SIZE_TYPE "unsigned int" |
167 | |
168 #undef TARGET_LIBC_HAS_FUNCTION | |
169 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function | |
117 | 170 |
118 /* Both kernels and RTPs have the facilities required by this macro. */ | 171 /* Both kernels and RTPs have the facilities required by this macro. */ |
119 #define TARGET_POSIX_IO | 172 #define TARGET_POSIX_IO |
120 | 173 |
121 /* A VxWorks implementation of TARGET_OS_CPP_BUILTINS. */ | 174 /* A VxWorks implementation of TARGET_OS_CPP_BUILTINS. */ |
127 builtin_assert ("system=unix"); \ | 180 builtin_assert ("system=unix"); \ |
128 if (TARGET_VXWORKS_RTP) \ | 181 if (TARGET_VXWORKS_RTP) \ |
129 builtin_define ("__RTP__"); \ | 182 builtin_define ("__RTP__"); \ |
130 else \ | 183 else \ |
131 builtin_define ("_WRS_KERNEL"); \ | 184 builtin_define ("_WRS_KERNEL"); \ |
185 builtin_define ("_VX_TOOL_FAMILY=gnu"); \ | |
186 builtin_define ("_VX_TOOL=gnu"); \ | |
187 if (TARGET_VXWORKS7) \ | |
188 { \ | |
189 builtin_define ("_VSB_CONFIG_FILE=<config/vsbConfig.h>"); \ | |
190 \ | |
191 /* _ALLOW_KEYWORD_MACROS is needed on VxWorks 7 to \ | |
192 prevent compilation failures triggered by our \ | |
193 definition of "inline" in ansidecl when "inline" \ | |
194 is not a keyword. */ \ | |
195 if (!flag_isoc99 && !c_dialect_cxx()) \ | |
196 builtin_define ("_ALLOW_KEYWORD_MACROS"); \ | |
197 } \ | |
132 } \ | 198 } \ |
133 while (0) | 199 while (0) |
134 | 200 |
135 #define VXWORKS_KIND VXWORKS_KIND_NORMAL | 201 #define VXWORKS_KIND VXWORKS_KIND_NORMAL |
136 | 202 |