This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: x86_64-pc-mingw32 target for gcc


Hello,

I finished the register calling convention of the mingw32 x86_64 target 
and want now to send the complete patch for approval. I tried to have less 
whitespace changes as necessary.
I deceided to pack even the the new pragma commands "push_macro" and 
"pop_macro", because they are linked and the approval of a dependent patch 
takes a bit long. My prior patches to gcc folder are obsoleted by this 
one.
Also this patch contains a redefinition of the macro 
OUTGOING_REG_PARM_STACK_SPACE to have values zero or one. This is needed 
by the implementation in i386.c, because win64 have caller save stack 
logic.
The calling convention of win64 is a bit different to other i386 targets. 
The ABI uses 4 integer registers (rcx,rdx,r8,r9) for the first parameters, 
the first floating point registers are (xmm0,..xmm3) are shadowed in the 
standard registers on call input. Also the stack needed to save these 
registers have to be reserved by the caller. The va-args methods using 
this region to save the standard register and the treating of va_list is 
as for old win32 platforms.
Also to mark that MS defines the standard type ABI a bit diffent as gcc 
does. The type "long" remains on win64 of size 4 byte, but the long long 
is now also now by MS as 8 byte integer. The __int128 by MS is a integer 
type of mode(TI). This leads for C90 build to some warnings about the 
needed type "long long", because size_t, ptrdiff_t, etc. are longlong's.

I build the cross-compiler by using the following arguments: 
--target=x86_64-pc-mingw32 --disable-libstdcxx-pch --disable-nls 
--enable-languages=c,c++
        make all-gcc
        make install-gcc

The switch --disable-libstdcxx-pch is may not necessary for the pure 
cross-compiler, but I noticed a problem for huge files in pch on 
cygwin-shell. 

ChangeLog:

2007-03-14  Kai Tietz   <kai.tietz@onevision.com>

        * gcc/c-pragma.c (HANDLE_PRAGMA_PUSH_POP_MACRO): New
          (handle_pragma_push_macro): New
          (handle_pragma_pop_macro): New
          (init_pragma): Add new pragma command
        * gcc/config/i386/cygming.h: (DWARF2_DEBUGGING_INFO) for 
x86_64-mingw needs to be valued 1
          (DWARF2_UNWIND_INFO): Likewise
          (PREFERRED_DEBUGGING_TYPE): for x86_64-mingw it needs to be 
DWARF2_DEBUG by default
          (DBX_REGISTER_NUMBER): Have to use dbx64_register_map for 
x86_64-mingw
          (SIZE_TYPE): Needs to be "long long unsigned int" for 
x86_64-mingw
          (PTRDIFF_TYPE): Needs to be "long long int" for x86_64-mingw
          (POINTER_SIZE: Needs to be 64 for x86_64 mingw
          (HANDLE_PRAGMA_PUSH_POP_MACRO): New macro
          (TARGET_SUBTARGET_DEFAULT): Defined proper for x86_64-mingw
        * gcc/config/i386/cygwin.asm: Adjustments for target build of 
x86_64-mingw (and cygwin)
        * gcc/config/i386/i386.c: New calling convention and target 
support
        * gcc/config/i386/i386.h: Add new target
          (call_used_regs): Adjustments for target
          (REGPARM_MAX): Likewise
          (SSE_REGPARM_MAX): Likewise
          (LONG_TYPE_SIZE): Likewise
          (REG_PARM_STACK_SPACE): Likewise
          (OUTGOING_REG_PARM_STACK_SPACE): Added
        * gcc/config/i386/i386.md (allocate_stack64): New
        * gcc/config/i386/i386.opt (64BIT_MS_ABI): New
        * gcc/config/i386/mingw32.h: Adjustments for target x86_64-mingw
          (EXTRA_OS_CPP_BUILTINS): Added predefined macro 
_INTEGRAL_MAX_BITS with the value of bitsize of a pointer
          (WIN64,_WIN64,__MINGW64__): New predefined macros for 
x86_64-mingw target
          (STANDARD_INCLUDE_DIR,STANDARD_STARTFILE_PREFIX_1,): Include for 
x86_64-mingw from different place
        * gcc/config.build: Add x86_64-*-mingw32* target
        * gcc/config.gcc: Add x86_64-*-mingw32* target
        * gcc/config.host: Add x86_64-*-mingw32* target
        * gcc/explow.c: Enable allocate_stack64 and correct if clauses.
        * gcc/expr.c (OUTGOING_REG_PARM_STACK_SPACE): Changed definition 
and clauses
        * gcc/function.c (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/calls.c (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/iq2000/iq2000.h (OUTGOING_REG_PARM_STACK_SPACE): 
Ditto
        * gcc/config/mips/mips.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/mn10300/mn10300.h (OUTGOING_REG_PARM_STACK_SPACE): 
Ditto
        * gcc/config/mt/mt.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/pa/pa.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/rs6000/rs6000.h (OUTGOING_REG_PARM_STACK_SPACE): 
Ditto
        * gcc/config/score/score.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/spu/spu.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/config/v850/v850.h (OUTGOING_REG_PARM_STACK_SPACE): Ditto
        * gcc/unwind-generic.h (_uleb128_t): Adjust type for win64 target
          (_sleb128_t): Ditto
        * gcc/doc/tm.texi (OUTGOING_REG_PARM_STACK_SPACE): Adjust 
documentation
          (HANDLE_PRAGMA_PUSH_POP_MACRO): Add new
        * fixincludes/mkfixinc.sh: Add x86_64-mingw target
        * libgcc/config.host: Add support for an x86_64-mingw* target.

Regards,
 i.A. Kai Tietz

Attachment: libgcc_config.host.diff.txt
Description: Text document

Attachment: fixincludes_mkfixinc.sh.diff.txt
Description: Text document

Attachment: diff.gcc.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]