xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/i386/netbsd-elf.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1 /* Definitions of target machine for GCC,
2    for i386/ELF NetBSD systems.
3    Copyright (C) 2001-2020 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 3, 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 COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21 
22 #define TARGET_OS_CPP_BUILTINS()		\
23   do						\
24     {						\
25       NETBSD_OS_CPP_BUILTINS_ELF();		\
26     }						\
27   while (0)
28 
29 
30 /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target.  */
31 
32 #undef LINK_SPEC
33 #define LINK_SPEC NETBSD_LINK_SPEC_ELF
34 
35 #define NETBSD_ENTRY_POINT "__start"
36 
37 
38 /* Provide a CPP_SPEC appropriate for NetBSD.  */
39 
40 #undef CPP_SPEC
41 #define CPP_SPEC "%(netbsd_cpp_spec)"
42 
43 
44 /* Provide C11_SPEC/CC1PLUS_SPEC appropriate for NetBSD/i386.  */
45 #define NETBSD_CC1_CPU_SPEC " %(cc1_cpu) "
46 
47 #undef CC1_SPEC
48 #define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC
49 
50 #undef CC1PLUS_SPEC
51 #define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC
52 
53 
54 /* Make gcc agree with <machine/ansi.h> */
55 
56 #undef SIZE_TYPE
57 #define SIZE_TYPE "unsigned int"
58 
59 #undef PTRDIFF_TYPE
60 #define PTRDIFF_TYPE "int"
61 
62 #undef ASM_APP_ON
63 #define ASM_APP_ON "#APP\n"
64 
65 #undef ASM_APP_OFF
66 #define ASM_APP_OFF "#NO_APP\n"
67 
68 #undef ASM_COMMENT_START
69 #define ASM_COMMENT_START "#"
70 
71 #undef DBX_REGISTER_NUMBER
72 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
73 
74 
75 /* Output assembler code to FILE to call the profiler.  */
76 
77 #undef NO_PROFILE_COUNTERS
78 #define NO_PROFILE_COUNTERS	1
79 
80 #undef FUNCTION_PROFILER
81 #define FUNCTION_PROFILER(FILE, LABELNO)				\
82 {									\
83   if (flag_pic)								\
84     fprintf (FILE, "\tcall __mcount@PLT\n");				\
85   else									\
86     fprintf (FILE, "\tcall __mcount\n");				\
87 }
88 
89 
90 #undef HAS_INIT_SECTION
91 
92 /* This is how we tell the assembler that two symbols have the same value.  */
93 
94 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
95   do { assemble_name(FILE, NAME1); 	 \
96        fputs(" = ", FILE);		 \
97        assemble_name(FILE, NAME2);	 \
98        fputc('\n', FILE); } while (0)
99 
100 /* A C statement to output to the stdio stream FILE an assembler
101    command to advance the location counter to a multiple of 1<<LOG
102    bytes if it is within MAX_SKIP bytes.
103 
104    This is used to align code labels according to Intel recommendations.  */
105 
106 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
107 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)			\
108   if ((LOG) != 0) {							\
109     if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1)		\
110       fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
111     else								\
112       fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
113   }
114 #endif
115 
116 /* We always use gas here, so we don't worry about ECOFF assembler
117    problems.  */
118 #undef TARGET_GAS
119 #define TARGET_GAS	1
120 
121 /* Default to pcc-struct-return, because this is the ELF abi and
122    we don't care about compatibility with older gcc versions.  */
123 #define DEFAULT_PCC_STRUCT_RETURN 1
124 
125 #define HAVE_ENABLE_EXECUTE_STACK
126 
127 #define IX86_MAYBE_NO_LIBGCC_TFMODE
128 
129 /* Preserve i386 psABI  */
130 #undef PREFERRED_STACK_BOUNDARY_DEFAULT
131 #define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY
132 
133 /* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000.  */
134 #undef X86_32_ASAN_BIT_OFFSET
135 #define X86_32_ASAN_BIT_OFFSET 30
136