freebsd.h revision 73304
1179404Sobrien/* Base configuration file for all FreeBSD targets. 2179404Sobrien Copyright (C) 1999, 2000 Free Software Foundation, Inc. 3179404Sobrien 4218822SdimThis file is part of GNU CC. 5179404Sobrien 6179404SobrienGNU CC is free software; you can redistribute it and/or modify 7179404Sobrienit under the terms of the GNU General Public License as published by 8179404Sobrienthe Free Software Foundation; either version 2, or (at your option) 9179404Sobrienany later version. 10179404Sobrien 11179404SobrienGNU CC is distributed in the hope that it will be useful, 12179404Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 13179404SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14179404SobrienGNU General Public License for more details. 15179404Sobrien 16179404SobrienYou should have received a copy of the GNU General Public License 17179404Sobrienalong with GNU CC; see the file COPYING. If not, write to 18218822Sdimthe Free Software Foundation, 59 Temple Place - Suite 330, 19179404SobrienBoston, MA 02111-1307, USA. */ 20179404Sobrien 21179404Sobrien/* Common FreeBSD configuration. 22179404Sobrien All FreeBSD architectures should include this file, which will specify 23179404Sobrien their commonalities. 24179404Sobrien Adapted from /usr/src/contrib/gcc/config/i386/freebsd.h, 25179404Sobrien /usr/src/contrib/gcc/config/svr4.h & 26179404Sobrien egcs/gcc/config/i386/freebsd-elf.h by 27179404Sobrien David O'Brien <obrien@FreeBSD.org>. */ 28179404Sobrien 29179404Sobrien/* $FreeBSD: head/contrib/gcc/config/freebsd.h 73304 2001-03-02 02:42:42Z obrien $ */ 30179404Sobrien 31179404Sobrien 32179404Sobrien/* Cpp, assembler, linker, library, and startfile spec's. */ 33179404Sobrien 34179404Sobrien/* This defines which switch letters take arguments. On FreeBSD, most of 35179404Sobrien the normal cases (defined in gcc.c) apply, and we also have -h* and 36179404Sobrien -z* options (for the linker) (coming from SVR4). 37179404Sobrien We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ 38179404Sobrien 39179404Sobrien#define FBSD_SWITCH_TAKES_ARG(CHAR) \ 40179404Sobrien (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 41179404Sobrien || (CHAR) == 'h' \ 42179404Sobrien || (CHAR) == 'z' /* ignored by ld */ \ 43179404Sobrien || (CHAR) == 'R') 44179404Sobrien 45179404Sobrien#undef SWITCH_TAKES_ARG 46179404Sobrien#define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR)) 47179404Sobrien 48179404Sobrien/* This defines which multi-letter switches take arguments. */ 49179404Sobrien 50179404Sobrien#define FBSD_WORD_SWITCH_TAKES_ARG(STR) \ 51179404Sobrien (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 52179404Sobrien || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \ 53179404Sobrien || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \ 54179404Sobrien || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker")) 55179404Sobrien 56179404Sobrien#undef WORD_SWITCH_TAKES_ARG 57179404Sobrien#define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR)) 58179404Sobrien 59179404Sobrien/* Place spaces around this string. We depend on string splicing to produce 60179404Sobrien the final CPP_PREDEFINES value. */ 61179404Sobrien 62179404Sobrien#define FBSD_CPP_PREDEFINES \ 63179404Sobrien " -D__FreeBSD__=5 -D__FreeBSD_cc_version=500002 -Dunix -Asystem(unix) -Asystem(FreeBSD) " 64179404Sobrien 65179404Sobrien#define FBSD_CPP_SPEC " \ 66179404Sobrien %(cpp_cpu) \ 67179404Sobrien %{!maout: -D__ELF__} \ 68179404Sobrien %{munderscores: -D__UNDERSCORES__} \ 69179404Sobrien %{maout: %{!mno-underscores: -D__UNDERSCORES__}} \ 70179404Sobrien %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \ 71179404Sobrien %{posix:-D_POSIX_SOURCE}" 72179404Sobrien 73179404Sobrien#undef CPP_SPEC 74179404Sobrien#define CPP_SPEC FBSD_CPP_SPEC 75179404Sobrien 76179404Sobrien/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate 77179404Sobrien libc, depending on whether we're doing profiling or need threads support. 78179404Sobrien (simular to the default, except no -lg, and no -p). */ 79179404Sobrien 80179404Sobrien#undef LIB_SPEC 81179404Sobrien#define LIB_SPEC " \ 82179404Sobrien %{!shared: \ 83179404Sobrien %{!pg: %{pthread:-lc_r} -lc} \ 84179404Sobrien %{pg: %{pthread:-lc_r_p} -lc_p} \ 85179404Sobrien }" 86179404Sobrien 87179404Sobrien 88179404Sobrien/************************[ Target stuff ]***********************************/ 89179404Sobrien 90179404Sobrien/* All FreeBSD Architectures support the ELF object file format. */ 91179404Sobrien#undef OBJECT_FORMAT_ELF 92179404Sobrien#define OBJECT_FORMAT_ELF 93179404Sobrien 94179404Sobrien/* Don't assume anything about the header files. */ 95179404Sobrien#undef NO_IMPLICIT_EXTERN_C 96179404Sobrien#define NO_IMPLICIT_EXTERN_C 97179404Sobrien 98179404Sobrien/* Implicit library calls should use memcpy, not bcopy, etc. */ 99179404Sobrien#undef TARGET_MEM_FUNCTIONS 100179404Sobrien#define TARGET_MEM_FUNCTIONS 101179404Sobrien 102179404Sobrien/* Allow #sccs in preprocessor. */ 103179404Sobrien#undef SCCS_DIRECTIVE 104179404Sobrien#define SCCS_DIRECTIVE 105179404Sobrien 106179404Sobrien#undef HAVE_ATEXIT 107179404Sobrien#define HAVE_ATEXIT 108218822Sdim 109218822Sdim/* Code generation parameters. */ 110218822Sdim 111179404Sobrien/* Don't default to pcc-struct-return, because gcc is the only compiler, and 112179404Sobrien we want to retain compatibility with older gcc versions 113179404Sobrien (even though the SVR4 ABI for the i386 says that records and unions are 114179404Sobrien returned in memory). */ 115179404Sobrien#undef DEFAULT_PCC_STRUCT_RETURN 116179404Sobrien#define DEFAULT_PCC_STRUCT_RETURN 0 117179404Sobrien 118179404Sobrien/* Writing `int' for a bitfield forces int alignment for the structure. */ 119179404Sobrien/* XXX: ok for Alpha?? */ 120179404Sobrien#undef PCC_BITFIELD_TYPE_MATTERS 121179404Sobrien#define PCC_BITFIELD_TYPE_MATTERS 1 122179404Sobrien 123179404Sobrien/* Use periods rather than dollar signs in special g++ assembler names. 124179404Sobrien This ensures the configuration knows our system correctly so we can link 125179404Sobrien with libraries compiled with the native cc. */ 126179404Sobrien#undef NO_DOLLAR_IN_LABEL 127179404Sobrien 128179404Sobrien/* The prefix to add to user-visible assembler symbols. 129179404Sobrien For System V Release 4 & ELF the convention is *not* to prepend a leading 130179404Sobrien underscore onto user-level symbol names. */ 131179404Sobrien 132179404Sobrien#undef USER_LABEL_PREFIX 133179404Sobrien#define USER_LABEL_PREFIX "" 134179404Sobrien 135179404Sobrien/* Handle #pragma weak and #pragma pack. */ 136179404Sobrien#undef HANDLE_SYSV_PRAGMA 137179404Sobrien#define HANDLE_SYSV_PRAGMA 138179404Sobrien 139179404Sobrien/* FreeBSD ELF uses across the board will now use DWARF2 unwinding as the IA-64 140179404Sobrien psABI requires it. */ 141179404Sobrien#define DWARF2_UNWIND_INFO 0 142179404Sobrien 143179404Sobrien/* Do not use ``thunks'' to implement C++ vtables. This method still has 144179404Sobrien fatal bugs. Also, GCC 3.0 will have a new C++ ABI that may not even 145179404Sobrien support `thunks'. */ 146179404Sobrien#undef DEFAULT_VTABLE_THUNKS 147179404Sobrien 148179404Sobrien 149179404Sobrien/************************[ Assembler stuff ]********************************/ 150179404Sobrien 151179404Sobrien/* Override the default comment-starter of "/". */ 152179404Sobrien#undef ASM_COMMENT_START 153179404Sobrien#define ASM_COMMENT_START "#" 154179404Sobrien 155179404Sobrien/* Attach a special .ident directive to the end of the file to identify 156179404Sobrien the version of GCC which compiled this code. The format of the .ident 157179404Sobrien string is patterned after the ones produced by native SVR4 C compilers. */ 158179404Sobrien 159179404Sobrien#undef IDENT_ASM_OP 160179404Sobrien#define IDENT_ASM_OP "\t.ident\t" 161179404Sobrien 162179404Sobrien/* Output #ident as a .ident. */ 163179404Sobrien 164179404Sobrien#undef ASM_OUTPUT_IDENT 165179404Sobrien#define ASM_OUTPUT_IDENT(FILE, NAME) \ 166179404Sobrien fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME)); 167179404Sobrien 168179404Sobrien/* Identify the front-end which produced this file. To keep symbol 169179404Sobrien space down, and not confuse kdb, only do this if the language is 170179404Sobrien not C. (svr4.h defines ASM_IDENTIFY_GCC but neglects this) */ 171179404Sobrien 172179404Sobrien#undef ASM_IDENTIFY_LANGUAGE 173179404Sobrien#define ASM_IDENTIFY_LANGUAGE(FILE) \ 174179404Sobrien { \ 175179404Sobrien if (strcmp (lang_identify (), "c") != 0) \ 176179404Sobrien output_lang_identify (FILE); \ 177179404Sobrien } 178179404Sobrien 179179404Sobrien#undef ASM_FILE_END 180179404Sobrien#define ASM_FILE_END(FILE) \ 181179404Sobrien do { \ 182179404Sobrien if (!flag_no_ident) \ 183179404Sobrien fprintf ((FILE), "%s\"[ASM_FILE_END]GCC: (%s) %s\"\n", \ 184179404Sobrien IDENT_ASM_OP, lang_identify(), version_string); \ 185179404Sobrien } while (0) 186179404Sobrien 187179404Sobrien/* This is the pseudo-op used to generate a contiguous sequence of byte 188179404Sobrien values from a double-quoted string WITHOUT HAVING A TERMINATING NUL 189179404Sobrien AUTOMATICALLY APPENDED. This is the same for most SVR4 assemblers. */ 190179404Sobrien 191179404Sobrien#undef ASCII_DATA_ASM_OP 192179404Sobrien#define ASCII_DATA_ASM_OP "\t.ascii\t" 193179404Sobrien 194179404Sobrien#undef ASM_BYTE_OP 195179404Sobrien#define ASM_BYTE_OP "\t.byte\t" 196179404Sobrien 197179404Sobrien/* This is how to allocate empty space in some section. The .zero 198179404Sobrien pseudo-op is used for this on most ELF assemblers. */ 199179404Sobrien 200179404Sobrien#undef SKIP_ASM_OP 201179404Sobrien#define SKIP_ASM_OP "\t.zero\t" 202179404Sobrien 203179404Sobrien/* A table of bytes codes used by the ASM_OUTPUT_ASCII and 204179404Sobrien ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table 205179404Sobrien corresponds to a particular byte value [0..255]. For any 206179404Sobrien given byte value, if the value in the corresponding table 207179404Sobrien position is zero, the given character can be output directly. 208179404Sobrien If the table value is 1, the byte must be output as a \ooo 209179404Sobrien octal escape. If the tables value is anything else, then the 210179404Sobrien byte value should be output as a \ followed by the value 211179404Sobrien in the table. Note that we can use standard UN*X escape 212179404Sobrien sequences for many control characters, but we don't use 213179404Sobrien \a to represent BEL because some SVR4 assemblers (e.g. on 214179404Sobrien the i386) don't know about that. Also, we don't use \v 215179404Sobrien since some versions of gas, such as 2.2 did not accept it. */ 216179404Sobrien 217179404Sobrien#define ESCAPES \ 218179404Sobrien"\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\ 219179404Sobrien\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\ 220179404Sobrien\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\ 221179404Sobrien\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\ 222179404Sobrien\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\ 223179404Sobrien\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\ 224179404Sobrien\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\ 225179404Sobrien\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" 226179404Sobrien 227179404Sobrien/* Some SVR4 assemblers have a limit on the number of characters which 228179404Sobrien can appear in the operand of a .string directive. If your assembler 229179404Sobrien has such a limitation, you should define STRING_LIMIT to reflect that 230179404Sobrien limit. Note that at least some SVR4 assemblers have a limit on the 231179404Sobrien actual number of bytes in the double-quoted string, and that they 232179404Sobrien count each character in an escape sequence as one byte. Thus, an 233179404Sobrien escape sequence like \377 would count as four bytes. 234179404Sobrien 235179404Sobrien If your target assembler doesn't support the .string directive, you 236179404Sobrien should define this to zero. 237179404Sobrien*/ 238179404Sobrien 239179404Sobrien#undef STRING_LIMIT 240179404Sobrien#define STRING_LIMIT ((unsigned) 256) 241179404Sobrien 242179404Sobrien#undef STRING_ASM_OP 243179404Sobrien#define STRING_ASM_OP "\t.string\t" 244179404Sobrien 245179404Sobrien/* Output the label which precedes a jumptable. Note that for all svr4/ELF 246179404Sobrien systems where we actually generate jumptables (which is to say every 247179404Sobrien SVR4 target except i386, where we use casesi instead) we put the jump- 248179404Sobrien tables into the .rodata section and since other stuff could have been 249179404Sobrien put into the .rodata section prior to any given jumptable, we have to 250179404Sobrien make sure that the location counter for the .rodata section gets pro- 251179404Sobrien perly re-aligned prior to the actual beginning of the jump table. */ 252179404Sobrien 253179404Sobrien#undef ALIGN_ASM_OP 254179404Sobrien#define ALIGN_ASM_OP "\t.align\t" 255179404Sobrien 256179404Sobrien/* This says how to output assembler code to declare an 257179404Sobrien uninitialized external linkage data object. Under SVR4/ELF, 258179404Sobrien the linker seems to want the alignment of data objects 259179404Sobrien to depend on their types. We do exactly that here. */ 260179404Sobrien 261179404Sobrien#undef COMMON_ASM_OP 262179404Sobrien#define COMMON_ASM_OP "\t.comm\t" 263179404Sobrien 264179404Sobrien/* This says how to output assembler code to declare an 265179404Sobrien uninitialized internal linkage data object. Under SVR4/ELF, 266179404Sobrien the linker seems to want the alignment of data objects 267179404Sobrien to depend on their types. We do exactly that here. */ 268179404Sobrien 269179404Sobrien#undef LOCAL_ASM_OP 270179404Sobrien#define LOCAL_ASM_OP "\t.local\t" 271179404Sobrien 272179404Sobrien#undef ASM_OUTPUT_BEFORE_CASE_LABEL 273179404Sobrien#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ 274179404Sobrien ASM_OUTPUT_ALIGN ((FILE), 2); 275179404Sobrien 276179404Sobrien#undef ASM_OUTPUT_CASE_LABEL 277179404Sobrien#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ 278179404Sobrien do { \ 279179404Sobrien ASM_OUTPUT_BEFORE_CASE_LABEL ((FILE), (PREFIX), (NUM), (JUMPTABLE)) \ 280179404Sobrien ASM_OUTPUT_INTERNAL_LABEL ((FILE), (PREFIX), (NUM)); \ 281179404Sobrien } while (0) 282179404Sobrien 283179404Sobrien/* The standard SVR4/ELF assembler seems to require that certain builtin 284179404Sobrien library routines (e.g. .udiv) be explicitly declared as .globl 285179404Sobrien in each assembly file where they are referenced. */ 286179404Sobrien 287179404Sobrien#undef ASM_OUTPUT_EXTERNAL_LIBCALL 288179404Sobrien#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 289179404Sobrien ASM_GLOBALIZE_LABEL ((FILE), XSTR ((FUN), 0)) 290179404Sobrien 291179404Sobrien/* Support const sections and the ctors and dtors sections for g++. 292179404Sobrien Note that there appears to be two different ways to support const 293179404Sobrien sections at the moment. You can either #define the symbol 294179404Sobrien READONLY_DATA_SECTION (giving it some code which switches to the 295179404Sobrien readonly data section) or else you can #define the symbols 296179404Sobrien EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and 297179404Sobrien SELECT_RTX_SECTION. We do both here just to be on the safe side. 298179404Sobrien FreeBSD conditionalizes the use of ".section rodata" depending on 299179404Sobrien ELF mode - otherwise .text. */ 300179404Sobrien 301179404Sobrien#undef USE_CONST_SECTION 302179404Sobrien#define USE_CONST_SECTION TARGET_ELF 303179404Sobrien 304179404Sobrien#undef CONST_SECTION_ASM_OP 305179404Sobrien#define CONST_SECTION_ASM_OP "\t.section\t.rodata" 306179404Sobrien 307179404Sobrien/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. 308179404Sobrien 309179404Sobrien Note that we want to give these sections the SHF_WRITE attribute 310179404Sobrien because these sections will actually contain data (i.e. tables of 311179404Sobrien addresses of functions in the current root executable or shared library 312179404Sobrien file) and, in the case of a shared library, the relocatable addresses 313179404Sobrien will have to be properly resolved/relocated (and then written into) by 314179404Sobrien the dynamic linker when it actually attaches the given shared library 315179404Sobrien to the executing process. (Note that on SVR4, you may wish to use the 316179404Sobrien `-z text' option to the ELF linker, when building a shared library, as 317179404Sobrien an additional check that you are doing everything right. But if you do 318179404Sobrien use the `-z text' option when building a shared library, you will get 319179404Sobrien errors unless the .ctors and .dtors sections are marked as writable 320179404Sobrien via the SHF_WRITE attribute.) */ 321179404Sobrien 322179404Sobrien#undef CTORS_SECTION_ASM_OP 323179404Sobrien#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" 324179404Sobrien#undef DTORS_SECTION_ASM_OP 325179404Sobrien#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" 326179404Sobrien 327179404Sobrien/* On SVR4, we *do* have support for the .init and .fini sections, and we 328179404Sobrien can put stuff in there to be executed before and after `main'. We let 329179404Sobrien crtstuff.c and other files know this by defining the following symbols. 330179404Sobrien The definitions say how to change sections to the .init and .fini 331179404Sobrien sections. This is the same for all known SVR4 assemblers. */ 332179404Sobrien 333179404Sobrien#undef INIT_SECTION_ASM_OP 334179404Sobrien#define INIT_SECTION_ASM_OP "\t.section\t.init" 335179404Sobrien#undef FINI_SECTION_ASM_OP 336179404Sobrien#define FINI_SECTION_ASM_OP "\t.section\t.fini" 337179404Sobrien 338179404Sobrien/* A default list of other sections which we might be "in" at any given 339179404Sobrien time. For targets that use additional sections (e.g. .tdesc) you 340179404Sobrien should override this definition in the target-specific file which 341179404Sobrien includes this file. */ 342179404Sobrien 343179404Sobrien#undef EXTRA_SECTIONS 344#define EXTRA_SECTIONS in_const, in_ctors, in_dtors 345 346/* A default list of extra section function definitions. For targets 347 that use additional sections (e.g. .tdesc) you should override this 348 definition in the target-specific file which includes this file. */ 349 350#undef EXTRA_SECTION_FUNCTIONS 351#define EXTRA_SECTION_FUNCTIONS \ 352 CONST_SECTION_FUNCTION \ 353 CTORS_SECTION_FUNCTION \ 354 DTORS_SECTION_FUNCTION 355 356#undef READONLY_DATA_SECTION 357#define READONLY_DATA_SECTION() const_section () 358 359extern void text_section (); 360 361#undef CONST_SECTION_FUNCTION 362#define CONST_SECTION_FUNCTION \ 363 void \ 364 const_section () \ 365 { \ 366 if (!USE_CONST_SECTION) \ 367 text_section(); \ 368 else if (in_section != in_const) \ 369 { \ 370 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ 371 in_section = in_const; \ 372 } \ 373 } 374 375#undef CTORS_SECTION_FUNCTION 376#define CTORS_SECTION_FUNCTION \ 377 void \ 378 ctors_section () \ 379 { \ 380 if (in_section != in_ctors) \ 381 { \ 382 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ 383 in_section = in_ctors; \ 384 } \ 385 } 386 387#undef DTORS_SECTION_FUNCTION 388#define DTORS_SECTION_FUNCTION \ 389 void \ 390 dtors_section () \ 391 { \ 392 if (in_section != in_dtors) \ 393 { \ 394 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ 395 in_section = in_dtors; \ 396 } \ 397 } 398 399/* A C statement or statements to switch to the appropriate 400 section for output of RTX in mode MODE. RTX is some kind 401 of constant in RTL. The argument MODE is redundant except 402 in the case of a `const_int' rtx. Currently, these always 403 go into the const section. */ 404 405#undef SELECT_RTX_SECTION 406#define SELECT_RTX_SECTION(MODE, RTX) const_section() 407 408/* Define the strings used for the special svr4/ELF .type and .size 409 directives. These strings generally do not vary from one svr4/ELF 410 system to another. */ 411 412#undef TYPE_ASM_OP 413#define TYPE_ASM_OP "\t.type\t" 414#undef SIZE_ASM_OP 415#define SIZE_ASM_OP "\t.size\t" 416 417/* This is how we tell the assembler that a symbol is weak. */ 418 419#undef ASM_WEAKEN_LABEL 420#define ASM_WEAKEN_LABEL(FILE, NAME) \ 421 do { \ 422 fputs ("\t.globl\t", (FILE)); assemble_name ((FILE), (NAME)); \ 423 fputc ('\n', (FILE)); \ 424 fputs ("\t.weak\t", (FILE)); assemble_name ((FILE), (NAME)); \ 425 fputc ('\n', (FILE)); \ 426 } while (0) 427 428/* The following macro defines the [default] format used with ELF to output 429 the second operand of the .type assembler directive. */ 430 431#undef TYPE_OPERAND_FMT 432#define TYPE_OPERAND_FMT "@%s" 433 434/* Write the extra assembler code needed to declare a function's result. 435 Most svr4/ELF assemblers don't require any special declaration of the 436 result value. */ 437 438#undef ASM_DECLARE_RESULT 439#define ASM_DECLARE_RESULT(FILE, RESULT) 440 441/* These macros generate the special .type and .size directives which 442 are used to set the corresponding fields of the linker symbol table 443 entries in an ELF object file under SVR4/ELF. These macros also output 444 the starting labels for the relevant functions/objects. */ 445 446/* Write the extra assembler code needed to declare an object properly. */ 447 448#undef ASM_DECLARE_OBJECT_NAME 449#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 450 do { \ 451 fprintf (FILE, "%s ", TYPE_ASM_OP); \ 452 assemble_name (FILE, NAME); \ 453 putc (',', FILE); \ 454 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 455 putc ('\n', FILE); \ 456 size_directive_output = 0; \ 457 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 458 { \ 459 size_directive_output = 1; \ 460 fprintf (FILE, "%s ", SIZE_ASM_OP); \ 461 assemble_name (FILE, NAME); \ 462 putc (',', FILE); \ 463 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ 464 int_size_in_bytes (TREE_TYPE (DECL))); \ 465 fputc ('\n', FILE); \ 466 } \ 467 ASM_OUTPUT_LABEL(FILE, NAME); \ 468 } while (0) 469 470/* Output the size directive for a decl in rest_of_decl_compilation 471 in the case where we did not do so before the initializer. 472 Once we find the error_mark_node, we know that the value of 473 size_directive_output was set 474 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 475 476#undef ASM_FINISH_DECLARE_OBJECT 477#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 478 do { \ 479 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 480 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 481 && ! AT_END && TOP_LEVEL \ 482 && DECL_INITIAL (DECL) == error_mark_node \ 483 && !size_directive_output) \ 484 { \ 485 size_directive_output = 1; \ 486 fprintf (FILE, "%s ", SIZE_ASM_OP); \ 487 assemble_name (FILE, name); \ 488 putc (',', FILE); \ 489 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ 490 int_size_in_bytes (TREE_TYPE (DECL))); \ 491 fputc ('\n', FILE); \ 492 } \ 493 } while (0) 494 495 496/************************[ Debugger stuff ]*********************************/ 497 498/* All ELF targets can support DWARF-2. */ 499#undef DWARF2_DEBUGGING_INFO 500#define DWARF2_DEBUGGING_INFO 501 502/* This is BSD, so we want the DBX format. */ 503#undef DBX_DEBUGGING_INFO 504#define DBX_DEBUGGING_INFO 505 506/* This is BSD, so use stabs instead of DWARF debug format. */ 507#undef PREFERRED_DEBUGGING_TYPE 508#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 509 510/* But allow STABS to be supported as well. 511 Note that we want to override some definition settings done for some 512 architecture's native OS's tools that don't apply to us. */ 513#undef ASM_IDENTIFY_GCC 514#undef ASM_IDENTIFY_LANGUAGE 515