OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / vxworks.h
1 /* Common VxWorks target definitions for GNU compiler.
2    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
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 2, 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 COPYING.  If not, write to the Free
21 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
22 02110-1301, USA.  */
23
24 /* In kernel mode, VxWorks provides all the libraries itself, as well as
25    the functionality of startup files, etc.  In RTP mode, it behaves more
26    like a traditional Unix, with more external files.  Most of our specs
27    must be aware of the difference.  */
28
29 /* We look for the VxWorks header files using the environment
30    variables that are set in VxWorks to indicate the location of the
31    system header files.  We use -idirafter so that the GCC's own
32    header-file directories (containing <stddef.h>, etc.) come before
33    the VxWorks system header directories.  */
34
35 /* Since we provide a default -isystem, expand -isystem on the command
36    line early.  */
37 #undef VXWORKS_ADDITIONAL_CPP_SPEC
38 #define VXWORKS_ADDITIONAL_CPP_SPEC             \
39  "%{!nostdinc:                                  \
40     %{isystem*} -idirafter                      \
41     %{mrtp: %:getenv(WIND_USR /h)               \
42       ;:    %:getenv(WIND_BASE /target/h)}}"
43
44 /* The references to __init and __fini will be satisfied by
45    libc_internal.a.  */
46 #undef VXWORKS_LIB_SPEC
47 #define VXWORKS_LIB_SPEC                                                \
48 "%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \
49         %{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \
50                   --start-group -lc -lgcc -lc_internal -lnet -ldsi      \
51                   --end-group}}"
52
53 /* The no-op spec for "-shared" below is present because otherwise GCC
54    will treat it as an unrecognized option.  */
55 #undef VXWORKS_LINK_SPEC
56 #define VXWORKS_LINK_SPEC                               \
57 "%{!mrtp:-r}                                            \
58  %{!shared:                                             \
59    %{mrtp:-q %{h*}                                      \
60           %{R*} %{!Wl,-T*: %{!T*: %(link_start) }}      \
61           %(link_target) %(link_os)}}                   \
62  %{v:-V}                                                \
63  %{shared:-shared}                                      \
64  %{Bstatic:-Bstatic}                                    \
65  %{Bdynamic:-Bdynamic}                                  \
66  %{!Xbind-lazy:-z now}                                  \
67  %{Xbind-now:%{Xbind-lazy:                              \
68    %e-Xbind-now and -Xbind-lazy are incompatible}}      \
69  %{mrtp:%{!shared:%{!non-static:-static}                \
70                   %{non-static:--force-dynamic --export-dynamic}}}"
71
72 /* For VxWorks, the system provides libc_internal.a.  This is a superset
73    of libgcc.a; we want to use it.  Make sure not to dynamically export
74    any of its symbols, though.  Always look for libgcc.a first so that
75    we get the latest versions of the GNU intrinsics during our builds.  */
76 #undef VXWORKS_LIBGCC_SPEC
77 #define VXWORKS_LIBGCC_SPEC \
78   "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}"
79
80 #undef VXWORKS_STARTFILE_SPEC
81 #define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}"
82 #define VXWORKS_ENDFILE_SPEC ""
83
84 /* Do VxWorks-specific parts of OVERRIDE_OPTIONS.  */
85 #undef VXWORKS_OVERRIDE_OPTIONS
86 #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options ()
87 extern void vxworks_override_options (void);
88
89 /* Only RTPs support prioritized constructors and destructors:
90    the implementation relies on numbered .ctors* sections.  */
91 #define SUPPORTS_INIT_PRIORITY TARGET_VXWORKS_RTP
92
93 /* VxWorks requires special handling of constructors and destructors.
94    All VxWorks configurations must use these functions.  */
95 #undef TARGET_ASM_CONSTRUCTOR
96 #define TARGET_ASM_CONSTRUCTOR vxworks_asm_out_constructor
97 #undef TARGET_ASM_DESTRUCTOR
98 #define TARGET_ASM_DESTRUCTOR vxworks_asm_out_destructor
99 extern void vxworks_asm_out_constructor (rtx symbol, int priority);
100 extern void vxworks_asm_out_destructor (rtx symbol, int priority);
101
102 /* Override the vxworks-dummy.h definitions.  TARGET_VXWORKS_RTP
103    is defined by vxworks.opt.  */
104 #undef VXWORKS_GOTT_BASE
105 #define VXWORKS_GOTT_BASE "__GOTT_BASE__"
106 #undef VXWORKS_GOTT_INDEX
107 #define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
108
109 /* A VxWorks implementation of TARGET_OS_CPP_BUILTINS.  */
110 #define VXWORKS_OS_CPP_BUILTINS()                                       \
111   do                                                                    \
112     {                                                                   \
113       builtin_define ("__vxworks");                                     \
114       builtin_define ("__VXWORKS__");                                   \
115       builtin_assert ("system=unix");                                   \
116       if (TARGET_VXWORKS_RTP)                                           \
117         builtin_define ("__RTP__");                                     \
118       else                                                              \
119         builtin_define ("_WRS_KERNEL");                                 \
120     }                                                                   \
121   while (0)
122
123 #define VXWORKS_KIND VXWORKS_KIND_NORMAL