diff options
author | echristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-09 00:27:47 +0000 |
---|---|---|
committer | echristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-09 00:27:47 +0000 |
commit | 3ebc7dec024ba8506b36236d5e7f109e66726aab (patch) | |
tree | 6362c5766828bc7e24a35770180c840450d9e70d /gcc/config/i386/darwin.h | |
parent | b283e667784eab3cf18478ddf7ae4cc4ffae998c (diff) | |
download | gcc-3ebc7dec024ba8506b36236d5e7f109e66726aab.tar.gz |
2006-09-08 Eric Christopher <echristo@apple.com>
* config.gcc (i?86-*-darwin): Add 64-bit HWI support.
* config/t-slibgcc-darwin: Support x86_64 multilib.
* config/i386/i386.h (JUMP_TABLES_IN_TEXT_SECTION):
Return 1 for x86_64-darwin.
* config/i386/t-darwin: Add m64 multilib.
(LIB2_SIDITI_CONV_FUNCS): Use.
(LIB2FUNCS_EXTRA): Ditto.
* config/i386/darwin.h: Support x86_64.
* config/i386/i386.c (override_options): Turn on flag_pic
for x86_64-darwin. Disable flag_omit_pointer.
(get_pc_thunk_name): Assert !TARGET_64BIT.
(legitimate_address_p): Disable machopic addressing for
x86_64.
(legitimize_pic_address): Ditto.
(ix86_expand_move): Ditto.
(ix86_expand_call): Ditto.
(machopic_output_stub): Ditto.
* config/darwin.c (machopic_select_section): Support literal16.
(machopic_select_rtx_section): Ditto.
* config/darwin-sections.def: Ditto.
* config/darwin-64.c: New.
2006-09-08 Eric Christopher <echristo@apple.com>
* gcc.target/i386/20060512-3.c: Run test on ilp32 only.
* gcc.target/i386/memcpy-1.c: Ditto.
* gcc.target/i386/asm-1.c: Ditto.
* gcc.target/i386/20060512-4.c: Ditto.
* gcc.target/i386/compress-float-387.c: Ditto.
* gcc.target/i386/20060512-1.c: Ditto.
* gcc.target/i386/compress-float-sse.c: Ditto.
* gcc.target/i386/20060512-2.c: Ditto.
* gcc.target/i386/compress-float-sse-pic.c: Ditto.
* gcc.target/i386/stack-prot-kernel.c: Ditto.
* gcc.target/i386/compress-float-387-pic.c: Ditto.
* gcc.dg/pr26449.c: Ditto.
* gcc.dg/attr-ms_struct-2.c: Ditto.
* gcc.dg/attr-ms_struct-1.c: Ditto.
* gcc.misc-tests/linkage.exp: Fix 64-bit darwin support.
2006-09-08 Eric Christopher <echristo@apple.com>
* configure.ac: Add 64-bit HWI support for i?86-darwin.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116795 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/darwin.h')
-rw-r--r-- | gcc/config/i386/darwin.h | 72 |
1 files changed, 63 insertions, 9 deletions
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index df6a69359f1..74d0f8c92ac 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -25,18 +25,41 @@ Boston, MA 02110-1301, USA. */ #define TARGET_VERSION fprintf (stderr, " (i686 Darwin)"); +#undef TARGET_64BIT +#define TARGET_64BIT (target_flags & MASK_64BIT) + +#ifdef IN_LIBGCC2 +#undef TARGET_64BIT +#ifdef __x86_64__ +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#endif + #undef TARGET_FPMATH_DEFAULT #define TARGET_FPMATH_DEFAULT (TARGET_SSE ? FPMATH_SSE : FPMATH_387) #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define ("__i386__"); \ builtin_define ("__LITTLE_ENDIAN__"); \ darwin_cpp_builtins (pfile); \ } \ while (0) +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef MAX_BITS_PER_WORD +#define MAX_BITS_PER_WORD 64 + #undef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN #define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN (0) @@ -48,13 +71,16 @@ Boston, MA 02110-1301, USA. */ %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}" #undef ASM_SPEC -#define ASM_SPEC "-arch i386 -force_cpusubtype_ALL" +#define ASM_SPEC "-arch %(darwin_arch) -force_cpusubtype_ALL" + +#define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}" +#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC #undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "darwin_arch", "i386" }, \ - { "darwin_crt2", "" }, \ - { "darwin_subarch", "i386" }, +#define SUBTARGET_EXTRA_SPECS \ + { "darwin_arch", DARWIN_ARCH_SPEC }, \ + { "darwin_crt2", "" }, \ + { "darwin_subarch", DARWIN_SUBARCH_SPEC }, /* Use the following macro for any Darwin/x86-specific command-line option translation. */ @@ -85,7 +111,7 @@ extern void darwin_x86_file_end (void); /* 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 | MASK_128BIT_LONG_DOUBLE | MASK_ALIGN_DOUBLE) +#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_128BIT_LONG_DOUBLE) /* 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! */ @@ -109,7 +135,7 @@ extern void darwin_x86_file_end (void); #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". */ +#define ASM_QUAD "\t.quad\t" #define SUBTARGET_ENCODE_SECTION_INFO darwin_encode_section_info @@ -144,7 +170,7 @@ extern void darwin_x86_file_end (void); #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ do { \ - if (MACHOPIC_INDIRECT) \ + if (MACHOPIC_INDIRECT && !TARGET_64BIT) \ { \ const char *name = machopic_mcount_stub_name (); \ fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \ @@ -153,6 +179,10 @@ extern void darwin_x86_file_end (void); else fprintf (FILE, "\tcall mcount\n"); \ } while (0) +/* Darwin on x86_64 uses dwarf-2 by default. */ +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE (TARGET_64BIT ? DWARF2_DEBUG : DBX_DEBUG) + /* Darwin uses the standard DWARF register numbers but the default register numbers for STABS. Fortunately for 64-bit code the default and the standard are the same. */ @@ -224,6 +254,30 @@ __enable_execute_stack (void *addr) \ #undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes +/* For 64-bit, we need to add 4 because @GOTPCREL is relative to the + end of the instruction, but without the 4 we'd only have the right + address for the start of the instruction. */ +#undef ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX +#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ + if (TARGET_64BIT) \ + { \ + if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_pcrel) \ + { \ + fputs (ASM_LONG, FILE); \ + assemble_name (FILE, XSTR (ADDR, 0)); \ + fputs ("+4@GOTPCREL", FILE); \ + goto DONE; \ + } \ + } \ + else \ + { \ + if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) \ + { \ + darwin_non_lazy_pcrel (FILE, ADDR); \ + goto DONE; \ + } \ + } + /* This needs to move since i386 uses the first flag and other flags are used in Mach-O. */ #undef MACHO_SYMBOL_FLAG_VARIABLE |