vxworks.h revision 169690
13332Sphk/* Common VxWorks target definitions for GNU compiler.
23332Sphk   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
33332Sphk   Free Software Foundation, Inc.
493149Sphk   Contributed by Wind River Systems.
53332Sphk   Rewritten by CodeSourcery, LLC.
63332Sphk
73332SphkThis file is part of GCC.
83332Sphk
93332SphkGCC is free software; you can redistribute it and/or modify it under
103332Sphkthe terms of the GNU General Public License as published by the Free
113784SphkSoftware Foundation; either version 2, or (at your option) any later
123332Sphkversion.
133332Sphk
143332SphkGCC is distributed in the hope that it will be useful, but WITHOUT ANY
153332SphkWARRANTY; without even the implied warranty of MERCHANTABILITY or
163332SphkFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
173332Sphkfor more details.
183332Sphk
193332SphkYou should have received a copy of the GNU General Public License
203417Scsgralong with GCC; see the file COPYING.  If not, write to the Free
213332SphkSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
223332Sphk02110-1301, USA.  */
23116182Sobrien
24116182Sobrien/* In kernel mode, VxWorks provides all the libraries itself, as well as
25116182Sobrien   the functionality of startup files, etc.  In RTP mode, it behaves more
263784Sphk   like a traditional Unix, with more external files.  Most of our specs
273332Sphk   must be aware of the difference.  */
283332Sphk
293332Sphk/* The directory containing the VxWorks target headers.  */
303332Sphk#define VXWORKS_TARGET_DIR  "/home/tornado/base6/target"
3176166Smarkm
323507Scsgr/* Since we provide a default -isystem, expand -isystem on the command
3376166Smarkm   line early.  */
3415494Sbde#undef VXWORKS_ADDITIONAL_CPP_SPEC
353507Scsgr#define VXWORKS_ADDITIONAL_CPP_SPEC " 					\
363332Sphk %{!nostdinc:%{isystem*}}						\
373507Scsgr %{mrtp: -D__RTP__=1							\
3815494Sbde	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/usr/h}}		\
393784Sphk %{!mrtp:-D_WRS_KERNEL=1						\
403332Sphk	 %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/h}}"
413332Sphk
4212662Sdg/* The references to __init and __fini will be satisfied by
4312662Sdg   libc_internal.a.  */
4412662Sdg#undef VXWORKS_LIB_SPEC
453332Sphk#define	VXWORKS_LIB_SPEC						\
4612662Sdg"%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \
473332Sphk	%{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \
483784Sphk		  --start-group -lc -lgcc -lc_internal -lnet -ldsi	\
493784Sphk		  --end-group}}"
503784Sphk
513784Sphk/* The no-op spec for "-shared" below is present because otherwise GCC
5248079Shoek   will treat it as an unrecognized option.  */
533784Sphk#undef VXWORKS_LINK_SPEC
543784Sphk#define VXWORKS_LINK_SPEC				\
553784Sphk"%{!mrtp:-r}						\
563784Sphk %{!shared:						\
573784Sphk   %{mrtp:-q %{h*}					\
583784Sphk          %{R*} %{!Wl,-T*: %{!T*: %(link_start) }}	\
593784Sphk          %(link_target) %(link_os)}}			\
603784Sphk %{v:-V}						\
613784Sphk %{shared:-shared}					\
6292723Salfred %{Bstatic:-Bstatic}					\
6392723Salfred %{Bdynamic:-Bdynamic}					\
6492723Salfred %{!Xbind-lazy:-z now}					\
6592723Salfred %{Xbind-now:%{Xbind-lazy:				\
663784Sphk   %e-Xbind-now and -Xbind-lazy are incompatible}}	\
6712568Sbde %{mrtp:%{!shared:%{!non-static:-static}		\
6812130Sdg 		  %{non-static:--force-dynamic --export-dynamic}}}"
6912130Sdg
703332Sphk/* For VxWorks, the system provides libc_internal.a.  This is a superset
713784Sphk   of libgcc.a; we want to use it.  Make sure not to dynamically export
7217974Sbde   any of its symbols, though.  Always look for libgcc.a first so that
733784Sphk   we get the latest versions of the GNU intrinsics during our builds.  */
743784Sphk#undef VXWORKS_LIBGCC_SPEC
7517386Sphk#define VXWORKS_LIBGCC_SPEC \
763332Sphk  "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}"
773348Sphk
783784Sphk#undef VXWORKS_STARTFILE_SPEC
793784Sphk#define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:crt0.o%s}}"
803784Sphk#define VXWORKS_ENDFILE_SPEC ""
813784Sphk
823784Sphk/* We can use .ctors/.dtors sections only in RTP mode.
833784Sphk   Unfortunately this must be an integer constant expression;
843784Sphk   fix up in override_options.  */
853784Sphk#undef VXWORKS_OVERRIDE_OPTIONS
863332Sphk#define VXWORKS_OVERRIDE_OPTIONS do { \
873784Sphk  targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; \
883784Sphk} while (0)
893784Sphk
903348Sphk/* The VxWorks runtime uses a clever trick to get the sentinel entry
913784Sphk   (-1) inserted at the beginning of the .ctors segment.  This trick
923784Sphk   will not work if we ever generate any entries in plain .ctors
933332Sphk   sections; we must always use .ctors.PRIORITY.  */
943348Sphk#define ALWAYS_NUMBER_CTORS_SECTIONS 1
953784Sphk
963784Sphk/* The name of the symbol for the table of GOTs in a particular
973348Sphk   RTP.  */
983784Sphk#define VXWORKS_GOTT_BASE "__GOTT_BASE__"
993784Sphk/* The name of the symbol for the index into the table of GOTs for the
1003784Sphk   GOT associated with the current shared library.  */
1013784Sphk#define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
1023784Sphk
1033332Sphk#define VXWORKS_KIND VXWORKS_KIND_NORMAL
10412130Sdg