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>
6 This file is part of GNU CC.
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)
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.
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. */
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. */
29 "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}} \
30 %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
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. */
39 #define STARTFILE_SPEC \
45 %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
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'. */
52 #define ENDFILE_SPEC \
53 "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
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. */
66 %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
68 -dy %{rdynamic:-export-dynamic} \
69 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
72 /* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
73 the GCC option `-posix'. */
76 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
78 /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
79 with the options for generating PIC code. */
82 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
84 /* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate
85 libc, depending on whether we're doing profiling. */
88 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
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) \
96 /* Implicit library calls should use memcpy, not bcopy, etc. */
98 #define TARGET_MEM_FUNCTIONS
100 /* Names to predefine in the preprocessor for this target machine. */
102 #define CPP_PREDEFINES "\
103 -Di386 -D__NetBSD__ -D__ELF__ -Asystem(unix) -Asystem(NetBSD)"
105 /* Make gcc agree with <machine/ansi.h> */
108 #define SIZE_TYPE "unsigned int"
111 #define PTRDIFF_TYPE "int"
114 #define WCHAR_TYPE "int"
116 #undef WCHAR_UNSIGNED
117 #define WCHAR_UNSIGNED 0
119 #undef WCHAR_TYPE_SIZE
120 #define WCHAR_TYPE_SIZE 32
123 #define WINT_TYPE "int"
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. */
130 #define ASM_APP_ON "#APP\n"
133 #define ASM_APP_OFF "#NO_APP\n"
135 #undef ASM_FINAL_SPEC
136 #define ASM_FINAL_SPEC "%{pipe:-}"
138 #undef DBX_REGISTER_NUMBER
139 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
141 #undef NO_PROFILE_COUNTERS
142 #define NO_PROFILE_COUNTERS
144 #undef HAS_INIT_SECTION
146 #undef DEFAULT_VTABLE_THUNKS
147 #define DEFAULT_VTABLE_THUNKS 1
149 /* This is how we tell the assembler that two symbols have the same value. */
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)
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.
161 This is used to align code labels according to Intel recommendations. */
163 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
164 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
166 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
167 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
172 * We always use gas here, so we don't worry about ECOFF assembler problems.
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
181 #undef TARGET_VERSION
182 #define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF target)");