xref: /openbsd/gnu/gcc/gcc/config/i386/netbsd-elf.h (revision 404b540a)
1 /* Definitions of target machine for GCC,
2    for i386/ELF NetBSD systems.
3    Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
4    Contributed by matthew green <mrg@eterna.com.au>
5 
6 This file is part of GCC.
7 
8 GCC 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 GCC 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 GCC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.  */
22 
23 #define TARGET_OS_CPP_BUILTINS()		\
24   do						\
25     {						\
26       NETBSD_OS_CPP_BUILTINS_ELF();		\
27     }						\
28   while (0)
29 
30 
31 /* Extra specs needed for NetBSD/i386 ELF.  */
32 
33 #undef SUBTARGET_EXTRA_SPECS
34 #define SUBTARGET_EXTRA_SPECS			\
35   { "netbsd_cpp_spec", NETBSD_CPP_SPEC },	\
36   { "netbsd_entry_point", NETBSD_ENTRY_POINT },
37 
38 
39 /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target.  */
40 
41 #undef LINK_SPEC
42 #define LINK_SPEC NETBSD_LINK_SPEC_ELF
43 
44 #define NETBSD_ENTRY_POINT "__start"
45 
46 
47 /* Provide a CPP_SPEC appropriate for NetBSD.  */
48 
49 #undef CPP_SPEC
50 #define CPP_SPEC "%(netbsd_cpp_spec)"
51 
52 
53 /* Make gcc agree with <machine/ansi.h> */
54 
55 #undef SIZE_TYPE
56 #define SIZE_TYPE "unsigned int"
57 
58 #undef PTRDIFF_TYPE
59 #define PTRDIFF_TYPE "int"
60 
61 #undef ASM_APP_ON
62 #define ASM_APP_ON "#APP\n"
63 
64 #undef ASM_APP_OFF
65 #define ASM_APP_OFF "#NO_APP\n"
66 
67 #undef ASM_COMMENT_START
68 #define ASM_COMMENT_START "#"
69 
70 #undef DBX_REGISTER_NUMBER
71 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
72 
73 
74 /* Output assembler code to FILE to call the profiler.  */
75 
76 #undef NO_PROFILE_COUNTERS
77 #define NO_PROFILE_COUNTERS	1
78 
79 #undef FUNCTION_PROFILER
80 #define FUNCTION_PROFILER(FILE, LABELNO)				\
81 {									\
82   if (flag_pic)								\
83     fprintf (FILE, "\tcall __mcount@PLT\n");				\
84   else									\
85     fprintf (FILE, "\tcall __mcount\n");				\
86 }
87 
88 
89 #undef HAS_INIT_SECTION
90 
91 /* This is how we tell the assembler that two symbols have the same value.  */
92 
93 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
94   do { assemble_name(FILE, NAME1); 	 \
95        fputs(" = ", FILE);		 \
96        assemble_name(FILE, NAME2);	 \
97        fputc('\n', FILE); } while (0)
98 
99 /* A C statement to output to the stdio stream FILE an assembler
100    command to advance the location counter to a multiple of 1<<LOG
101    bytes if it is within MAX_SKIP bytes.
102 
103    This is used to align code labels according to Intel recommendations.  */
104 
105 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
106 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)			\
107   if ((LOG) != 0) {							\
108     if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
109     else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
110   }
111 #endif
112 
113 /* We always use gas here, so we don't worry about ECOFF assembler
114    problems.  */
115 #undef TARGET_GAS
116 #define TARGET_GAS	1
117 
118 /* Default to pcc-struct-return, because this is the ELF abi and
119    we don't care about compatibility with older gcc versions.  */
120 #define DEFAULT_PCC_STRUCT_RETURN 1
121 
122 /* Attempt to enable execute permissions on the stack.  */
123 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
124 
125 #define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF)");
126