1 |
709 |
jeremybenn |
/* Common VxWorks target definitions for GNU compiler.
|
2 |
|
|
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2010
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Wind River Systems.
|
5 |
|
|
Rewritten by CodeSourcery, LLC.
|
6 |
|
|
|
7 |
|
|
This file is part of GCC.
|
8 |
|
|
|
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
|
11 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
12 |
|
|
version.
|
13 |
|
|
|
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.
|
18 |
|
|
|
19 |
|
|
You should have received a copy of the GNU General Public License
|
20 |
|
|
along with GCC; see the file COPYING3. If not see
|
21 |
|
|
<http://www.gnu.org/licenses/>. */
|
22 |
|
|
|
23 |
|
|
/* Assert that we are targetting VxWorks. */
|
24 |
|
|
#undef TARGET_VXWORKS
|
25 |
|
|
#define TARGET_VXWORKS 1
|
26 |
|
|
|
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. */
|
31 |
|
|
|
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. */
|
37 |
|
|
|
38 |
|
|
/* Since we provide a default -isystem, expand -isystem on the command
|
39 |
|
|
line early. */
|
40 |
|
|
#undef VXWORKS_ADDITIONAL_CPP_SPEC
|
41 |
|
|
#define VXWORKS_ADDITIONAL_CPP_SPEC \
|
42 |
|
|
"%{!nostdinc: \
|
43 |
|
|
%{isystem*} -idirafter \
|
44 |
|
|
%{mrtp: %:getenv(WIND_USR /h) \
|
45 |
|
|
;: %:getenv(WIND_BASE /target/h)}}"
|
46 |
|
|
|
47 |
|
|
/* The references to __init and __fini will be satisfied by
|
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}}"
|
55 |
|
|
|
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*} \
|
63 |
|
|
%{R*} %{!T*: %(link_start) } \
|
64 |
|
|
%(link_target) %(link_os)}} \
|
65 |
|
|
%{v:-v} \
|
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}}}"
|
74 |
|
|
|
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}"
|
82 |
|
|
|
83 |
|
|
#undef VXWORKS_STARTFILE_SPEC
|
84 |
|
|
#define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}"
|
85 |
|
|
#define VXWORKS_ENDFILE_SPEC ""
|
86 |
|
|
|
87 |
|
|
/* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */
|
88 |
|
|
#undef VXWORKS_OVERRIDE_OPTIONS
|
89 |
|
|
#define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options ()
|
90 |
|
|
extern void vxworks_override_options (void);
|
91 |
|
|
|
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 |
|
|
|
96 |
|
|
/* VxWorks requires special handling of constructors and destructors.
|
97 |
|
|
All VxWorks configurations must use these functions. */
|
98 |
|
|
#undef TARGET_ASM_CONSTRUCTOR
|
99 |
|
|
#define TARGET_ASM_CONSTRUCTOR vxworks_asm_out_constructor
|
100 |
|
|
#undef TARGET_ASM_DESTRUCTOR
|
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);
|
104 |
|
|
|
105 |
|
|
/* Override the vxworks-dummy.h definitions. TARGET_VXWORKS_RTP
|
106 |
|
|
is defined by vxworks.opt. */
|
107 |
|
|
#undef VXWORKS_GOTT_BASE
|
108 |
|
|
#define VXWORKS_GOTT_BASE "__GOTT_BASE__"
|
109 |
|
|
#undef VXWORKS_GOTT_INDEX
|
110 |
|
|
#define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
|
111 |
|
|
|
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 |
|
|
|
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 |
|
|
|
135 |
|
|
#define VXWORKS_KIND VXWORKS_KIND_NORMAL
|
136 |
|
|
|
137 |
|
|
/* The diab linker does not handle .gnu_attribute sections. */
|
138 |
|
|
#undef HAVE_AS_GNU_ATTRIBUTE
|