1169689Skan/* Common VxWorks target definitions for GNU compiler.
2169689Skan   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
3169689Skan   Free Software Foundation, Inc.
4132718Skan   Contributed by Wind River Systems.
5169689Skan   Rewritten by CodeSourcery, LLC.
6132718Skan
7132718SkanThis file is part of GCC.
8132718Skan
9169689SkanGCC is free software; you can redistribute it and/or modify it under
10169689Skanthe terms of the GNU General Public License as published by the Free
11169689SkanSoftware Foundation; either version 2, or (at your option) any later
12169689Skanversion.
13132718Skan
14169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY
15169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or
16169689SkanFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17169689Skanfor more details.
18132718Skan
19132718SkanYou should have received a copy of the GNU General Public License
20169689Skanalong with GCC; see the file COPYING.  If not, write to the Free
21169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
22169689Skan02110-1301, USA.  */
23132718Skan
24169689Skan/* In kernel mode, VxWorks provides all the libraries itself, as well as
25169689Skan   the functionality of startup files, etc.  In RTP mode, it behaves more
26169689Skan   like a traditional Unix, with more external files.  Most of our specs
27169689Skan   must be aware of the difference.  */
28132718Skan
29169689Skan/* The directory containing the VxWorks target headers.  */
30169689Skan#define VXWORKS_TARGET_DIR  "/home/tornado/base6/target"
31132718Skan
32169689Skan/* Since we provide a default -isystem, expand -isystem on the command
33169689Skan   line early.  */
34169689Skan#undef VXWORKS_ADDITIONAL_CPP_SPEC
35169689Skan#define VXWORKS_ADDITIONAL_CPP_SPEC " 					\
36169689Skan %{!nostdinc:%{isystem*}}						\
37169689Skan %{mrtp: -D__RTP__=1							\
38169689Skan	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/usr/h}}		\
39169689Skan %{!mrtp:-D_WRS_KERNEL=1						\
40169689Skan	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/h}}"
41132718Skan
42169689Skan/* The references to __init and __fini will be satisfied by
43169689Skan   libc_internal.a.  */
44169689Skan#undef VXWORKS_LIB_SPEC
45169689Skan#define	VXWORKS_LIB_SPEC						\
46169689Skan"%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \
47169689Skan	%{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \
48169689Skan		  --start-group -lc -lgcc -lc_internal -lnet -ldsi	\
49169689Skan		  --end-group}}"
50132718Skan
51169689Skan/* The no-op spec for "-shared" below is present because otherwise GCC
52169689Skan   will treat it as an unrecognized option.  */
53169689Skan#undef VXWORKS_LINK_SPEC
54169689Skan#define VXWORKS_LINK_SPEC				\
55169689Skan"%{!mrtp:-r}						\
56169689Skan %{!shared:						\
57169689Skan   %{mrtp:-q %{h*}					\
58169689Skan          %{R*} %{!Wl,-T*: %{!T*: %(link_start) }}	\
59169689Skan          %(link_target) %(link_os)}}			\
60169689Skan %{v:-V}						\
61169689Skan %{shared:-shared}					\
62169689Skan %{Bstatic:-Bstatic}					\
63169689Skan %{Bdynamic:-Bdynamic}					\
64169689Skan %{!Xbind-lazy:-z now}					\
65169689Skan %{Xbind-now:%{Xbind-lazy:				\
66169689Skan   %e-Xbind-now and -Xbind-lazy are incompatible}}	\
67169689Skan %{mrtp:%{!shared:%{!non-static:-static}		\
68169689Skan 		  %{non-static:--force-dynamic --export-dynamic}}}"
69132718Skan
70169689Skan/* For VxWorks, the system provides libc_internal.a.  This is a superset
71169689Skan   of libgcc.a; we want to use it.  Make sure not to dynamically export
72169689Skan   any of its symbols, though.  Always look for libgcc.a first so that
73169689Skan   we get the latest versions of the GNU intrinsics during our builds.  */
74169689Skan#undef VXWORKS_LIBGCC_SPEC
75169689Skan#define VXWORKS_LIBGCC_SPEC \
76169689Skan  "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}"
77132718Skan
78169689Skan#undef VXWORKS_STARTFILE_SPEC
79169689Skan#define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:crt0.o%s}}"
80169689Skan#define VXWORKS_ENDFILE_SPEC ""
81132718Skan
82169689Skan/* We can use .ctors/.dtors sections only in RTP mode.
83169689Skan   Unfortunately this must be an integer constant expression;
84169689Skan   fix up in override_options.  */
85169689Skan#undef VXWORKS_OVERRIDE_OPTIONS
86169689Skan#define VXWORKS_OVERRIDE_OPTIONS do { \
87169689Skan  targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; \
88169689Skan} while (0)
89132718Skan
90169689Skan/* The VxWorks runtime uses a clever trick to get the sentinel entry
91169689Skan   (-1) inserted at the beginning of the .ctors segment.  This trick
92169689Skan   will not work if we ever generate any entries in plain .ctors
93169689Skan   sections; we must always use .ctors.PRIORITY.  */
94169689Skan#define ALWAYS_NUMBER_CTORS_SECTIONS 1
95132718Skan
96169689Skan/* The name of the symbol for the table of GOTs in a particular
97169689Skan   RTP.  */
98169689Skan#define VXWORKS_GOTT_BASE "__GOTT_BASE__"
99169689Skan/* The name of the symbol for the index into the table of GOTs for the
100169689Skan   GOT associated with the current shared library.  */
101169689Skan#define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
102132718Skan
103169689Skan#define VXWORKS_KIND VXWORKS_KIND_NORMAL
104