]>
Commit | Line | Data |
---|---|---|
e6eccdb3 | 1 | /* Common VxWorks target definitions for GNU compiler. |
71e45bc2 | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2010, 2012 |
e6eccdb3 | 3 | Free Software Foundation, Inc. |
805e22b2 | 4 | Contributed by Wind River Systems. |
e6eccdb3 | 5 | Rewritten by CodeSourcery, LLC. |
805e22b2 | 6 | |
ba5ab4f7 | 7 | This file is part of GCC. |
805e22b2 | 8 | |
e6eccdb3 | 9 | GCC is free software; you can redistribute it and/or modify it under |
10 | the terms of the GNU General Public License as published by the Free | |
038d1e19 | 11 | Software Foundation; either version 3, or (at your option) any later |
e6eccdb3 | 12 | version. |
805e22b2 | 13 | |
e6eccdb3 | 14 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 | for more details. | |
805e22b2 | 18 | |
19 | You should have received a copy of the GNU General Public License | |
038d1e19 | 20 | along with GCC; see the file COPYING3. If not see |
21 | <http://www.gnu.org/licenses/>. */ | |
805e22b2 | 22 | |
9d75589a | 23 | /* Assert that we are targeting VxWorks. */ |
2baac351 | 24 | #undef TARGET_VXWORKS |
25 | #define TARGET_VXWORKS 1 | |
26 | ||
e6eccdb3 | 27 | /* 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 | |
29 | like a traditional Unix, with more external files. Most of our specs | |
30 | must be aware of the difference. */ | |
805e22b2 | 31 | |
0305c755 | 32 | /* We look for the VxWorks header files using the environment |
33 | variables that are set in VxWorks to indicate the location of the | |
34 | system header files. We use -idirafter so that the GCC's own | |
35 | header-file directories (containing <stddef.h>, etc.) come before | |
36 | the VxWorks system header directories. */ | |
805e22b2 | 37 | |
e6eccdb3 | 38 | /* Since we provide a default -isystem, expand -isystem on the command |
39 | line early. */ | |
40 | #undef VXWORKS_ADDITIONAL_CPP_SPEC | |
f868f9f1 | 41 | #define VXWORKS_ADDITIONAL_CPP_SPEC \ |
42 | "%{!nostdinc: \ | |
43 | %{isystem*} -idirafter \ | |
44 | %{mrtp: %:getenv(WIND_USR /h) \ | |
45 | ;: %:getenv(WIND_BASE /target/h)}}" | |
805e22b2 | 46 | |
c7756fad | 47 | /* The references to __init and __fini will be satisfied by |
e6eccdb3 | 48 | libc_internal.a. */ |
49 | #undef VXWORKS_LIB_SPEC | |
50 | #define VXWORKS_LIB_SPEC \ | |
51 | "%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \ | |
52 | %{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \ | |
53 | --start-group -lc -lgcc -lc_internal -lnet -ldsi \ | |
54 | --end-group}}" | |
805e22b2 | 55 | |
e6eccdb3 | 56 | /* The no-op spec for "-shared" below is present because otherwise GCC |
57 | will treat it as an unrecognized option. */ | |
58 | #undef VXWORKS_LINK_SPEC | |
59 | #define VXWORKS_LINK_SPEC \ | |
60 | "%{!mrtp:-r} \ | |
61 | %{!shared: \ | |
62 | %{mrtp:-q %{h*} \ | |
079c4f5a | 63 | %{R*} %{!T*: %(link_start) } \ |
e6eccdb3 | 64 | %(link_target) %(link_os)}} \ |
6017c98f | 65 | %{v:-v} \ |
e6eccdb3 | 66 | %{shared:-shared} \ |
67 | %{Bstatic:-Bstatic} \ | |
68 | %{Bdynamic:-Bdynamic} \ | |
69 | %{!Xbind-lazy:-z now} \ | |
70 | %{Xbind-now:%{Xbind-lazy: \ | |
71 | %e-Xbind-now and -Xbind-lazy are incompatible}} \ | |
72 | %{mrtp:%{!shared:%{!non-static:-static} \ | |
73 | %{non-static:--force-dynamic --export-dynamic}}}" | |
805e22b2 | 74 | |
e6eccdb3 | 75 | /* For VxWorks, the system provides libc_internal.a. This is a superset |
76 | of libgcc.a; we want to use it. Make sure not to dynamically export | |
77 | any of its symbols, though. Always look for libgcc.a first so that | |
78 | we get the latest versions of the GNU intrinsics during our builds. */ | |
79 | #undef VXWORKS_LIBGCC_SPEC | |
80 | #define VXWORKS_LIBGCC_SPEC \ | |
81 | "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}" | |
805e22b2 | 82 | |
e6eccdb3 | 83 | #undef VXWORKS_STARTFILE_SPEC |
6f3d6768 | 84 | #define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}" |
e6eccdb3 | 85 | #define VXWORKS_ENDFILE_SPEC "" |
805e22b2 | 86 | |
4c834714 | 87 | /* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ |
e6eccdb3 | 88 | #undef VXWORKS_OVERRIDE_OPTIONS |
80fbffcb | 89 | #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options () |
90 | extern void vxworks_override_options (void); | |
805e22b2 | 91 | |
ac03c1db | 92 | /* Only RTPs support prioritized constructors and destructors: |
93 | the implementation relies on numbered .ctors* sections. */ | |
94 | #define SUPPORTS_INIT_PRIORITY TARGET_VXWORKS_RTP | |
95 | ||
6c181a06 | 96 | /* VxWorks requires special handling of constructors and destructors. |
97 | All VxWorks configurations must use these functions. */ | |
bac7fc85 | 98 | #undef TARGET_ASM_CONSTRUCTOR |
6c181a06 | 99 | #define TARGET_ASM_CONSTRUCTOR vxworks_asm_out_constructor |
bac7fc85 | 100 | #undef TARGET_ASM_DESTRUCTOR |
6c181a06 | 101 | #define TARGET_ASM_DESTRUCTOR vxworks_asm_out_destructor |
102 | extern void vxworks_asm_out_constructor (rtx symbol, int priority); | |
103 | extern void vxworks_asm_out_destructor (rtx symbol, int priority); | |
805e22b2 | 104 | |
2522d9ea | 105 | /* Override the vxworks-dummy.h definitions. TARGET_VXWORKS_RTP |
106 | is defined by vxworks.opt. */ | |
107 | #undef VXWORKS_GOTT_BASE | |
e6eccdb3 | 108 | #define VXWORKS_GOTT_BASE "__GOTT_BASE__" |
2522d9ea | 109 | #undef VXWORKS_GOTT_INDEX |
e6eccdb3 | 110 | #define VXWORKS_GOTT_INDEX "__GOTT_INDEX__" |
805e22b2 | 111 | |
ab39d1bf | 112 | #undef PTRDIFF_TYPE |
113 | #define PTRDIFF_TYPE "int" | |
114 | ||
115 | #undef SIZE_TYPE | |
116 | #define SIZE_TYPE "unsigned int" | |
117 | ||
118 | /* Both kernels and RTPs have the facilities required by this macro. */ | |
119 | #define TARGET_POSIX_IO | |
120 | ||
f868f9f1 | 121 | /* A VxWorks implementation of TARGET_OS_CPP_BUILTINS. */ |
122 | #define VXWORKS_OS_CPP_BUILTINS() \ | |
123 | do \ | |
124 | { \ | |
125 | builtin_define ("__vxworks"); \ | |
126 | builtin_define ("__VXWORKS__"); \ | |
127 | builtin_assert ("system=unix"); \ | |
128 | if (TARGET_VXWORKS_RTP) \ | |
129 | builtin_define ("__RTP__"); \ | |
130 | else \ | |
131 | builtin_define ("_WRS_KERNEL"); \ | |
132 | } \ | |
133 | while (0) | |
134 | ||
e6eccdb3 | 135 | #define VXWORKS_KIND VXWORKS_KIND_NORMAL |
6017c98f | 136 | |
137 | /* The diab linker does not handle .gnu_attribute sections. */ | |
138 | #undef HAVE_AS_GNU_ATTRIBUTE |