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
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 2, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING.  If not, write to the Free
21Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2202110-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/* The directory containing the VxWorks target headers.  */
30#define VXWORKS_TARGET_DIR  "/home/tornado/base6/target"
31
32/* Since we provide a default -isystem, expand -isystem on the command
33   line early.  */
34#undef VXWORKS_ADDITIONAL_CPP_SPEC
35#define VXWORKS_ADDITIONAL_CPP_SPEC " 					\
36 %{!nostdinc:%{isystem*}}						\
37 %{mrtp: -D__RTP__=1							\
38	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/usr/h}}		\
39 %{!mrtp:-D_WRS_KERNEL=1						\
40	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/h}}"
41
42/* The references to __init and __fini will be satisfied by
43   libc_internal.a.  */
44#undef VXWORKS_LIB_SPEC
45#define	VXWORKS_LIB_SPEC						\
46"%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \
47	%{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \
48		  --start-group -lc -lgcc -lc_internal -lnet -ldsi	\
49		  --end-group}}"
50
51/* The no-op spec for "-shared" below is present because otherwise GCC
52   will treat it as an unrecognized option.  */
53#undef VXWORKS_LINK_SPEC
54#define VXWORKS_LINK_SPEC				\
55"%{!mrtp:-r}						\
56 %{!shared:						\
57   %{mrtp:-q %{h*}					\
58          %{R*} %{!Wl,-T*: %{!T*: %(link_start) }}	\
59          %(link_target) %(link_os)}}			\
60 %{v:-V}						\
61 %{shared:-shared}					\
62 %{Bstatic:-Bstatic}					\
63 %{Bdynamic:-Bdynamic}					\
64 %{!Xbind-lazy:-z now}					\
65 %{Xbind-now:%{Xbind-lazy:				\
66   %e-Xbind-now and -Xbind-lazy are incompatible}}	\
67 %{mrtp:%{!shared:%{!non-static:-static}		\
68 		  %{non-static:--force-dynamic --export-dynamic}}}"
69
70/* For VxWorks, the system provides libc_internal.a.  This is a superset
71   of libgcc.a; we want to use it.  Make sure not to dynamically export
72   any of its symbols, though.  Always look for libgcc.a first so that
73   we get the latest versions of the GNU intrinsics during our builds.  */
74#undef VXWORKS_LIBGCC_SPEC
75#define VXWORKS_LIBGCC_SPEC \
76  "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}"
77
78#undef VXWORKS_STARTFILE_SPEC
79#define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:crt0.o%s}}"
80#define VXWORKS_ENDFILE_SPEC ""
81
82/* We can use .ctors/.dtors sections only in RTP mode.
83   Unfortunately this must be an integer constant expression;
84   fix up in override_options.  */
85#undef VXWORKS_OVERRIDE_OPTIONS
86#define VXWORKS_OVERRIDE_OPTIONS do { \
87  targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; \
88} while (0)
89
90/* The VxWorks runtime uses a clever trick to get the sentinel entry
91   (-1) inserted at the beginning of the .ctors segment.  This trick
92   will not work if we ever generate any entries in plain .ctors
93   sections; we must always use .ctors.PRIORITY.  */
94#define ALWAYS_NUMBER_CTORS_SECTIONS 1
95
96/* The name of the symbol for the table of GOTs in a particular
97   RTP.  */
98#define VXWORKS_GOTT_BASE "__GOTT_BASE__"
99/* The name of the symbol for the index into the table of GOTs for the
100   GOT associated with the current shared library.  */
101#define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
102
103#define VXWORKS_KIND VXWORKS_KIND_NORMAL
104