1/* Definitions of target machine for GNU compiler for Intel 80386 2 running FreeBSD. 3 Copyright (C) 1988, 1992, 1994 Free Software Foundation, Inc. 4 Contributed by Poul-Henning Kamp <phk@login.dkuug.dk> 5 6This file is part of GNU CC. 7 8GNU CC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 2, or (at your option) 11any later version. 12 13GNU CC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with GNU CC; see the file COPYING. If not, write to 20the Free Software Foundation, 59 Temple Place - Suite 330, 21Boston, MA 02111-1307, USA. */ 22
| 1/* Definitions of target machine for GNU compiler for Intel 80386 2 running FreeBSD. 3 Copyright (C) 1988, 1992, 1994 Free Software Foundation, Inc. 4 Contributed by Poul-Henning Kamp <phk@login.dkuug.dk> 5 6This file is part of GNU CC. 7 8GNU CC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 2, or (at your option) 11any later version. 12 13GNU CC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with GNU CC; see the file COPYING. If not, write to 20the Free Software Foundation, 59 Temple Place - Suite 330, 21Boston, MA 02111-1307, USA. */ 22
|
23/* This goes away when the math-emulator is fixed */ 24#define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */ 25
| |
26/* This is tested by i386gas.h. */ 27#define YES_UNDERSCORES 28 29/* Don't assume anything about the header files. */ 30#define NO_IMPLICIT_EXTERN_C 31 32#include "i386/gstabs.h" 33 34/* Get perform_* macros to build libgcc.a. */ 35#include "i386/perform.h"
| 23/* This is tested by i386gas.h. */ 24#define YES_UNDERSCORES 25 26/* Don't assume anything about the header files. */ 27#define NO_IMPLICIT_EXTERN_C 28 29#include "i386/gstabs.h" 30 31/* Get perform_* macros to build libgcc.a. */ 32#include "i386/perform.h"
|
| 33 34/* This was cloned from ../netbsd.h. It and several other things in 35 this file should be in ../freebsd.h. */ 36/* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD 37 source tree so it can be configured appropriately without using 38 the GNU configure/build mechanism. */
|
36
| 39
|
| 40#ifdef FREEBSD_NATIVE 41 42/* Look for the include files in the system-defined places. */ 43 44#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" 45 46#define GCC_INCLUDE_DIR "/usr/include" 47 48/* FreeBSD has GCC_INCLUDE_DIR first. */ 49#define INCLUDE_DEFAULTS \ 50 { \ 51 { GCC_INCLUDE_DIR, 0, 0 }, \ 52 { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ 53 { 0, 0, 0 } \ 54 } 55 56/* Under FreeBSD, the normal location of the compiler back ends is the 57 /usr/libexec directory. */ 58 59#define STANDARD_EXEC_PREFIX "/usr/libexec/" 60 61/* Under FreeBSD, the normal location of the various *crt*.o files is the 62 /usr/lib directory. */ 63 64#define STANDARD_STARTFILE_PREFIX "/usr/lib/" 65 66/* On FreeBSD, gcc is called 'cc' */ 67#define GCC_NAME "cc" 68 69/* FreeBSD is 4.4BSD derived */ 70#define bsd4_4 71 72#endif /* FREEBSD_NATIVE */ 73 74#define MASK_PROFILER_EPILOGUE 010000000000 75 76#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE) 77 78#undef SUBTARGET_SWITCHES 79#define SUBTARGET_SWITCHES \ 80 { "profiler-epilogue", MASK_PROFILER_EPILOGUE}, \ 81 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE}, 82 83
|
37#undef CPP_PREDEFINES
| 84#undef CPP_PREDEFINES
|
38#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
| 85#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=2 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
|
39
| 86
|
| 87#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" 88
|
40/* Like the default, except no -lg. */ 41#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" 42
| 89/* Like the default, except no -lg. */ 90#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" 91
|
| 92#define LINK_SPEC \ 93 "%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \ 94 %{p:-Bstatic} %{pg:-Bstatic} %{Z}" 95 96#define LINK_LIBGCC_SPECIAL_1 1 97 98#define STARTFILE_SPEC \ 99 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" 100 101/* This goes away when the math emulator is fixed. */ 102#undef TARGET_DEFAULT 103#define TARGET_DEFAULT (MASK_NO_FANCY_MATH_387 | 0301) 104
|
43#undef SIZE_TYPE 44#define SIZE_TYPE "unsigned int" 45 46#undef PTRDIFF_TYPE 47#define PTRDIFF_TYPE "int" 48 49#undef WCHAR_TYPE
| 105#undef SIZE_TYPE 106#define SIZE_TYPE "unsigned int" 107 108#undef PTRDIFF_TYPE 109#define PTRDIFF_TYPE "int" 110 111#undef WCHAR_TYPE
|
50#define WCHAR_TYPE "short unsigned int"
| 112#define WCHAR_TYPE "int"
|
51
| 113
|
52#define WCHAR_UNSIGNED 1
| 114#define WCHAR_UNSIGNED 0
|
53 54#undef WCHAR_TYPE_SIZE
| 115 116#undef WCHAR_TYPE_SIZE
|
55#define WCHAR_TYPE_SIZE 16
| 117#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
56 57#define HAVE_ATEXIT 58
| 118 119#define HAVE_ATEXIT 120
|
59/* There are conflicting reports about whether this system uses 60 a different assembler syntax. wilson@cygnus.com says # is right. */ 61#undef COMMENT_BEGIN 62#define COMMENT_BEGIN "#"
| 121#define HAVE_PUTENV
|
63
| 122
|
| 123/* Override the default comment-starter of "/". */ 124 125#undef ASM_COMMENT_START 126#define ASM_COMMENT_START "#" 127
|
64#undef ASM_APP_ON 65#define ASM_APP_ON "#APP\n" 66 67#undef ASM_APP_OFF 68#define ASM_APP_OFF "#NO_APP\n" 69 70/* The following macros are stolen from i386v4.h */ 71/* These have to be defined to get PIC code correct */ 72 73/* This is how to output an element of a case-vector that is relative. 74 This is only used for PIC code. See comments by the `casesi' insn in 75 i386.md for an explanation of the expression this outputs. */ 76 77#undef ASM_OUTPUT_ADDR_DIFF_ELT 78#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ 79 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) 80 81/* Indicate that jump tables go in the text section. This is 82 necessary when compiling PIC code. */ 83 84#define JUMP_TABLES_IN_TEXT_SECTION 85 86/* Don't default to pcc-struct-return, because gcc is the only compiler, and 87 we want to retain compatibility with older gcc versions. */ 88#define DEFAULT_PCC_STRUCT_RETURN 0
| 128#undef ASM_APP_ON 129#define ASM_APP_ON "#APP\n" 130 131#undef ASM_APP_OFF 132#define ASM_APP_OFF "#NO_APP\n" 133 134/* The following macros are stolen from i386v4.h */ 135/* These have to be defined to get PIC code correct */ 136 137/* This is how to output an element of a case-vector that is relative. 138 This is only used for PIC code. See comments by the `casesi' insn in 139 i386.md for an explanation of the expression this outputs. */ 140 141#undef ASM_OUTPUT_ADDR_DIFF_ELT 142#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ 143 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) 144 145/* Indicate that jump tables go in the text section. This is 146 necessary when compiling PIC code. */ 147 148#define JUMP_TABLES_IN_TEXT_SECTION 149 150/* Don't default to pcc-struct-return, because gcc is the only compiler, and 151 we want to retain compatibility with older gcc versions. */ 152#define DEFAULT_PCC_STRUCT_RETURN 0
|
89 90/* Profiling routines, partially copied from i386/osfrose.h. */
| |
91
| 153
|
92/* Redefine this to use %eax instead of %edx. */
| 154/* Tell final.c that we don't need a label passed to mcount. */ 155 156#define NO_PROFILE_DATA 157 158/* Redefine this to not pass an unused label in %edx. */ 159
|
93#undef FUNCTION_PROFILER 94#define FUNCTION_PROFILER(FILE, LABELNO) \ 95{ \ 96 if (flag_pic) \
| 160#undef FUNCTION_PROFILER 161#define FUNCTION_PROFILER(FILE, LABELNO) \ 162{ \ 163 if (flag_pic) \
|
97 { \ 98 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \ 99 LPREFIX, (LABELNO)); \ 100 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ 101 } \
| 164 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
|
102 else \
| 165 else \
|
| 166 fprintf (FILE, "\tcall mcount\n"); \ 167} 168 169#define FUNCTION_PROFILER_EPILOGUE(FILE) \ 170{ \ 171 if (TARGET_PROFILER_EPILOGUE) \
|
103 { \
| 172 { \
|
104 fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \ 105 fprintf (FILE, "\tcall mcount\n"); \
| 173 if (flag_pic) \ 174 fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n"); \ 175 else \ 176 fprintf (FILE, "\tcall mexitcount\n"); \
|
106 } \ 107}
| 177 } \ 178}
|
108
| 179
|
109/* 110 * Some imports from svr4.h in support of shared libraries. 111 * Currently, we need the DECLARE_OBJECT_SIZE stuff. 112 */ 113
| 180/* 181 * Some imports from svr4.h in support of shared libraries. 182 * Currently, we need the DECLARE_OBJECT_SIZE stuff. 183 */ 184
|
| 185#define HANDLE_SYSV_PRAGMA 186
|
114/* Define the strings used for the special svr4 .type and .size directives. 115 These strings generally do not vary from one system running svr4 to 116 another, but if a given system (e.g. m88k running svr) needs to use 117 different pseudo-op names for these, they may be overridden in the 118 file which includes this one. */ 119 120#define TYPE_ASM_OP ".type" 121#define SIZE_ASM_OP ".size"
| 187/* Define the strings used for the special svr4 .type and .size directives. 188 These strings generally do not vary from one system running svr4 to 189 another, but if a given system (e.g. m88k running svr) needs to use 190 different pseudo-op names for these, they may be overridden in the 191 file which includes this one. */ 192 193#define TYPE_ASM_OP ".type" 194#define SIZE_ASM_OP ".size"
|
| 195#define SET_ASM_OP ".set"
|
122
| 196
|
| 197/* This is how we tell the assembler that a symbol is weak. */ 198 199#if 0 /* not ready for this yet - work in progress. 200 * We should probably update gas in the FreeBSD source to something 201 * more recent, so that this is recognised. Our LD handles it already. 202 */ 203#define ASM_WEAKEN_LABEL(FILE,NAME) \ 204 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ 205 fputc ('\n', FILE); } while (0) 206#endif 207
|
123/* The following macro defines the format used to output the second 124 operand of the .type assembler directive. Different svr4 assemblers 125 expect various different forms for this operand. The one given here 126 is just a default. You may need to override it in your machine- 127 specific tm.h file (depending upon the particulars of your assembler). */ 128 129#define TYPE_OPERAND_FMT "@%s" 130 131/* Write the extra assembler code needed to declare a function's result. 132 Most svr4 assemblers don't require any special declaration of the 133 result value, but there are exceptions. */ 134 135#ifndef ASM_DECLARE_RESULT 136#define ASM_DECLARE_RESULT(FILE, RESULT) 137#endif 138 139/* These macros generate the special .type and .size directives which 140 are used to set the corresponding fields of the linker symbol table 141 entries in an ELF object file under SVR4. These macros also output 142 the starting labels for the relevant functions/objects. */ 143 144/* Write the extra assembler code needed to declare a function properly. 145 Some svr4 assemblers need to also have something extra said about the 146 function's return value. We allow for that here. */ 147 148#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 149 do { \ 150 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 151 assemble_name (FILE, NAME); \ 152 putc (',', FILE); \ 153 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 154 putc ('\n', FILE); \ 155 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 156 ASM_OUTPUT_LABEL(FILE, NAME); \ 157 } while (0) 158 159/* Write the extra assembler code needed to declare an object properly. */ 160 161#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 162 do { \ 163 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 164 assemble_name (FILE, NAME); \ 165 putc (',', FILE); \ 166 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 167 putc ('\n', FILE); \ 168 size_directive_output = 0; \ 169 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 170 { \ 171 size_directive_output = 1; \ 172 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 173 assemble_name (FILE, NAME); \ 174 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 175 } \ 176 ASM_OUTPUT_LABEL(FILE, NAME); \ 177 } while (0) 178 179/* Output the size directive for a decl in rest_of_decl_compilation 180 in the case where we did not do so before the initializer. 181 Once we find the error_mark_node, we know that the value of 182 size_directive_output was set 183 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 184 185#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 186do { \ 187 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 188 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 189 && ! AT_END && TOP_LEVEL \ 190 && DECL_INITIAL (DECL) == error_mark_node \ 191 && !size_directive_output) \ 192 { \ 193 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 194 assemble_name (FILE, name); \ 195 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ 196 } \ 197 } while (0) 198 199 200/* This is how to declare the size of a function. */ 201 202#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 203 do { \ 204 if (!flag_inhibit_size_directive) \ 205 { \ 206 char label[256]; \ 207 static int labelno; \ 208 labelno++; \ 209 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ 210 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ 211 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 212 assemble_name (FILE, (FNAME)); \ 213 fprintf (FILE, ","); \ 214 assemble_name (FILE, label); \ 215 fprintf (FILE, "-"); \ 216 assemble_name (FILE, (FNAME)); \ 217 putc ('\n', FILE); \ 218 } \ 219 } while (0)
| 208/* The following macro defines the format used to output the second 209 operand of the .type assembler directive. Different svr4 assemblers 210 expect various different forms for this operand. The one given here 211 is just a default. You may need to override it in your machine- 212 specific tm.h file (depending upon the particulars of your assembler). */ 213 214#define TYPE_OPERAND_FMT "@%s" 215 216/* Write the extra assembler code needed to declare a function's result. 217 Most svr4 assemblers don't require any special declaration of the 218 result value, but there are exceptions. */ 219 220#ifndef ASM_DECLARE_RESULT 221#define ASM_DECLARE_RESULT(FILE, RESULT) 222#endif 223 224/* These macros generate the special .type and .size directives which 225 are used to set the corresponding fields of the linker symbol table 226 entries in an ELF object file under SVR4. These macros also output 227 the starting labels for the relevant functions/objects. */ 228 229/* Write the extra assembler code needed to declare a function properly. 230 Some svr4 assemblers need to also have something extra said about the 231 function's return value. We allow for that here. */ 232 233#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 234 do { \ 235 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 236 assemble_name (FILE, NAME); \ 237 putc (',', FILE); \ 238 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 239 putc ('\n', FILE); \ 240 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 241 ASM_OUTPUT_LABEL(FILE, NAME); \ 242 } while (0) 243 244/* Write the extra assembler code needed to declare an object properly. */ 245 246#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 247 do { \ 248 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 249 assemble_name (FILE, NAME); \ 250 putc (',', FILE); \ 251 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 252 putc ('\n', FILE); \ 253 size_directive_output = 0; \ 254 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 255 { \ 256 size_directive_output = 1; \ 257 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 258 assemble_name (FILE, NAME); \ 259 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 260 } \ 261 ASM_OUTPUT_LABEL(FILE, NAME); \ 262 } while (0) 263 264/* Output the size directive for a decl in rest_of_decl_compilation 265 in the case where we did not do so before the initializer. 266 Once we find the error_mark_node, we know that the value of 267 size_directive_output was set 268 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 269 270#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 271do { \ 272 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 273 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 274 && ! AT_END && TOP_LEVEL \ 275 && DECL_INITIAL (DECL) == error_mark_node \ 276 && !size_directive_output) \ 277 { \ 278 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 279 assemble_name (FILE, name); \ 280 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ 281 } \ 282 } while (0) 283 284 285/* This is how to declare the size of a function. */ 286 287#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 288 do { \ 289 if (!flag_inhibit_size_directive) \ 290 { \ 291 char label[256]; \ 292 static int labelno; \ 293 labelno++; \ 294 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ 295 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ 296 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 297 assemble_name (FILE, (FNAME)); \ 298 fprintf (FILE, ","); \ 299 assemble_name (FILE, label); \ 300 fprintf (FILE, "-"); \ 301 assemble_name (FILE, (FNAME)); \ 302 putc ('\n', FILE); \ 303 } \ 304 } while (0)
|
220 221#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" 222#define LINK_SPEC \ 223 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}" 224 225/* This is defined when gcc is compiled in the BSD-directory-tree, and must 226 * make up for the gap to all the stuff done in the GNU-makefiles. 227 */ 228 229#ifdef FREEBSD_NATIVE 230 231#define INCLUDE_DEFAULTS { \ 232 { "/usr/include", 0 }, \ 233 { "/usr/include/g++", 1 }, \ 234 { 0, 0} \ 235 } 236 237#undef MD_EXEC_PREFIX 238#define MD_EXEC_PREFIX "/usr/libexec/" 239 240#undef STANDARD_STARTFILE_PREFIX 241#define STANDARD_STARTFILE_PREFIX "/usr/lib" 242 243#if 0 /* This is very wrong!!! */ 244#define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0" 245#define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include" 246#define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include" 247#define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include" 248#endif 249 250#endif /* FREEBSD_NATIVE */
| |
| |