freebsd-nq/contrib/gcc/config/i386/darwin.h
2004-07-28 03:11:36 +00:00

136 lines
4.5 KiB
C

/* Target definitions for x86 running Darwin.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Contributed by Apple Computer Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Enable Mach-O bits in generic x86 code. */
#undef TARGET_MACHO
#define TARGET_MACHO 1
#define TARGET_VERSION fprintf (stderr, " (i386 Darwin)");
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__i386__"); \
builtin_define ("__LITTLE_ENDIAN__"); \
builtin_define ("__MACH__"); \
builtin_define ("__APPLE__"); \
} \
while (0)
/* We want -fPIC by default, unless we're using -static to compile for
the kernel or some such. */
#undef CC1_SPEC
#define CC1_SPEC "%{!static:-fPIC}"
#define ASM_SPEC "-arch i386 \
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\
%{msse:-force_cpusubtype_ALL}\
%{msse2:-force_cpusubtype_ALL}}"
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "darwin_arch", "i386" },
/* The Darwin assembler mostly follows AT&T syntax. */
#undef ASSEMBLER_DIALECT
#define ASSEMBLER_DIALECT ASM_ATT
/* Define macro used to output shift-double opcodes when the shift
count is in %cl. Some assemblers require %cl as an argument;
some don't. This macro controls what to do: by default, don't
print %cl. */
#define SHIFT_DOUBLE_OMITS_COUNT 0
/* Define the syntax of pseudo-ops, labels and comments. */
/* String containing the assembler's comment-starter. */
#define ASM_COMMENT_START "#"
/* By default, target has a 80387, uses IEEE compatible arithmetic,
and returns float values in the 387. */
#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
/* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC. */
#undef TARGET_DEEP_BRANCH_PREDICTION
#define TARGET_DEEP_BRANCH_PREDICTION 0
/* For now, disable dynamic-no-pic. We'll need to go through i386.c
with a fine-tooth comb looking for refs to flag_pic! */
#define MASK_MACHO_DYNAMIC_NO_PIC 0
#define TARGET_DYNAMIC_NO_PIC (target_flags & MASK_MACHO_DYNAMIC_NO_PIC)
/* Define the syntax of pseudo-ops, labels and comments. */
#define LPREFIX "L"
/* Assembler pseudos to introduce constants of various size. */
#define ASM_BYTE_OP "\t.byte\t"
#define ASM_SHORT "\t.word\t"
#define ASM_LONG "\t.long\t"
/* Darwin as doesn't do ".quad". */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
do { if ((LOG) != 0) \
{ \
if (in_text_section ()) \
fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
else \
fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \
} \
} while (0)
/* This says how to output an assembler line
to define a global common symbol. */
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
( fputs (".comm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%lu\n", (unsigned long)(ROUNDED)))
/* This says how to output an assembler line
to define a local common symbol. */
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
( fputs (".lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED)))
/* Darwin profiling -- call mcount. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
if (MACHOPIC_INDIRECT) \
{ \
const char *name = machopic_stub_name ("*mcount"); \
fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1); \
} \
else fprintf (FILE, "\tcall mcount\n"); \
} while (0)