OSDN Git Service

* config/i386/att.h: Fix comment formatting.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / netbsd-elf.h
1 /* Definitions of target machine for GNU compiler,
2    for i386/ELF NetBSD systems.
3    Copyright (C) 2001 Free Software Foundation, Inc.
4    Contributed by matthew green <mrg@eterna.com.au>
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* Provide a LIB_SPEC appropriate for NetBSD.  Just select the appropriate
24    libc, depending on whether we're doing profiling; if `-posix' is specified,
25    link against the appropriate libposix first.  */
26
27 #undef LIB_SPEC
28 #define LIB_SPEC                                                        \
29   "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}           \
30    %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
31
32 /* Provide a STARTFILE_SPEC appropriate for NetBSD ELF targets.  Here we
33    provide support for the special GCC option -static.  On ELF targets,
34    we also add the crtbegin.o file which provides part of the support
35    for getting C++ file-scope static objects constructed before entering
36    `main'.  We use the NetBSD crt0.  */
37
38 #undef STARTFILE_SPEC
39 #define STARTFILE_SPEC \
40  "%{!shared: \
41      %{pg:gcrt0%O%s} \
42      %{!pg: \
43         %{p:gcrt0%O%s} \
44         %{!p:crt0%O%s}}} \
45    %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
46
47 /* Provide an ENDFILE_SPEC approrpiate for NetBSD ELF targets.  Here we
48    add crtend.o, which provides part of the support for getting C++
49    file-scope static objects deconstructed after exiting `main'.  */
50
51 #undef ENDFILE_SPEC
52 #define ENDFILE_SPEC \
53  "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
54
55 /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target.  Only
56    the linker emulation is i386-specific.  The rest are
57    common to all ELF targets, except for the name of the start function.  */
58
59 #undef LINK_SPEC
60 #define LINK_SPEC \
61  "-m elf_i386 \
62   %{assert*} %{R*} \
63   %{shared:-shared} \
64   %{!shared: \
65     -dp \
66     %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
67     %{!static: \
68       -dy %{rdynamic:-export-dynamic} \
69       %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
70     %{static:-static}}"
71
72 /* Provide a CPP_SPEC appropriate for NetBSD.  Current we just deal with
73    the GCC option `-posix'.  */
74
75 #undef CPP_SPEC
76 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
77
78 /* Provide an ASM_SPEC appropriate for NetBSD.  Currently we only deal
79    with the options for generating PIC code.  */
80
81 #undef ASM_SPEC
82 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
83
84 /* Provide a LIB_SPEC appropriate for NetBSD.  Just select the appropriate
85    libc, depending on whether we're doing profiling.  */
86
87 #undef LIB_SPEC
88 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
89
90 /* This defines which switch letters take arguments.  */
91 #undef SWITCH_TAKES_ARG
92 #define SWITCH_TAKES_ARG(CHAR) \
93   (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
94    || (CHAR) == 'R')
95
96 /* Implicit library calls should use memcpy, not bcopy, etc.  */
97
98 #define TARGET_MEM_FUNCTIONS
99
100 /* Names to predefine in the preprocessor for this target machine.  */
101
102 #define CPP_PREDEFINES "\
103 -Di386 -D__NetBSD__ -D__ELF__ -Asystem(unix) -Asystem(NetBSD)"
104
105 /* Make gcc agree with <machine/ansi.h> */
106
107 #undef SIZE_TYPE
108 #define SIZE_TYPE "unsigned int"
109
110 #undef PTRDIFF_TYPE
111 #define PTRDIFF_TYPE "int"
112
113 #undef WCHAR_TYPE
114 #define WCHAR_TYPE "int"
115
116 #undef WCHAR_UNSIGNED
117 #define WCHAR_UNSIGNED 0
118
119 #undef WCHAR_TYPE_SIZE
120 #define WCHAR_TYPE_SIZE 32
121
122 #undef WINT_TYPE
123 #define WINT_TYPE "int"
124
125 /* Output assembler code to FILE to increment profiler label # LABELNO
126    for profiling a function entry.  Under NetBSD/i386, the assembler does
127    nothing special with -pg.  */
128
129 #undef ASM_APP_ON
130 #define ASM_APP_ON "#APP\n"
131
132 #undef ASM_APP_OFF
133 #define ASM_APP_OFF "#NO_APP\n"
134
135 #undef ASM_FINAL_SPEC
136 #define ASM_FINAL_SPEC "%{pipe:-}"
137
138 #undef DBX_REGISTER_NUMBER
139 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
140
141 #undef  NO_PROFILE_COUNTERS
142 #define NO_PROFILE_COUNTERS
143
144 #undef HAS_INIT_SECTION
145
146 #undef DEFAULT_VTABLE_THUNKS
147 #define DEFAULT_VTABLE_THUNKS 1
148
149 /* This is how we tell the assembler that two symbols have the same value.  */
150
151 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
152   do { assemble_name(FILE, NAME1);       \
153        fputs(" = ", FILE);               \
154        assemble_name(FILE, NAME2);       \
155        fputc('\n', FILE); } while (0)
156
157 /* A C statement to output to the stdio stream FILE an assembler
158    command to advance the location counter to a multiple of 1<<LOG
159    bytes if it is within MAX_SKIP bytes.
160
161    This is used to align code labels according to Intel recommendations.  */
162
163 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
164 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)                                  \
165   if ((LOG) != 0) {                                                                                                             \
166     if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));    \
167     else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));    \
168   }
169 #endif
170
171 /*
172  * We always use gas here, so we don't worry about ECOFF assembler problems.
173  */
174 #undef TARGET_GAS
175 #define TARGET_GAS      1
176
177 /* Default to pcc-struct-return, because this is the ELF abi and
178    we don't care about compatibility with older gcc versions.  */
179 #define DEFAULT_PCC_STRUCT_RETURN 1
180
181 #undef TARGET_VERSION
182 #define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF target)");