netbsd-elf.h revision 90075
1/* Common configuration file for NetBSD ELF targets.
2   Copyright (C) 2002 Free Software Foundation, Inc.
3   Contributed by Wasabi Systems, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22
23/* This defines which switch letters take arguments.  On NetBSD, most
24   of the normal cases (defined by gcc.c) apply, and we also have -h*
25   and -z* options (for the linker) (coming from SVR4).  */
26
27#undef SWITCH_TAKES_ARG
28#define SWITCH_TAKES_ARG(CHAR)			\
29  (DEFAULT_SWITCH_TAKES_ARG (CHAR)		\
30   || (CHAR) == 'h'				\
31   || (CHAR) == 'z'				\
32   || (CHAR) == 'R')
33
34
35/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF.  Here we
36   provide support for the special GCC option -static.  On ELF
37   targets, we also add the crtbegin.o file, which provides part
38   of the support for getting C++ file-scope static objects
39   constructed before entering "main".  */
40
41#undef STARTFILE_SPEC
42#define STARTFILE_SPEC		\
43  "%{!shared:			\
44     %{pg:gcrt0%O%s}		\
45     %{!pg:			\
46       %{p:gcrt0%O%s}		\
47       %{!p:crt0%O%s}}}		\
48   %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
49
50
51/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF.  Here we
52   add crtend.o, which provides part of the support for getting
53   C++ file-scope static objects deconstructed after exiting "main".  */
54
55#undef ENDFILE_SPEC
56#define ENDFILE_SPEC		\
57  "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
58
59
60/* Provide a LINK_SPEC appropriate for NetBSD ELF.  Here we provide
61   support for the special GCC options -assert, -R, -rpath, -shared,
62   -nostdlib, -static, -rdynamic, and -dynamic-linker.  */
63
64#undef LINK_SPEC
65#define LINK_SPEC							\
66  "%{assert*} %{R*} %{rpath*}						\
67   %{shared:-shared}							\
68   %{!shared:								\
69     -dc -dp								\
70     %{!nostdlib:							\
71       %{!r*:								\
72	 %{!e*:-e __start}}}						\
73     %{!static:								\
74       %{rdynamic:-export-dynamic}					\
75       %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}	\
76     %{static:-static}}"
77