diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e4d586105e0..2e9ec6976bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2006-09-08 Eric Christopher + + * 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 Joseph S. Myers PR c/28504 diff --git a/gcc/config.gcc b/gcc/config.gcc index 7ea15d34b5e..efa6c8d867d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -438,7 +438,7 @@ case ${target} in ;; esac ;; - *) + *) echo 'Unknown thread configuration for FreeBSD' exit 1 ;; @@ -693,13 +693,13 @@ arm*-*-netbsd*) use_collect2=yes ;; arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" tmake_file="${tmake_file} t-linux arm/t-arm" case ${target} in arm*-*-linux-*eabi) tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h" tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi" - # The BPABI long long divmod functions return a 128-bit value in + # The BPABI long long divmod functions return a 128-bit value in # registers r0-r3. Correctly modeling that requires the use of # TImode. need_64bit_hwint=yes @@ -721,7 +721,7 @@ arm*-*-ecos-elf) tmake_file="arm/t-arm arm/t-arm-elf" ;; arm*-*-eabi* | arm*-*-symbianelf* ) - # The BPABI long long divmod functions return a 128-bit value in + # The BPABI long long divmod functions return a 128-bit value in # registers r0-r3. Correctly modeling that requires the use of # TImode. need_64bit_hwint=yes @@ -965,7 +965,7 @@ hppa*64*-*-hpux11*) libgcc_stub.a" case x${enable_threads} in xyes | xposix ) - thread_file=posix + thread_file=posix ;; esac gas=yes @@ -994,14 +994,14 @@ hppa[12]*-*-hpux11*) fi case x${enable_threads} in xyes | xposix ) - thread_file=posix + thread_file=posix ;; esac use_collect2=yes gas=yes ;; i[34567]86-*-darwin*) - # All the configuration is presently done generically. + need_64bit_hwint=yes ;; i[34567]86-*-elf*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h" @@ -1192,7 +1192,7 @@ i[34567]86-*-solaris2*) exit 1 ;; esac - # Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as + # Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as # part of the base system. extra_parts="gmon.o crtbegin.o crtend.o" ;; @@ -1540,7 +1540,7 @@ mips*-*-openbsd*) target_cpu_default="MASK_ABICALLS" tm_file="mips/mips.h openbsd.h mips/openbsd.h mips/sdb.h" case ${target} in - mips*el-*-openbsd*) + mips*el-*-openbsd*) tm_defines="${tm_defines} TARGET_ENDIAN_DEFAULT=0";; *) tm_defines="${tm_defines} TARGET_ENDIAN_DEFAULT=MASK_BIG_ENDIAN";; esac @@ -1688,7 +1688,7 @@ powerpc-*-darwin*) extra_parts="crt2.o" case ${target} in *-darwin1[0-9]* | *-darwin[8-9]*) - tmake_file="${tmake_file} rs6000/t-darwin8" + tmake_file="${tmake_file} rs6000/t-darwin8" tm_file="${tm_file} rs6000/darwin8.h" ;; *-darwin7*) @@ -2001,7 +2001,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ tm_file="sh/symbian-pre.h sh/little.h ${tm_file} sh/symbian-post.h" extra_objs="symbian.o" extra_parts="crt1.o crti.o crtn.o crtbegin.o crtend.o crtbeginS.o crtendS.o" - ;; + ;; esac # sed el/eb endian suffixes away to avoid confusion with sh[23]e case `echo ${target} | sed 's/e[lb]-/-/'` in diff --git a/gcc/config/darwin-64.c b/gcc/config/darwin-64.c new file mode 100644 index 00000000000..33094e30785 --- /dev/null +++ b/gcc/config/darwin-64.c @@ -0,0 +1,77 @@ +/* Functions shipped in the ppc64 and x86_64 version of libgcc_s.1.dylib + in older Mac OS X versions, preserved for backwards compatibility. + Copyright (C) 2006 Free Software Foundation, 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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +#if defined (__ppc64__) || defined (__x86_64__) +/* Many of these functions have probably never been used by anyone + anywhere on these targets, but it's hard to prove this, so they're defined + here. None are actually necessary, as demonstrated below by defining + each function using the operation it implements. */ + +typedef long DI; +typedef unsigned long uDI; +typedef int SI; +typedef unsigned int uSI; +typedef int word_type __attribute__ ((mode (__word__))); + +DI __ashldi3 (DI x, word_type c); +DI __ashrdi3 (DI x, word_type c); +int __clzsi2 (uSI x); +word_type __cmpdi2 (DI x, DI y); +int __ctzsi2 (uSI x); +DI __divdi3 (DI x, DI y); +uDI __lshrdi3 (uDI x, word_type c); +DI __moddi3 (DI x, DI y); +DI __muldi3 (DI x, DI y); +DI __negdi2 (DI x); +int __paritysi2 (uSI x); +int __popcountsi2 (uSI x); +word_type __ucmpdi2 (uDI x, uDI y); +uDI __udivdi3 (uDI x, uDI y); +uDI __udivmoddi4 (uDI x, uDI y, uDI *r); +uDI __umoddi3 (uDI x, uDI y); + +DI __ashldi3 (DI x, word_type c) { return x << c; } +DI __ashrdi3 (DI x, word_type c) { return x >> c; } +int __clzsi2 (uSI x) { return __builtin_clz (x); } +word_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; } +int __ctzsi2 (uSI x) { return __builtin_ctz (x); } +DI __divdi3 (DI x, DI y) { return x / y; } +uDI __lshrdi3 (uDI x, word_type c) { return x >> c; } +DI __moddi3 (DI x, DI y) { return x % y; } +DI __muldi3 (DI x, DI y) { return x * y; } +DI __negdi2 (DI x) { return -x; } +int __paritysi2 (uSI x) { return __builtin_parity (x); } +int __popcountsi2 (uSI x) { return __builtin_popcount (x); } +word_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; } +uDI __udivdi3 (uDI x, uDI y) { return x / y; } +uDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; } +uDI __umoddi3 (uDI x, uDI y) { return x % y; } + +#endif /* __ppc64__ || __x86_64__ */ diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def index 89d6371ea6b..148b77511ea 100644 --- a/gcc/config/darwin-sections.def +++ b/gcc/config/darwin-sections.def @@ -14,6 +14,7 @@ DEF_SECTION (data_coal_section, SECTION_WRITE, DEF_SECTION (cstring_section, SECTION_MERGE, ".cstring", 0) DEF_SECTION (literal4_section, SECTION_MERGE, ".literal4", 0) DEF_SECTION (literal8_section, SECTION_MERGE, ".literal8", 0) +DEF_SECTION (literal16_section, SECTION_MERGE, ".literal16", 0) DEF_SECTION (constructor_section, 0, ".constructor", 0) DEF_SECTION (mod_init_section, 0, ".mod_init_func", 0) DEF_SECTION (mod_term_section, 0, ".mod_term_func", 0) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 541b772a7a4..77e2f0e31c4 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1136,6 +1136,11 @@ machopic_select_section (tree exp, int reloc, TREE_INT_CST_LOW (size) == 8 && TREE_INT_CST_HIGH (size) == 0) return darwin_sections[literal8_section]; + else if (TARGET_64BIT + && TREE_CODE (size) == INTEGER_CST + && TREE_INT_CST_LOW (size) == 16 + && TREE_INT_CST_HIGH (size) == 0) + return darwin_sections[literal16_section]; else return base_section; } @@ -1234,6 +1239,10 @@ machopic_select_rtx_section (enum machine_mode mode, rtx x, && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)) return darwin_sections[literal4_section]; + else if (GET_MODE_SIZE (mode) == 16 + && (GET_CODE (x) == CONST_INT + || GET_CODE (x) == CONST_DOUBLE)) + return darwin_sections[literal16_section]; else if (MACHOPIC_INDIRECT && (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == CONST 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 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 962b9900507..7f954e29bab 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1538,12 +1538,17 @@ override_options (void) SUBTARGET_OVERRIDE_OPTIONS; #endif + /* -fPIC is the default for x86_64. */ + if (TARGET_MACHO && TARGET_64BIT) + flag_pic = 2; + /* Set the default values for switches whose default depends on TARGET_64BIT in case they weren't overwritten by command line options. */ if (TARGET_64BIT) { + /* Mach-O doesn't support omitting the frame pointer for now. */ if (flag_omit_frame_pointer == 2) - flag_omit_frame_pointer = 1; + flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1); if (flag_asynchronous_unwind_tables == 2) flag_asynchronous_unwind_tables = 1; if (flag_pcc_struct_return == 2) @@ -4788,6 +4793,8 @@ static int pic_labels_used; static void get_pc_thunk_name (char name[32], unsigned int regno) { + gcc_assert (!TARGET_64BIT); + if (USE_HIDDEN_LINKONCE) sprintf (name, "__i686.get_pc_thunk.%s", reg_names[regno]); else @@ -6174,7 +6181,7 @@ legitimate_pic_address_disp_p (rtx disp) if (GET_CODE (op1) != CONST_INT || INTVAL (op1) >= 16*1024*1024 || INTVAL (op1) < -16*1024*1024) - break; + break; if (GET_CODE (op0) == LABEL_REF) return true; if (GET_CODE (op0) != SYMBOL_REF) @@ -6426,12 +6433,16 @@ legitimate_address_p (enum machine_mode mode, rtx addr, int strict) goto report_error; } - else if (flag_pic && (SYMBOLIC_CONST (disp) + else if (SYMBOLIC_CONST (disp) + && (flag_pic + || (TARGET_MACHO #if TARGET_MACHO - && !machopic_operand_p (disp) + && MACHOPIC_INDIRECT + && !machopic_operand_p (disp) #endif - )) + ))) { + is_legitimate_pic: if (TARGET_64BIT && (index || base)) { @@ -6544,10 +6555,13 @@ legitimize_pic_address (rtx orig, rtx reg) rtx base; #if TARGET_MACHO - if (reg == 0) - reg = gen_reg_rtx (Pmode); - /* Use the generic Mach-O PIC machinery. */ - return machopic_legitimize_pic_address (orig, GET_MODE (orig), reg); + if (TARGET_MACHO && !TARGET_64BIT) + { + if (reg == 0) + reg = gen_reg_rtx (Pmode); + /* Use the generic Mach-O PIC machinery. */ + return machopic_legitimize_pic_address (orig, GET_MODE (orig), reg); + } #endif if (TARGET_64BIT && legitimate_pic_address_disp_p (addr)) @@ -8909,27 +8923,32 @@ ix86_expand_move (enum machine_mode mode, rtx operands[]) if (flag_pic && mode == Pmode && symbolic_operand (op1, Pmode)) { -#if TARGET_MACHO - if (MACHOPIC_PURE) + if (TARGET_MACHO && !TARGET_64BIT) { - rtx temp = ((reload_in_progress - || ((op0 && GET_CODE (op0) == REG) - && mode == Pmode)) - ? op0 : gen_reg_rtx (Pmode)); - op1 = machopic_indirect_data_reference (op1, temp); - op1 = machopic_legitimize_pic_address (op1, mode, - temp == op1 ? 0 : temp); +#if TARGET_MACHO + if (MACHOPIC_PURE) + { + rtx temp = ((reload_in_progress + || ((op0 && GET_CODE (op0) == REG) + && mode == Pmode)) + ? op0 : gen_reg_rtx (Pmode)); + op1 = machopic_indirect_data_reference (op1, temp); + op1 = machopic_legitimize_pic_address (op1, mode, + temp == op1 ? 0 : temp); + } + else if (MACHOPIC_INDIRECT) + op1 = machopic_indirect_data_reference (op1, 0); + if (op0 == op1) + return; +#endif } - else if (MACHOPIC_INDIRECT) - op1 = machopic_indirect_data_reference (op1, 0); - if (op0 == op1) - return; -#else - if (GET_CODE (op0) == MEM) - op1 = force_reg (Pmode, op1); else - op1 = legitimize_address (op1, op1, Pmode); -#endif /* TARGET_MACHO */ + { + if (GET_CODE (op0) == MEM) + op1 = force_reg (Pmode, op1); + else + op1 = legitimize_address (op1, op1, Pmode); + } } else { @@ -13329,15 +13348,21 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, pop = NULL; gcc_assert (!TARGET_64BIT || !pop); + if (TARGET_MACHO && !TARGET_64BIT) + { #if TARGET_MACHO - if (flag_pic && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF) - fnaddr = machopic_indirect_call_target (fnaddr); -#else - /* Static functions and indirect calls don't need the pic register. */ - if (! TARGET_64BIT && flag_pic - && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF - && ! SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0))) - use_reg (&use, pic_offset_table_rtx); + if (flag_pic && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF) + fnaddr = machopic_indirect_call_target (fnaddr); +#endif + } + else + { + /* Static functions and indirect calls don't need the pic register. */ + if (! TARGET_64BIT && flag_pic + && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF + && ! SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0))) + use_reg (&use, pic_offset_table_rtx); + } if (TARGET_64BIT && INTVAL (callarg2) >= 0) { @@ -13345,7 +13370,6 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, emit_move_insn (al, callarg2); use_reg (&use, al); } -#endif /* TARGET_MACHO */ if (! call_insn_operand (XEXP (fnaddr, 0), Pmode)) { @@ -17249,6 +17273,9 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub) char *binder_name, *symbol_name, lazy_ptr_name[32]; int label = ++current_machopic_label_num; + /* For 64-bit we shouldn't get here. */ + gcc_assert (!TARGET_64BIT); + /* Lose our funky encoding stuff so it doesn't contaminate the stub. */ symb = (*targetm.strip_name_encoding) (symb); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 19cc5915720..9474964255b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2011,11 +2011,13 @@ do { \ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ ix86_output_addr_diff_elt ((FILE), (VALUE), (REL)) -/* Under some conditions we need jump tables in the text section, because - the assembler cannot handle label differences between sections. */ +/* Under some conditions we need jump tables in the text section, + because the assembler cannot handle label differences between + sections. This is the case for x86_64 on Mach-O for example. */ #define JUMP_TABLES_IN_TEXT_SECTION \ - (!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA) + (flag_pic && ((TARGET_MACHO && TARGET_64BIT) \ + || (!TARGET_64BIT && !HAVE_AS_GOTOFF_IN_DATA))) /* Switch to init or fini section via SECTION_OP, emit a call to FUNC, and switch back. For x86 we do this only to save a few bytes that diff --git a/gcc/config/i386/t-darwin b/gcc/config/i386/t-darwin index b2ff7cbc0a7..e79f3355aaa 100644 --- a/gcc/config/i386/t-darwin +++ b/gcc/config/i386/t-darwin @@ -1 +1,5 @@ SHLIB_VERPFX = $(srcdir)/config/i386/darwin-libgcc +MULTILIB_OPTIONS = m64 +MULTILIB_DIRNAMES = x86_64 +LIB2_SIDITI_CONV_FUNCS=yes +LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c diff --git a/gcc/config/t-slibgcc-darwin b/gcc/config/t-slibgcc-darwin index d9381e646f1..0c6eded3de4 100644 --- a/gcc/config/t-slibgcc-darwin +++ b/gcc/config/t-slibgcc-darwin @@ -92,5 +92,10 @@ install-darwin-libgcc-stubs : $(INSTALL_FILES) installdirs else true; fi $(LN_S) libgcc_s.1.dylib \ $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib + if [ -f $(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib ]; then \ + rm -f $(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib; \ + else true; fi + $(LN_S) libgcc_s.1.dylib \ + $(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib INSTALL_LIBGCC = install-darwin-libgcc-stubs install-multilib diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ba42158ca3..96eebdf76a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2006-09-08 Eric Christopher + + * 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 Joseph S. Myers PR c/28504 @@ -127,7 +145,7 @@ * g++.dg/template/typedef4.C: Adjust error markers. * g++.dg/template/typedef5.C: Likewise. - + 2006-09-02 Jakub Jelinek PR c++/28878 @@ -244,8 +262,8 @@ 2006-08-27 Lee Millward PR c++/26573 - * g++.dg/other/static2.C: New test. - + * g++.dg/other/static2.C: New test. + 2006-08-26 Roger Sayle * gcc.dg/Wswitch-enum-2.c: New test case. @@ -270,7 +288,7 @@ * g++.dg/template/void4.C: Likewise. * g++.dg/template/crash55.C: Likewise. * g++.dg/template/void7.C: Likewise - + 2006-08-26 Mark Mitchell PR c++/28588 @@ -375,7 +393,7 @@ 2006-08-23 Danny Smith - gcc.dg/attr-invalid.c: Insert an " |directive" substitution into + gcc.dg/attr-invalid.c: Insert an " |directive" substitution into dg-warning strings for dllimport. 2006-08-22 Andrew Pinski @@ -413,17 +431,17 @@ * g++.dg/parse/ctor8.C: Likewise. PR c++/28741 - * g++.dg/template/void7.C: New test. - + * g++.dg/template/void7.C: New test. + 2006-08-21 Olivier Hainque * gnat.dg/self_aggregate_with_zeros.adb: New test. * gnat.dg/self_aggregate_with_array.adb: New test. 2006-08-21 Mark Shinwell - + * g++.dg/eh/arm-vfp-unwind.C: New test. - + 2006-08-20 Mark Mitchell PR c++/28341 @@ -462,7 +480,7 @@ * gfortran.dg/array_initializer_2.f90: New test. PR fortran/18111 - * gfortran.dg/unused_artificial_dummies_1.f90: New test. + * gfortran.dg/unused_artificial_dummies_1.f90: New test. PR fortran/28600 * gfortran.dg/assumed_charlen_function_4.f90: New test. @@ -562,7 +580,7 @@ PR c++/28594 * g++.dg/template/void6.C: New test. - + 2006-08-15 Volker Reichelt PR c/28649 @@ -658,7 +676,7 @@ PR c++/28640 * g++.dg/template/void5.C: New test. - + 2006-08-07 Danny Smith * g++.dg/ext/visibility/class1.C (dg-require-visibility): Move @@ -725,7 +743,7 @@ 2006-08-03 Lee Millward PR c++/28347 - * g++.dg/ext/typedef-init.C: Add new test for typedef + * g++.dg/ext/typedef-init.C: Add new test for typedef initialization inside templates. Adjust existing error markers. 2006-08-03 Mark Mitchell @@ -736,14 +754,14 @@ 2006-08-03 Dorit Nuzman PR tree-optimization/27770 - * lib/target-support.exp: New target keyword "section_anchors". + * lib/target-support.exp: New target keyword "section_anchors". * gcc.dg/vect/vect.exp: Add -fsection-anchors to compilation of some tests. * gcc.dg/vect/section-anchors-pr27770.c: New test. * gcc.dg/vect/vect-69.c: Removed. Replaced by: * gcc.dg/vect/section-anchors-vect-69.c: New test. * gcc.dg/vect/no-section-anchors-vect-69.c: New test. - + 2006-08-03 John David Anglin * gcc.dg/20060801-1.c: Add missing '}'. @@ -863,7 +881,7 @@ * g++.dg/template/void2.C: Adjust error markers. * g++.dg/template/nontype5.C: Adjust error markers. - + 2006-07-27 Arjan van de Ven * gcc.target/i386/stack-prot-kernel.c: New test. @@ -921,7 +939,7 @@ * gcc.dg/visibility-11.c: Enlarge test array to 1024 bytes to avoid memcpy optimization. - + 2006-07-24 Jerry DeLisle PR fortran/25289 @@ -1004,7 +1022,7 @@ PR c++/28260 * g++.dg/template/friend44.C: New test. - + 2006-07-18 Steve Ellcey PR c++/27495 @@ -1014,7 +1032,7 @@ * gnat.dg/outer_agg_bitfield_constructor.adb: New test. * gnat.dg/nested_agg_bitfield_constructor.adb: New test. - + 2006-07-18 Volker Reichelt PR c/28286 @@ -1087,7 +1105,7 @@ PR c++/28269 * g++.dg/template/crash54.C: New test. - + 2006-07-15 Volker Reichelt PR c++/28249 @@ -1143,7 +1161,7 @@ PR c++/27820 * g++.dg/other/label1.C: New test. - + 2006-07-07 Richard Guenther PR middle-end/28268 @@ -1289,7 +1307,7 @@ PR c++/28054 * g++.dg/other/incomplete3.C: New test. - + 2006-06-24 Francois-Xavier Coudert PR fortran/28081 @@ -1305,7 +1323,7 @@ * gnat.dg/scalar_mode_agg_compare_loop.adb: New test. * gnat.dg/scalar_mode_agg_compare.adb: New test. - + 2006-06-23 Janis Johnson * gcc.dg/dfp/usual-arith-conv-bad.c: New test. @@ -1318,7 +1336,7 @@ 2006-06-23 Lee Millward * g++.dg/template/error22.C: Fix typo. - + 2006-06-23 Volker Reichelt PR c++/28112 @@ -1327,7 +1345,7 @@ 2006-06-23 Olivier Hainque * gnat.dg/varsize_temp.adb: New test. - + 2006-06-23 Volker Reichelt PR c++/11468 @@ -1361,7 +1379,7 @@ PR c++/27821 * g++.dg/template/error22.C: New test. - + 2006-06-22 Volker Reichelt PR c++/28111 @@ -1475,7 +1493,7 @@ * g++.dg/template/static26.C: New test. PR c++/27979 - * g++.dg/expr/bitfield2.C: New test. + * g++.dg/expr/bitfield2.C: New test. PR c++/27884 * g++.dg/parse/linkage2.C: New test. @@ -1531,7 +1549,7 @@ PR c++/26559 * g++.dg/template/builtin1.C: New test. * g++.dg/gomp/tpl-atomic-2.C: Remove XFAIL. - + PR c++/28018 * g++.old-deja/g++.benjamin/14664-2.C: Expect error for array assignment. @@ -1560,7 +1578,7 @@ 2006-06-13 Maxim Kuvyrkov * gcc.c-torture/compile/20060609-1.c: New test. - + PR target/27863 * gcc.c-torture/compile/pr27863.c: New test. diff --git a/gcc/testsuite/gcc.dg/attr-ms_struct-1.c b/gcc/testsuite/gcc.dg/attr-ms_struct-1.c index eafab93637f..4cbff013f17 100644 --- a/gcc/testsuite/gcc.dg/attr-ms_struct-1.c +++ b/gcc/testsuite/gcc.dg/attr-ms_struct-1.c @@ -1,5 +1,6 @@ /* Test for MS structure sizes. */ -/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } } +/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-std=gnu99" } */ extern void abort (); diff --git a/gcc/testsuite/gcc.dg/attr-ms_struct-2.c b/gcc/testsuite/gcc.dg/attr-ms_struct-2.c index 0e8f41e4546..58804525bf1 100644 --- a/gcc/testsuite/gcc.dg/attr-ms_struct-2.c +++ b/gcc/testsuite/gcc.dg/attr-ms_struct-2.c @@ -1,5 +1,6 @@ /* Test for MS structure sizes. */ -/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } } +/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-std=gnu99" } */ extern void abort (); diff --git a/gcc/testsuite/gcc.dg/pr26449.c b/gcc/testsuite/gcc.dg/pr26449.c index 1a0bdad1111..dc622fadce2 100644 --- a/gcc/testsuite/gcc.dg/pr26449.c +++ b/gcc/testsuite/gcc.dg/pr26449.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O1 -ftree-vectorize -march=pentium4 -std=c99" } */ void matmul_i4 (int bbase_yn, int xcount) @@ -9,7 +10,6 @@ void matmul_i4 (int bbase_yn, int xcount) for (x = 0; x < xcount; x++) { - dest_y[x] += abase_n[x] * bbase_yn; + dest_y[x] += abase_n[x] * bbase_yn; } } - diff --git a/gcc/testsuite/gcc.misc-tests/linkage.exp b/gcc/testsuite/gcc.misc-tests/linkage.exp index 6617023a46a..a0805212d6b 100644 --- a/gcc/testsuite/gcc.misc-tests/linkage.exp +++ b/gcc/testsuite/gcc.misc-tests/linkage.exp @@ -4,15 +4,15 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # This file used to be gcc.c-torture/special/special.exp, which # was written by Rob Savoye. (rob@cygnus.com) @@ -73,7 +73,14 @@ if [isnative] then { } elseif [ string match "*32-bit*" $file_string ] { set native_cflags "-m32" } - } + } elseif [istarget "*-*-darwin*"] { + set file_string [exec file "linkage-x.o"] + if [ string match "*64-bit*" $file_string ] { + set native_cflags "-m64" + } elseif [ string match "*32-bit*" $file_string ] { + set native_cflags "-m32" + } + } if [file exists "linkage-y.o"] then { file delete "linkage-y.o" diff --git a/gcc/testsuite/gcc.target/i386/20060512-1.c b/gcc/testsuite/gcc.target/i386/20060512-1.c index fc0bcf1625a..f0f0099ac6c 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-1.c +++ b/gcc/testsuite/gcc.target/i386/20060512-1.c @@ -1,4 +1,5 @@ /* { dg-do run { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-std=gnu99 -msse2" } */ #include __m128i __attribute__ ((__noinline__)) diff --git a/gcc/testsuite/gcc.target/i386/20060512-2.c b/gcc/testsuite/gcc.target/i386/20060512-2.c index 4f411c4a520..7e6f38e6197 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-2.c +++ b/gcc/testsuite/gcc.target/i386/20060512-2.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-std=gnu99" } */ int outer_function (int x, int y) diff --git a/gcc/testsuite/gcc.target/i386/20060512-3.c b/gcc/testsuite/gcc.target/i386/20060512-3.c index f21cdc1fc43..85472e63b63 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-3.c +++ b/gcc/testsuite/gcc.target/i386/20060512-3.c @@ -1,4 +1,5 @@ /* { dg-do run { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-std=gnu99 -msse2 -mstackrealign" } */ #include __m128i __attribute__ ((__noinline__)) diff --git a/gcc/testsuite/gcc.target/i386/20060512-4.c b/gcc/testsuite/gcc.target/i386/20060512-4.c index cd569108b70..353b6ddfb40 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-4.c +++ b/gcc/testsuite/gcc.target/i386/20060512-4.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-mstackrealign" } */ int outer_function (int x, int y) diff --git a/gcc/testsuite/gcc.target/i386/asm-1.c b/gcc/testsuite/gcc.target/i386/asm-1.c index 63e7af78c63..348dc32dd32 100644 --- a/gcc/testsuite/gcc.target/i386/asm-1.c +++ b/gcc/testsuite/gcc.target/i386/asm-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-m32" } */ register unsigned int EAX asm ("r14"); /* { dg-error "register name" } */ diff --git a/gcc/testsuite/gcc.target/i386/compress-float-387-pic.c b/gcc/testsuite/gcc.target/i386/compress-float-387-pic.c index e15bbee21aa..0673f5d1c8e 100644 --- a/gcc/testsuite/gcc.target/i386/compress-float-387-pic.c +++ b/gcc/testsuite/gcc.target/i386/compress-float-387-pic.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86*-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -march=pentium4 -mtune=prescott -mfpmath=387 -fpic" } */ double foo (double x) { return x + 1.75; diff --git a/gcc/testsuite/gcc.target/i386/compress-float-387.c b/gcc/testsuite/gcc.target/i386/compress-float-387.c index 36decafa822..912d942a0d7 100644 --- a/gcc/testsuite/gcc.target/i386/compress-float-387.c +++ b/gcc/testsuite/gcc.target/i386/compress-float-387.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86*-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -march=pentium4 -mtune=prescott -mfpmath=387" } */ double foo (double x) { return x + 1.75; diff --git a/gcc/testsuite/gcc.target/i386/compress-float-sse-pic.c b/gcc/testsuite/gcc.target/i386/compress-float-sse-pic.c index fecce83e031..52cf4637716 100644 --- a/gcc/testsuite/gcc.target/i386/compress-float-sse-pic.c +++ b/gcc/testsuite/gcc.target/i386/compress-float-sse-pic.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86*-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -march=pentium4 -mtune=prescott -mfpmath=sse -fpic" } */ double foo (double x) { return x + 1.75; diff --git a/gcc/testsuite/gcc.target/i386/compress-float-sse.c b/gcc/testsuite/gcc.target/i386/compress-float-sse.c index d0a3e0044d9..59b5458d758 100644 --- a/gcc/testsuite/gcc.target/i386/compress-float-sse.c +++ b/gcc/testsuite/gcc.target/i386/compress-float-sse.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86*-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -march=pentium4 -mtune=prescott -mfpmath=sse" } */ double foo (double x) { return x + 1.75; diff --git a/gcc/testsuite/gcc.target/i386/memcpy-1.c b/gcc/testsuite/gcc.target/i386/memcpy-1.c index edd0c7b49aa..ddb7c21f733 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-1.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -march=pentiumpro -minline-all-stringops" } */ /* { dg-final { scan-assembler "rep" } } */ /* { dg-final { scan-assembler "movs" } } */ diff --git a/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c b/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c index 94fdf4f44e7..af16223a83b 100644 --- a/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c +++ b/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c @@ -1,4 +1,5 @@ /* { dg-do compile { target lp64 } } */ +/* { dg-skip-if "darwin x86_64 is pic" { *-*-darwin* } { "-m64" } { "" } } */ /* { dg-options "-O2 -fstack-protector-all -mcmodel=kernel" } */ void test1 (int x) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 98d2cc22e7f..b03241bff99 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2006-09-08 Eric Christopher + + * configure.ac: Add 64-bit HWI support for i?86-darwin. + 2006-08-14 Steve Ellcey PR c++/28288 @@ -120,7 +124,7 @@ 2005-11-09 Per Bothner Uros Bizjak - + PR c/24101 * init.c (read_original_filename): Temporarily set state.in_directive before calling _cpp_lex_direct for @@ -162,7 +166,7 @@ Use in print_dep assignment. * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file. * internal.h (_cpp_find_file): Add new parm to declaration. - + 2005-10-08 Kazu Hirata * configure.ac: Require 64-bit int for arm*-*-*eabi*. diff --git a/libcpp/configure b/libcpp/configure index 0e956377be4..71cd0e8978e 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -7264,8 +7264,9 @@ INCINTL= XGETTEXT= GMSGFMT= POSUB= -if test -f ../intl/config.intl; then - . ../intl/config.intl + +if test -f ../intl/config.intl; then + . ../intl/config.intl fi echo "$as_me:$LINENO: checking whether NLS is requested" >&5 echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 @@ -8233,6 +8234,7 @@ case $target in x86_64-*-* | \ ia64-*-* | \ hppa*64*-*-* | parisc*64*-*-* | \ + i[34567]86-*-darwin[0-9]* | \ i[34567]86-*-solaris2.1[0-9]* | \ mips*-*-* | \ mmix-*-* | \ diff --git a/libcpp/configure.ac b/libcpp/configure.ac index e91f9b8b8f6..71b6ff61f9b 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -118,6 +118,7 @@ case $target in x86_64-*-* | \ ia64-*-* | \ hppa*64*-*-* | parisc*64*-*-* | \ + i[34567]86-*-darwin[0-9]* | \ i[34567]86-*-solaris2.1[0-9]* | \ mips*-*-* | \ mmix-*-* | \