freebsd.h revision 76601
1207618Srdivacky/* Base configuration file for all FreeBSD targets. 2207618Srdivacky Copyright (C) 1999, 2000 Free Software Foundation, Inc. 3207618Srdivacky 4207618SrdivackyThis file is part of GNU CC. 5207618Srdivacky 6207618SrdivackyGNU CC is free software; you can redistribute it and/or modify 7207618Srdivackyit under the terms of the GNU General Public License as published by 8207618Srdivackythe Free Software Foundation; either version 2, or (at your option) 9207618Srdivackyany later version. 10207618Srdivacky 11207618SrdivackyGNU CC is distributed in the hope that it will be useful, 12207618Srdivackybut WITHOUT ANY WARRANTY; without even the implied warranty of 13207618SrdivackyMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14207618SrdivackyGNU General Public License for more details. 15207618Srdivacky 16207618SrdivackyYou should have received a copy of the GNU General Public License 17207618Srdivackyalong with GNU CC; see the file COPYING. If not, write to 18207618Srdivackythe Free Software Foundation, 59 Temple Place - Suite 330, 19207618SrdivackyBoston, MA 02111-1307, USA. */ 20207618Srdivacky 21207618Srdivacky/* Common FreeBSD configuration. 22210299Sed All FreeBSD architectures should include this file, which will specify 23210299Sed their commonalities. 24207618Srdivacky Adapted from /usr/src/contrib/gcc/config/i386/freebsd.h, 25207618Srdivacky /usr/src/contrib/gcc/config/svr4.h & 26207618Srdivacky egcs/gcc/config/i386/freebsd-elf.h by 27207618Srdivacky David O'Brien <obrien@FreeBSD.org>. */ 28207618Srdivacky 29207618Srdivacky/* $FreeBSD: head/contrib/gcc/config/freebsd.h 76601 2001-05-14 22:45:26Z obrien $ */ 30207618Srdivacky 31207618Srdivacky 32207618Srdivacky/* Cpp, assembler, linker, library, and startfile spec's. */ 33207618Srdivacky 34207618Srdivacky/* This defines which switch letters take arguments. On FreeBSD, most of 35207618Srdivacky the normal cases (defined in gcc.c) apply, and we also have -h* and 36207618Srdivacky -z* options (for the linker) (coming from SVR4). 37207618Srdivacky We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ 38207618Srdivacky 39210299Sed#define FBSD_SWITCH_TAKES_ARG(CHAR) \ 40210299Sed (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 41210299Sed || (CHAR) == 'h' \ 42207618Srdivacky || (CHAR) == 'z' /* ignored by ld */ \ 43210299Sed || (CHAR) == 'R') 44207618Srdivacky 45207618Srdivacky#undef SWITCH_TAKES_ARG 46207618Srdivacky#define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR)) 47207618Srdivacky 48207618Srdivacky/* This defines which multi-letter switches take arguments. */ 49207618Srdivacky 50207618Srdivacky#define FBSD_WORD_SWITCH_TAKES_ARG(STR) \ 51207618Srdivacky (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 52207618Srdivacky || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \ 53207618Srdivacky || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \ 54207618Srdivacky || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker")) 55207618Srdivacky 56207618Srdivacky#undef WORD_SWITCH_TAKES_ARG 57207618Srdivacky#define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR)) 58207618Srdivacky 59207618Srdivacky/* Place spaces around this string. We depend on string splicing to produce 60207618Srdivacky the final CPP_PREDEFINES value. */ 61207618Srdivacky 62207618Srdivacky#define FBSD_CPP_PREDEFINES \ 63207618Srdivacky " -D__FreeBSD__=5 -D__FreeBSD_cc_version=500002 -Dunix -Asystem(unix) -Asystem(FreeBSD) " 64207618Srdivacky 65207618Srdivacky#define FBSD_CPP_SPEC " \ 66207618Srdivacky %(cpp_cpu) \ 67207618Srdivacky %{!maout: -D__ELF__} \ 68207618Srdivacky %{munderscores: -D__UNDERSCORES__} \ 69207618Srdivacky %{maout: %{!mno-underscores: -D__UNDERSCORES__}} \ 70207618Srdivacky %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \ 71207618Srdivacky %{posix:-D_POSIX_SOURCE}" 72210299Sed 73218893Sdim#undef CPP_SPEC 74207618Srdivacky#define CPP_SPEC FBSD_CPP_SPEC 75207618Srdivacky 76207618Srdivacky/* Provide a LIB_SPEC appropriate for FreeBSD. Before 77207618Srdivacky __FreeBSD_version 500016, select the appropriate libc, depending on 78207618Srdivacky whether we're doing profiling or need threads support. (similar to 79207618Srdivacky the default, except no -lg, and no -p). At __FreeBSD_version 80207618Srdivacky 500016 and later, when threads support is requested include both 81207618Srdivacky -lc and -lc_r instead of only -lc_r. */ 82207618Srdivacky 83207618Srdivacky#undef LIB_SPEC 84207618Srdivacky#include <sys/param.h> 85207618Srdivacky#if __FreeBSD_version >= 500016 86207618Srdivacky#define LIB_SPEC " \ 87207618Srdivacky %{!shared: \ 88207618Srdivacky %{!pg: %{pthread:-lc_r} -lc} \ 89207618Srdivacky %{pg: %{pthread:-lc_r_p} -lc_p} \ 90207618Srdivacky }" 91207618Srdivacky#else 92207618Srdivacky#define LIB_SPEC " \ 93207618Srdivacky %{!shared: \ 94207618Srdivacky %{!pg: \ 95207618Srdivacky %{!pthread:-lc} \ 96207618Srdivacky %{pthread:-lc_r}} \ 97210299Sed %{pg: \ 98210299Sed %{!pthread:-lc_p} \ 99210299Sed %{pthread:-lc_r_p}} \ 100210299Sed }" 101207618Srdivacky#endif 102207618Srdivacky 103207618Srdivacky 104210299Sed/************************[ Target stuff ]***********************************/ 105207618Srdivacky 106207618Srdivacky/* All FreeBSD Architectures support the ELF object file format. */ 107207618Srdivacky#undef OBJECT_FORMAT_ELF 108207618Srdivacky#define OBJECT_FORMAT_ELF 109207618Srdivacky 110207618Srdivacky/* Don't assume anything about the header files. */ 111218893Sdim#undef NO_IMPLICIT_EXTERN_C 112218893Sdim#define NO_IMPLICIT_EXTERN_C 113218893Sdim 114207618Srdivacky/* Implicit library calls should use memcpy, not bcopy, etc. */ 115207618Srdivacky#undef TARGET_MEM_FUNCTIONS 116207618Srdivacky#define TARGET_MEM_FUNCTIONS 117207618Srdivacky 118207618Srdivacky/* Allow #sccs in preprocessor. */ 119207618Srdivacky#undef SCCS_DIRECTIVE 120210299Sed#define SCCS_DIRECTIVE 121207618Srdivacky 122207618Srdivacky#undef HAVE_ATEXIT 123207618Srdivacky#define HAVE_ATEXIT 124207618Srdivacky 125207618Srdivacky/* Code generation parameters. */ 126207618Srdivacky 127207618Srdivacky/* Don't default to pcc-struct-return, because gcc is the only compiler, and 128207618Srdivacky we want to retain compatibility with older gcc versions 129207618Srdivacky (even though the SVR4 ABI for the i386 says that records and unions are 130207618Srdivacky returned in memory). */ 131207618Srdivacky#undef DEFAULT_PCC_STRUCT_RETURN 132207618Srdivacky#define DEFAULT_PCC_STRUCT_RETURN 0 133207618Srdivacky 134207618Srdivacky/* Writing `int' for a bitfield forces int alignment for the structure. */ 135207618Srdivacky/* XXX: ok for Alpha?? */ 136207618Srdivacky#undef PCC_BITFIELD_TYPE_MATTERS 137207618Srdivacky#define PCC_BITFIELD_TYPE_MATTERS 1 138207618Srdivacky 139207618Srdivacky/* Use periods rather than dollar signs in special g++ assembler names. 140207618Srdivacky This ensures the configuration knows our system correctly so we can link 141207618Srdivacky with libraries compiled with the native cc. */ 142207618Srdivacky#undef NO_DOLLAR_IN_LABEL 143207618Srdivacky 144207618Srdivacky/* The prefix to add to user-visible assembler symbols. 145207618Srdivacky For System V Release 4 & ELF the convention is *not* to prepend a leading 146207618Srdivacky underscore onto user-level symbol names. */ 147207618Srdivacky 148207618Srdivacky#undef USER_LABEL_PREFIX 149207618Srdivacky#define USER_LABEL_PREFIX "" 150218893Sdim 151218893Sdim/* Handle #pragma weak and #pragma pack. */ 152218893Sdim#undef HANDLE_SYSV_PRAGMA 153218893Sdim#define HANDLE_SYSV_PRAGMA 154218893Sdim 155218893Sdim#ifdef WANT_DWARF2_UNWIND 156207618Srdivacky/* FreeBSD ELF uses across the board will now use DWARF2 unwinding as the IA-64 157207618Srdivacky psABI requires it. */ 158207618Srdivacky#define DWARF2_UNWIND_INFO 1 159207618Srdivacky#else 160207618Srdivacky/* Maintain compatibility with the FreeBSD {3,4}.x C++ ABI. */ 161207618Srdivacky#define DWARF2_UNWIND_INFO 0 162207618Srdivacky#endif 163207618Srdivacky 164207618Srdivacky/* Do not use ``thunks'' to implement C++ vtables. This method still has 165207618Srdivacky fatal bugs. Also, GCC 3.0 will have a new C++ ABI that may not even 166207618Srdivacky support `thunks'. */ 167207618Srdivacky#undef DEFAULT_VTABLE_THUNKS 168207618Srdivacky 169207618Srdivacky 170207618Srdivacky/************************[ Assembler stuff ]********************************/ 171207618Srdivacky 172207618Srdivacky/* Override the default comment-starter of "/". */ 173207618Srdivacky#undef ASM_COMMENT_START 174207618Srdivacky#define ASM_COMMENT_START "#" 175210299Sed 176207618Srdivacky/* Attach a special .ident directive to the end of the file to identify 177207618Srdivacky the version of GCC which compiled this code. The format of the .ident 178207618Srdivacky string is patterned after the ones produced by native SVR4 C compilers. */ 179208599Srdivacky 180207618Srdivacky#undef IDENT_ASM_OP 181207618Srdivacky#define IDENT_ASM_OP "\t.ident\t" 182207618Srdivacky 183207618Srdivacky/* Output #ident as a .ident. */ 184207618Srdivacky 185207618Srdivacky#undef ASM_OUTPUT_IDENT 186207618Srdivacky#define ASM_OUTPUT_IDENT(FILE, NAME) \ 187207618Srdivacky fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME)); 188210299Sed 189210299Sed/* Identify the front-end which produced this file. To keep symbol 190207618Srdivacky space down, and not confuse kdb, only do this if the language is 191207618Srdivacky not C. (svr4.h defines ASM_IDENTIFY_GCC but neglects this) */ 192207618Srdivacky 193207618Srdivacky#undef ASM_IDENTIFY_LANGUAGE 194207618Srdivacky#define ASM_IDENTIFY_LANGUAGE(FILE) \ 195207618Srdivacky { \ 196218893Sdim if (strcmp (lang_identify (), "c") != 0) \ 197218893Sdim output_lang_identify (FILE); \ 198207618Srdivacky } 199210299Sed 200207618Srdivacky#undef ASM_FILE_END 201207618Srdivacky#define ASM_FILE_END(FILE) \ 202207618Srdivacky do { \ 203207618Srdivacky if (!flag_no_ident) \ 204207618Srdivacky fprintf ((FILE), "%s\"[ASM_FILE_END]GCC: (%s) %s\"\n", \ 205207618Srdivacky IDENT_ASM_OP, lang_identify(), version_string); \ 206207618Srdivacky } while (0) 207207618Srdivacky 208207618Srdivacky/* This is the pseudo-op used to generate a contiguous sequence of byte 209207618Srdivacky values from a double-quoted string WITHOUT HAVING A TERMINATING NUL 210207618Srdivacky AUTOMATICALLY APPENDED. This is the same for most SVR4 assemblers. */ 211207618Srdivacky 212207618Srdivacky#undef ASCII_DATA_ASM_OP 213210299Sed#define ASCII_DATA_ASM_OP "\t.ascii\t" 214210299Sed 215210299Sed#undef ASM_BYTE_OP 216207618Srdivacky#define ASM_BYTE_OP "\t.byte\t" 217210299Sed 218210299Sed/* This is how to allocate empty space in some section. The .zero 219210299Sed pseudo-op is used for this on most ELF assemblers. */ 220210299Sed 221210299Sed#undef SKIP_ASM_OP 222210299Sed#define SKIP_ASM_OP "\t.zero\t" 223210299Sed 224210299Sed/* A table of bytes codes used by the ASM_OUTPUT_ASCII and 225210299Sed ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table 226210299Sed corresponds to a particular byte value [0..255]. For any 227210299Sed given byte value, if the value in the corresponding table 228207618Srdivacky position is zero, the given character can be output directly. 229218893Sdim If the table value is 1, the byte must be output as a \ooo 230218893Sdim octal escape. If the tables value is anything else, then the 231218893Sdim byte value should be output as a \ followed by the value 232210299Sed in the table. Note that we can use standard UN*X escape 233218893Sdim sequences for many control characters, but we don't use 234218893Sdim \a to represent BEL because some SVR4 assemblers (e.g. on 235218893Sdim the i386) don't know about that. Also, we don't use \v 236218893Sdim since some versions of gas, such as 2.2 did not accept it. */ 237218893Sdim 238218893Sdim#define ESCAPES \ 239218893Sdim"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 240210299Sed\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ 241210299Sed\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ 242210299Sed\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ 243210299Sed\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 244210299Sed\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 245210299Sed\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 246210299Sed\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" 247210299Sed 248210299Sed/* Some SVR4 assemblers have a limit on the number of characters which 249210299Sed can appear in the operand of a .string directive. If your assembler 250210299Sed has such a limitation, you should define STRING_LIMIT to reflect that 251207618Srdivacky limit. Note that at least some SVR4 assemblers have a limit on the 252207618Srdivacky actual number of bytes in the double-quoted string, and that they 253208599Srdivacky count each character in an escape sequence as one byte. Thus, an 254208599Srdivacky escape sequence like \377 would count as four bytes. 255208599Srdivacky 256210299Sed If your target assembler doesn't support the .string directive, you 257210299Sed should define this to zero. 258208599Srdivacky*/ 259210299Sed 260208599Srdivacky#undef STRING_LIMIT 261207618Srdivacky#define STRING_LIMIT ((unsigned) 256) 262208599Srdivacky 263207618Srdivacky#undef STRING_ASM_OP 264207618Srdivacky#define STRING_ASM_OP "\t.string\t" 265207618Srdivacky 266207618Srdivacky/* Output the label which precedes a jumptable. Note that for all svr4/ELF 267207618Srdivacky systems where we actually generate jumptables (which is to say every 268207618Srdivacky SVR4 target except i386, where we use casesi instead) we put the jump- 269207618Srdivacky tables into the .rodata section and since other stuff could have been 270207618Srdivacky put into the .rodata section prior to any given jumptable, we have to 271210299Sed make sure that the location counter for the .rodata section gets pro- 272218893Sdim perly re-aligned prior to the actual beginning of the jump table. */ 273218893Sdim 274207618Srdivacky#undef ALIGN_ASM_OP 275218893Sdim#define ALIGN_ASM_OP "\t.align\t" 276218893Sdim 277207618Srdivacky/* This says how to output assembler code to declare an 278207618Srdivacky uninitialized external linkage data object. Under SVR4/ELF, 279207618Srdivacky the linker seems to want the alignment of data objects 280207618Srdivacky to depend on their types. We do exactly that here. */ 281207618Srdivacky 282218893Sdim#undef COMMON_ASM_OP 283207618Srdivacky#define COMMON_ASM_OP "\t.comm\t" 284210299Sed 285210299Sed/* This says how to output assembler code to declare an 286207618Srdivacky uninitialized internal linkage data object. Under SVR4/ELF, 287207618Srdivacky the linker seems to want the alignment of data objects 288207618Srdivacky to depend on their types. We do exactly that here. */ 289207618Srdivacky 290207618Srdivacky#undef LOCAL_ASM_OP 291207618Srdivacky#define LOCAL_ASM_OP "\t.local\t" 292207618Srdivacky 293207618Srdivacky#undef ASM_OUTPUT_BEFORE_CASE_LABEL 294207618Srdivacky#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ 295210299Sed ASM_OUTPUT_ALIGN ((FILE), 2); 296218893Sdim 297218893Sdim#undef ASM_OUTPUT_CASE_LABEL 298207618Srdivacky#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ 299218893Sdim do { \ 300218893Sdim ASM_OUTPUT_BEFORE_CASE_LABEL ((FILE), (PREFIX), (NUM), (JUMPTABLE)) \ 301207618Srdivacky ASM_OUTPUT_INTERNAL_LABEL ((FILE), (PREFIX), (NUM)); \ 302207618Srdivacky } while (0) 303207618Srdivacky 304207618Srdivacky/* The standard SVR4/ELF assembler seems to require that certain builtin 305207618Srdivacky library routines (e.g. .udiv) be explicitly declared as .globl 306210299Sed in each assembly file where they are referenced. */ 307218893Sdim 308218893Sdim#undef ASM_OUTPUT_EXTERNAL_LIBCALL 309207618Srdivacky#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 310207618Srdivacky ASM_GLOBALIZE_LABEL ((FILE), XSTR ((FUN), 0)) 311207618Srdivacky 312207618Srdivacky/* Support const sections and the ctors and dtors sections for g++. 313207618Srdivacky Note that there appears to be two different ways to support const 314207618Srdivacky sections at the moment. You can either #define the symbol 315207618Srdivacky READONLY_DATA_SECTION (giving it some code which switches to the 316207618Srdivacky readonly data section) or else you can #define the symbols 317207618Srdivacky EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and 318218893Sdim SELECT_RTX_SECTION. We do both here just to be on the safe side. 319218893Sdim FreeBSD conditionalizes the use of ".section rodata" depending on 320207618Srdivacky ELF mode - otherwise .text. */ 321207618Srdivacky 322218893Sdim#undef USE_CONST_SECTION 323218893Sdim#define USE_CONST_SECTION TARGET_ELF 324218893Sdim 325218893Sdim#undef CONST_SECTION_ASM_OP 326207618Srdivacky#define CONST_SECTION_ASM_OP "\t.section\t.rodata" 327207618Srdivacky 328218893Sdim/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. 329218893Sdim 330207618Srdivacky Note that we want to give these sections the SHF_WRITE attribute 331207618Srdivacky because these sections will actually contain data (i.e. tables of 332207618Srdivacky addresses of functions in the current root executable or shared library 333208599Srdivacky file) and, in the case of a shared library, the relocatable addresses 334208599Srdivacky will have to be properly resolved/relocated (and then written into) by 335208599Srdivacky the dynamic linker when it actually attaches the given shared library 336218893Sdim to the executing process. (Note that on SVR4, you may wish to use the 337218893Sdim `-z text' option to the ELF linker, when building a shared library, as 338207618Srdivacky an additional check that you are doing everything right. But if you do 339207618Srdivacky use the `-z text' option when building a shared library, you will get 340207618Srdivacky errors unless the .ctors and .dtors sections are marked as writable 341207618Srdivacky via the SHF_WRITE attribute.) */ 342207618Srdivacky 343207618Srdivacky#undef CTORS_SECTION_ASM_OP 344207618Srdivacky#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" 345207618Srdivacky#undef DTORS_SECTION_ASM_OP 346207618Srdivacky#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" 347207618Srdivacky 348207618Srdivacky/* On SVR4, we *do* have support for the .init and .fini sections, and we 349207618Srdivacky can put stuff in there to be executed before and after `main'. We let 350207618Srdivacky crtstuff.c and other files know this by defining the following symbols. 351207618Srdivacky The definitions say how to change sections to the .init and .fini 352207618Srdivacky sections. This is the same for all known SVR4 assemblers. */ 353207618Srdivacky 354207618Srdivacky#undef INIT_SECTION_ASM_OP 355210299Sed#define INIT_SECTION_ASM_OP "\t.section\t.init" 356210299Sed#undef FINI_SECTION_ASM_OP 357210299Sed#define FINI_SECTION_ASM_OP "\t.section\t.fini" 358210299Sed 359210299Sed/* A default list of other sections which we might be "in" at any given 360210299Sed time. For targets that use additional sections (e.g. .tdesc) you 361207618Srdivacky should override this definition in the target-specific file which 362207618Srdivacky includes this file. */ 363210299Sed 364210299Sed#undef EXTRA_SECTIONS 365207618Srdivacky#define EXTRA_SECTIONS in_const, in_ctors, in_dtors 366218893Sdim 367210299Sed/* A default list of extra section function definitions. For targets 368210299Sed that use additional sections (e.g. .tdesc) you should override this 369210299Sed definition in the target-specific file which includes this file. */ 370210299Sed 371210299Sed#undef EXTRA_SECTION_FUNCTIONS 372210299Sed#define EXTRA_SECTION_FUNCTIONS \ 373210299Sed CONST_SECTION_FUNCTION \ 374207618Srdivacky CTORS_SECTION_FUNCTION \ 375207618Srdivacky DTORS_SECTION_FUNCTION 376207618Srdivacky 377207618Srdivacky#undef READONLY_DATA_SECTION 378210299Sed#define READONLY_DATA_SECTION() const_section () 379210299Sed 380210299Sedextern void text_section (); 381210299Sed 382210299Sed#undef CONST_SECTION_FUNCTION 383210299Sed#define CONST_SECTION_FUNCTION \ 384207618Srdivacky void \ 385207618Srdivacky const_section () \ 386207618Srdivacky { \ 387207618Srdivacky if (!USE_CONST_SECTION) \ 388207618Srdivacky text_section(); \ 389207618Srdivacky else if (in_section != in_const) \ 390207618Srdivacky { \ 391207618Srdivacky fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ 392207618Srdivacky in_section = in_const; \ 393207618Srdivacky } \ 394207618Srdivacky } 395207618Srdivacky 396207618Srdivacky#undef CTORS_SECTION_FUNCTION 397207618Srdivacky#define CTORS_SECTION_FUNCTION \ 398207618Srdivacky void \ 399207618Srdivacky ctors_section () \ 400207618Srdivacky { \ 401207618Srdivacky if (in_section != in_ctors) \ 402207618Srdivacky { \ 403207618Srdivacky fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ 404207618Srdivacky in_section = in_ctors; \ 405207618Srdivacky } \ 406207618Srdivacky } 407207618Srdivacky 408207618Srdivacky#undef DTORS_SECTION_FUNCTION 409207618Srdivacky#define DTORS_SECTION_FUNCTION \ 410207618Srdivacky void \ 411207618Srdivacky dtors_section () \ 412207618Srdivacky { \ 413207618Srdivacky if (in_section != in_dtors) \ 414207618Srdivacky { \ 415207618Srdivacky fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ 416207618Srdivacky in_section = in_dtors; \ 417207618Srdivacky } \ 418207618Srdivacky } 419207618Srdivacky 420207618Srdivacky/* A C statement or statements to switch to the appropriate 421207618Srdivacky section for output of RTX in mode MODE. RTX is some kind 422207618Srdivacky of constant in RTL. The argument MODE is redundant except 423207618Srdivacky in the case of a `const_int' rtx. Currently, these always 424210299Sed go into the const section. */ 425210299Sed 426210299Sed#undef SELECT_RTX_SECTION 427207618Srdivacky#define SELECT_RTX_SECTION(MODE, RTX) const_section() 428207618Srdivacky 429207618Srdivacky/* Define the strings used for the special svr4/ELF .type and .size 430210299Sed directives. These strings generally do not vary from one svr4/ELF 431210299Sed system to another. */ 432210299Sed 433210299Sed#undef TYPE_ASM_OP 434207618Srdivacky#define TYPE_ASM_OP "\t.type\t" 435207618Srdivacky#undef SIZE_ASM_OP 436207618Srdivacky#define SIZE_ASM_OP "\t.size\t" 437207618Srdivacky 438207618Srdivacky/* This is how we tell the assembler that a symbol is weak. */ 439207618Srdivacky 440207618Srdivacky#undef ASM_WEAKEN_LABEL 441207618Srdivacky#define ASM_WEAKEN_LABEL(FILE, NAME) \ 442207618Srdivacky do { \ 443207618Srdivacky fputs ("\t.globl\t", (FILE)); assemble_name ((FILE), (NAME)); \ 444207618Srdivacky fputc ('\n', (FILE)); \ 445207618Srdivacky fputs ("\t.weak\t", (FILE)); assemble_name ((FILE), (NAME)); \ 446207618Srdivacky fputc ('\n', (FILE)); \ 447207618Srdivacky } while (0) 448207618Srdivacky 449207618Srdivacky/* The following macro defines the [default] format used with ELF to output 450210299Sed the second operand of the .type assembler directive. */ 451207618Srdivacky 452207618Srdivacky#undef TYPE_OPERAND_FMT 453207618Srdivacky#define TYPE_OPERAND_FMT "@%s" 454207618Srdivacky 455207618Srdivacky/* Write the extra assembler code needed to declare a function's result. 456207618Srdivacky Most svr4/ELF assemblers don't require any special declaration of the 457210299Sed result value. */ 458207618Srdivacky 459207618Srdivacky#undef ASM_DECLARE_RESULT 460207618Srdivacky#define ASM_DECLARE_RESULT(FILE, RESULT) 461207618Srdivacky 462207618Srdivacky/* These macros generate the special .type and .size directives which 463207618Srdivacky are used to set the corresponding fields of the linker symbol table 464210299Sed entries in an ELF object file under SVR4/ELF. These macros also output 465207618Srdivacky the starting labels for the relevant functions/objects. */ 466207618Srdivacky 467207618Srdivacky/* Write the extra assembler code needed to declare an object properly. */ 468207618Srdivacky 469207618Srdivacky#undef ASM_DECLARE_OBJECT_NAME 470207618Srdivacky#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 471207618Srdivacky do { \ 472207618Srdivacky fprintf (FILE, "%s ", TYPE_ASM_OP); \ 473207618Srdivacky assemble_name (FILE, NAME); \ 474207618Srdivacky putc (',', FILE); \ 475207618Srdivacky fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 476207618Srdivacky putc ('\n', FILE); \ 477207618Srdivacky size_directive_output = 0; \ 478207618Srdivacky if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 479207618Srdivacky { \ 480207618Srdivacky size_directive_output = 1; \ 481207618Srdivacky fprintf (FILE, "%s ", SIZE_ASM_OP); \ 482207618Srdivacky assemble_name (FILE, NAME); \ 483207618Srdivacky putc (',', FILE); \ 484207618Srdivacky fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ 485207618Srdivacky int_size_in_bytes (TREE_TYPE (DECL))); \ 486207618Srdivacky fputc ('\n', FILE); \ 487207618Srdivacky } \ 488207618Srdivacky ASM_OUTPUT_LABEL(FILE, NAME); \ 489207618Srdivacky } while (0) 490207618Srdivacky 491207618Srdivacky/* Output the size directive for a decl in rest_of_decl_compilation 492207618Srdivacky in the case where we did not do so before the initializer. 493207618Srdivacky Once we find the error_mark_node, we know that the value of 494207618Srdivacky size_directive_output was set 495207618Srdivacky by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 496207618Srdivacky 497207618Srdivacky#undef ASM_FINISH_DECLARE_OBJECT 498207618Srdivacky#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 499207618Srdivacky do { \ 500207618Srdivacky char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 501207618Srdivacky if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 502207618Srdivacky && ! AT_END && TOP_LEVEL \ 503207618Srdivacky && DECL_INITIAL (DECL) == error_mark_node \ 504207618Srdivacky && !size_directive_output) \ 505210299Sed { \ 506210299Sed size_directive_output = 1; \ 507207618Srdivacky fprintf (FILE, "%s ", SIZE_ASM_OP); \ 508207618Srdivacky assemble_name (FILE, name); \ 509207618Srdivacky putc (',', FILE); \ 510218893Sdim fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ 511207618Srdivacky int_size_in_bytes (TREE_TYPE (DECL))); \ 512207618Srdivacky fputc ('\n', FILE); \ 513207618Srdivacky } \ 514207618Srdivacky } while (0) 515218893Sdim 516218893Sdim 517212904Sdim/************************[ Debugger stuff ]*********************************/ 518212904Sdim 519212904Sdim/* All ELF targets can support DWARF-2. */ 520207618Srdivacky#undef DWARF2_DEBUGGING_INFO 521207618Srdivacky#define DWARF2_DEBUGGING_INFO 522207618Srdivacky 523207618Srdivacky/* This is BSD, so we want the DBX format. */ 524210299Sed#undef DBX_DEBUGGING_INFO 525210299Sed#define DBX_DEBUGGING_INFO 526207618Srdivacky 527207618Srdivacky/* This is BSD, so use stabs instead of DWARF debug format. */ 528207618Srdivacky#undef PREFERRED_DEBUGGING_TYPE 529207618Srdivacky#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 530207618Srdivacky 531207618Srdivacky/* But allow STABS to be supported as well. 532210299Sed Note that we want to override some definition settings done for some 533210299Sed architecture's native OS's tools that don't apply to us. */ 534207618Srdivacky#undef ASM_IDENTIFY_GCC 535207618Srdivacky#undef ASM_IDENTIFY_LANGUAGE 536207618Srdivacky