freebsd.h revision 25400
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 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. */ 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 84#undef CPP_PREDEFINES 85#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=3 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" 86 87#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" 88 89/* Like the default, except no -lg, and no -p. */ 90#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:-lc}%{pthread:-lc_r}}%{pg:%{!pthread:-lc_p}%{pthread:-lc_r_p}}}" 91 92#define LINK_SPEC \ 93 "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \ 94 %{shared:-Bshareable} \ 95 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \ 96 %{pg:-Bstatic} %{Z}} \ 97 %{assert*} %{R*}" 98 99#define LINK_LIBGCC_SPECIAL_1 1 100 101#define STARTFILE_SPEC \ 102 "%{shared:c++rt0.o%s} \ 103 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" 104 105/* This goes away when the math emulator is fixed. */ 106#undef TARGET_DEFAULT 107#define TARGET_DEFAULT (MASK_NO_FANCY_MATH_387 | 0301) 108 109#undef SIZE_TYPE 110#define SIZE_TYPE "unsigned int" 111 112#undef PTRDIFF_TYPE 113#define PTRDIFF_TYPE "int" 114 115#undef WCHAR_TYPE 116#define WCHAR_TYPE "int" 117 118#define WCHAR_UNSIGNED 0 119 120#undef WCHAR_TYPE_SIZE 121#define WCHAR_TYPE_SIZE BITS_PER_WORD 122 123#define HAVE_ATEXIT 124 125#define HAVE_PUTENV 126 127/* Override the default comment-starter of "/". */ 128 129#undef ASM_COMMENT_START 130#define ASM_COMMENT_START "#" 131 132#undef ASM_APP_ON 133#define ASM_APP_ON "#APP\n" 134 135#undef ASM_APP_OFF 136#define ASM_APP_OFF "#NO_APP\n" 137 138/* The following macros are stolen from i386v4.h */ 139/* These have to be defined to get PIC code correct */ 140 141/* This is how to output an element of a case-vector that is relative. 142 This is only used for PIC code. See comments by the `casesi' insn in 143 i386.md for an explanation of the expression this outputs. */ 144 145#undef ASM_OUTPUT_ADDR_DIFF_ELT 146#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ 147 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) 148 149/* Indicate that jump tables go in the text section. This is 150 necessary when compiling PIC code. */ 151 152#define JUMP_TABLES_IN_TEXT_SECTION 153 154/* Don't default to pcc-struct-return, because gcc is the only compiler, and 155 we want to retain compatibility with older gcc versions. */ 156#define DEFAULT_PCC_STRUCT_RETURN 0 157 158/* Tell final.c that we don't need a label passed to mcount. */ 159 160#define NO_PROFILE_DATA 161 162/* Redefine this to not pass an unused label in %edx. */ 163 164#undef FUNCTION_PROFILER 165#define FUNCTION_PROFILER(FILE, LABELNO) \ 166{ \ 167 if (flag_pic) \ 168 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ 169 else \ 170 fprintf (FILE, "\tcall mcount\n"); \ 171} 172 173#define FUNCTION_PROFILER_EPILOGUE(FILE) \ 174{ \ 175 if (TARGET_PROFILER_EPILOGUE) \ 176 { \ 177 if (flag_pic) \ 178 fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n"); \ 179 else \ 180 fprintf (FILE, "\tcall mexitcount\n"); \ 181 } \ 182} 183 184/* 185 * Some imports from svr4.h in support of shared libraries. 186 * Currently, we need the DECLARE_OBJECT_SIZE stuff. 187 */ 188 189#define HANDLE_SYSV_PRAGMA 190 191/* Define the strings used for the special svr4 .type and .size directives. 192 These strings generally do not vary from one system running svr4 to 193 another, but if a given system (e.g. m88k running svr) needs to use 194 different pseudo-op names for these, they may be overridden in the 195 file which includes this one. */ 196 197#define TYPE_ASM_OP ".type" 198#define SIZE_ASM_OP ".size" 199#define SET_ASM_OP ".set" 200 201/* This is how we tell the assembler that a symbol is weak. */ 202#define ASM_WEAKEN_LABEL(FILE,NAME) \ 203 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ 204 fputc ('\n', FILE); } while (0) 205 206/* The following macro defines the format used to output the second 207 operand of the .type assembler directive. Different svr4 assemblers 208 expect various different forms for this operand. The one given here 209 is just a default. You may need to override it in your machine- 210 specific tm.h file (depending upon the particulars of your assembler). */ 211 212#define TYPE_OPERAND_FMT "@%s" 213 214/* Write the extra assembler code needed to declare a function's result. 215 Most svr4 assemblers don't require any special declaration of the 216 result value, but there are exceptions. */ 217 218#ifndef ASM_DECLARE_RESULT 219#define ASM_DECLARE_RESULT(FILE, RESULT) 220#endif 221 222/* These macros generate the special .type and .size directives which 223 are used to set the corresponding fields of the linker symbol table 224 entries in an ELF object file under SVR4. These macros also output 225 the starting labels for the relevant functions/objects. */ 226 227/* Write the extra assembler code needed to declare a function properly. 228 Some svr4 assemblers need to also have something extra said about the 229 function's return value. We allow for that here. */ 230 231#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 232 do { \ 233 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 234 assemble_name (FILE, NAME); \ 235 putc (',', FILE); \ 236 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 237 putc ('\n', FILE); \ 238 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 239 ASM_OUTPUT_LABEL(FILE, NAME); \ 240 } while (0) 241 242/* Write the extra assembler code needed to declare an object properly. */ 243 244#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 245 do { \ 246 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 247 assemble_name (FILE, NAME); \ 248 putc (',', FILE); \ 249 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 250 putc ('\n', FILE); \ 251 size_directive_output = 0; \ 252 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 253 { \ 254 size_directive_output = 1; \ 255 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 256 assemble_name (FILE, NAME); \ 257 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 258 } \ 259 ASM_OUTPUT_LABEL(FILE, NAME); \ 260 } while (0) 261 262/* Output the size directive for a decl in rest_of_decl_compilation 263 in the case where we did not do so before the initializer. 264 Once we find the error_mark_node, we know that the value of 265 size_directive_output was set 266 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 267 268#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 269do { \ 270 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 271 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 272 && ! AT_END && TOP_LEVEL \ 273 && DECL_INITIAL (DECL) == error_mark_node \ 274 && !size_directive_output) \ 275 { \ 276 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 277 assemble_name (FILE, name); \ 278 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ 279 } \ 280 } while (0) 281 282 283/* This is how to declare the size of a function. */ 284 285#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 286 do { \ 287 if (!flag_inhibit_size_directive) \ 288 { \ 289 char label[256]; \ 290 static int labelno; \ 291 labelno++; \ 292 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ 293 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ 294 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 295 assemble_name (FILE, (FNAME)); \ 296 fprintf (FILE, ","); \ 297 assemble_name (FILE, label); \ 298 fprintf (FILE, "-"); \ 299 assemble_name (FILE, (FNAME)); \ 300 putc ('\n', FILE); \ 301 } \ 302 } while (0) 303