config.gcc (i[34567]86-*-cygwin*): Use new common makefile stub t-cygming.
2003-03-21 Christopher Faylor <cgf@redhat.com> * config.gcc (i[34567]86-*-cygwin*): Use new common makefile stub t-cygming. Use common target header cygming.h. Add extra c_target_obj and cxx_target_obj file. Default cygwin to posix threading. Enforce i386 as float format. (i[34567]86-*-mingw*): Use new common makefile stub t-cygming. Remove cygwin.h as target header. Use common target header cygming.h Enforce i386 as float format. Correct typo. * config/i386/cygming.h: New file, containing definitions common to mingw32 and cygwin. * config/i386/cygwin.h: Remove definitions common to cygwin and mingw. Simplify special spec logic. Define "wrappers" around certain include path defines to accommodate -mno-cygwin. Remove some #if 0'ed code. (STANDARD_INCLUDE_DIR) Always define when not cross-compiling. (LINK_SPEC): Don't use cyg search prefix when -mno-cygwin. (GCC_DRIVER_HOST_INITIALIZATION): Define as call to mingw_scan. * config/i386/mingw32.h: Remove definitions common to cygwin and mingw. (EXTRA_OS_CPP_BUILTINS): Adjust. (TARGET_VERSION): Define. * config/i386/crtdll.h (EXTRA_OS_CPP_BUILTINS): Override mingw32.h definitions. (LIBGCC_SPEC): Add libmingwex.a as in mingw32.h. * config/i386/t-cygwin (EXTRA_GCC_OBJS): Define as cygwin1.o. Add compilation rules for cygwin1.o cygwin2.o. * config/i386/cygwin1.c: New file. * config/i386/cygwin2.c: New file. * config/i386/t-cygming: New makefile stub. From-SVN: r64643
This commit is contained in:
parent
03c1f6a3ea
commit
70e5e841b8
@ -1,3 +1,34 @@
|
||||
2003-03-21 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* config.gcc (i[34567]86-*-cygwin*): Use new common makefile
|
||||
stub t-cygming. Use common target header cygming.h. Add extra
|
||||
c_target_obj and cxx_target_obj file. Default cygwin to posix
|
||||
threading. Enforce i386 as float format.
|
||||
(i[34567]86-*-mingw*): Use new common makefile stub t-cygming.
|
||||
Remove cygwin.h as target header. Use common target header
|
||||
cygming.h Enforce i386 as float format. Correct typo.
|
||||
* config/i386/cygming.h: New file, containing definitions
|
||||
common to mingw32 and cygwin.
|
||||
* config/i386/cygwin.h: Remove definitions common to cygwin and
|
||||
mingw. Simplify special spec logic. Define "wrappers" around
|
||||
certain include path defines to accommodate -mno-cygwin.
|
||||
Remove some #if 0'ed code.
|
||||
(STANDARD_INCLUDE_DIR) Always define when not cross-compiling.
|
||||
(LINK_SPEC): Don't use cyg search prefix when -mno-cygwin.
|
||||
(GCC_DRIVER_HOST_INITIALIZATION): Define as call to mingw_scan.
|
||||
* config/i386/mingw32.h: Remove definitions common to cygwin and
|
||||
mingw.
|
||||
(EXTRA_OS_CPP_BUILTINS): Adjust.
|
||||
(TARGET_VERSION): Define.
|
||||
* config/i386/crtdll.h (EXTRA_OS_CPP_BUILTINS): Override
|
||||
mingw32.h definitions.
|
||||
(LIBGCC_SPEC): Add libmingwex.a as in mingw32.h.
|
||||
* config/i386/t-cygwin (EXTRA_GCC_OBJS): Define as cygwin1.o.
|
||||
Add compilation rules for cygwin1.o cygwin2.o.
|
||||
* config/i386/cygwin1.c: New file.
|
||||
* config/i386/cygwin2.c: New file.
|
||||
* config/i386/t-cygming: New makefile stub.
|
||||
|
||||
2003-03-20 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* fold-const.c (extract_muldiv_1): Revert changing order of
|
||||
|
@ -1320,21 +1320,25 @@ i[34567]86-*-win32)
|
||||
exeext=.exe
|
||||
;;
|
||||
i[34567]86-*-pe | i[34567]86-*-cygwin*)
|
||||
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h"
|
||||
xm_defines=POSIX
|
||||
xm_file=i386/xm-cygwin.h
|
||||
tmake_file=i386/t-cygwin
|
||||
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygwin.h"
|
||||
tmake_file="i386/t-cygming i386/t-cygwin"
|
||||
float_format=i386
|
||||
extra_objs=winnt.o
|
||||
c_target_objs=cygwin2.o
|
||||
cxx_target_objs=cygwin2.o
|
||||
if test x$enable_threads = xyes; then
|
||||
thread_file='win32'
|
||||
thread_file='posix'
|
||||
fi
|
||||
exeext=.exe
|
||||
;;
|
||||
i[34567]86-*-mingw32*)
|
||||
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygwin.h i386/mingw32.h"
|
||||
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
|
||||
xm_defines=POSIX
|
||||
xm_file=i386/xm-mingw32.h
|
||||
tmake_file="i386/t-cygwin i386/t-mingw32"
|
||||
tmake_file="i386/t-cygming i386/t-mingw32"
|
||||
float_format=i386
|
||||
extra_objs=winnt.o
|
||||
if test x$enable_threads = xyes; then
|
||||
thread_file='win32'
|
||||
@ -1344,7 +1348,7 @@ i[34567]86-*-mingw32*)
|
||||
*mingw32crt*)
|
||||
tm_file="${tm_file} i386/crtdll.h"
|
||||
;;
|
||||
*minwg32msv* | *mingw32*)
|
||||
*mingw32msv* | *mingw32*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -21,14 +21,23 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef EXTRA_OS_CPP_BUILTINS
|
||||
#define EXTRA_OS_CPP_BUILTINS() \
|
||||
do { builtin_define ("__MINGW32__=0.2"); } while (0)
|
||||
#define EXTRA_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__CRTDLL__"); \
|
||||
builtin_define ("__MINGW32__"); \
|
||||
builtin_define ("_WIN32"); \
|
||||
builtin_define_std ("WIN32"); \
|
||||
builtin_define_std ("WINNT"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef LIBGCC_SPEC
|
||||
#define LIBGCC_SPEC \
|
||||
"%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lcrtdll"
|
||||
"%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lcoldname -libmingwex -lcrtdll"
|
||||
|
||||
/* Specify a different entry point when linking a DLL */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{mdll:dllcrt1%O%s} %{!mdll:crt1%O%s} %{pg:gcrt1%O%s}"
|
||||
#define STARTFILE_SPEC "%{shared|mdll:dllcrt1%O%s} \
|
||||
%{!shared:%{!mdll:crt1%O%s}} %{pg:gcrt1%O%s}"
|
||||
|
||||
|
370
gcc/config/i386/cygming.h
Normal file
370
gcc/config/i386/cygming.h
Normal file
@ -0,0 +1,370 @@
|
||||
/* Operating system specific defines to be used when targeting GCC for
|
||||
hosting on Windows32, using a Unix style C library and tools.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
#define SDB_DEBUGGING_INFO 1
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#define TARGET_EXECUTABLE_SUFFIX ".exe"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Masks for subtarget switches used by other files. */
|
||||
#define MASK_NOP_FUN_DLLIMPORT 0x08000000 /* Ignore dllimport for functions */
|
||||
|
||||
/* Used in winnt.c. */
|
||||
#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "cygwin", 0, N_("Use the Cygwin interface") }, \
|
||||
{ "no-cygwin", 0, N_("Use the Mingw32 interface") }, \
|
||||
{ "windows", 0, N_("Create GUI application") }, \
|
||||
{ "no-win32", 0, N_("Don't set Windows defines") }, \
|
||||
{ "win32", 0, N_("Set Windows defines") }, \
|
||||
{ "console", 0, N_("Create console application") },\
|
||||
{ "dll", 0, N_("Generate code for a DLL") }, \
|
||||
{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
|
||||
N_("Ignore dllimport for functions") }, \
|
||||
{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \
|
||||
{ "threads", 0, N_("Use Mingw-specific thread support") },
|
||||
|
||||
#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing. */
|
||||
|
||||
/* Support the __declspec keyword by turning them into attributes.
|
||||
We currently only support: dllimport and dllexport.
|
||||
Note that the current way we do this may result in a collision with
|
||||
predefined attributes later on. This can be solved by using one attribute,
|
||||
say __declspec__, and passing args to it. The problem with that approach
|
||||
is that args are not accumulated: each new appearance would clobber any
|
||||
existing args. */
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_X86_=1"); \
|
||||
builtin_assert ("system=winnt"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_define ("__declspec(x)=__attribute__((x))"); \
|
||||
if (!flag_iso) \
|
||||
{ \
|
||||
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
|
||||
} \
|
||||
MAYBE_UWIN_CPP_BUILTINS (); \
|
||||
EXTRA_OS_CPP_BUILTINS (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Get tree.c to declare a target-specific specialization of
|
||||
merge_decl_attributes. */
|
||||
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
|
||||
|
||||
/* This macro defines names of additional specifications to put in the specs
|
||||
that can be used in various specifications like CC1_SPEC. Its definition
|
||||
is an initializer with a subgrouping for each command option.
|
||||
|
||||
Each subgrouping contains a string constant, that defines the
|
||||
specification name, and a string constant that used by the GNU CC driver
|
||||
program.
|
||||
|
||||
Do not define this macro if it does not need to do anything. */
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "mingw_include_path", DEFAULT_TARGET_MACHINE }
|
||||
|
||||
#undef MATH_LIBRARY
|
||||
#define MATH_LIBRARY ""
|
||||
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define PTRDIFF_TYPE "int"
|
||||
#define WCHAR_TYPE_SIZE 16
|
||||
#define WCHAR_TYPE "short unsigned int"
|
||||
|
||||
|
||||
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
||||
|
||||
union tree_node;
|
||||
#define TREE union tree_node *
|
||||
|
||||
#undef EXTRA_SECTIONS
|
||||
#define EXTRA_SECTIONS in_drectve
|
||||
|
||||
#undef EXTRA_SECTION_FUNCTIONS
|
||||
#define EXTRA_SECTION_FUNCTIONS \
|
||||
DRECTVE_SECTION_FUNCTION \
|
||||
SWITCH_TO_SECTION_FUNCTION
|
||||
|
||||
#define DRECTVE_SECTION_FUNCTION \
|
||||
void \
|
||||
drectve_section () \
|
||||
{ \
|
||||
if (in_section != in_drectve) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \
|
||||
in_section = in_drectve; \
|
||||
} \
|
||||
}
|
||||
void drectve_section PARAMS ((void));
|
||||
|
||||
/* Switch to SECTION (an `enum in_section').
|
||||
|
||||
??? This facility should be provided by GCC proper.
|
||||
The problem is that we want to temporarily switch sections in
|
||||
ASM_DECLARE_OBJECT_NAME and then switch back to the original section
|
||||
afterwards. */
|
||||
#define SWITCH_TO_SECTION_FUNCTION \
|
||||
void switch_to_section PARAMS ((enum in_section, tree)); \
|
||||
void \
|
||||
switch_to_section (section, decl) \
|
||||
enum in_section section; \
|
||||
tree decl; \
|
||||
{ \
|
||||
switch (section) \
|
||||
{ \
|
||||
case in_text: text_section (); break; \
|
||||
case in_data: data_section (); break; \
|
||||
case in_named: named_section (decl, NULL, 0); break; \
|
||||
case in_drectve: drectve_section (); break; \
|
||||
default: abort (); break; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Don't allow flag_pic to propagate since gas may produce invalid code
|
||||
otherwise. */
|
||||
|
||||
#undef SUBTARGET_OVERRIDE_OPTIONS
|
||||
#define SUBTARGET_OVERRIDE_OPTIONS \
|
||||
do { \
|
||||
if (flag_pic) \
|
||||
{ \
|
||||
warning ("-f%s ignored for target (all code is position independent)",\
|
||||
(flag_pic > 1) ? "PIC" : "pic"); \
|
||||
flag_pic = 0; \
|
||||
} \
|
||||
} while (0) \
|
||||
|
||||
/* Define this macro if references to a symbol must be treated
|
||||
differently depending on something about the variable or
|
||||
function named by the symbol (such as what section it is in).
|
||||
|
||||
On i386 running Windows NT, modify the assembler name with a suffix
|
||||
consisting of an atsign (@) followed by string of digits that represents
|
||||
the number of bytes of arguments passed to the function, if it has the
|
||||
attribute STDCALL.
|
||||
|
||||
In addition, we must mark dll symbols specially. Definitions of
|
||||
dllexport'd objects install some info in the .drectve section.
|
||||
References to dllimport'd objects are fetched indirectly via
|
||||
_imp__. If both are declared, dllexport overrides. This is also
|
||||
needed to implement one-only vtables: they go into their own
|
||||
section and we need to set DECL_SECTION_NAME so we do that here.
|
||||
Note that we can be called twice on the same decl. */
|
||||
|
||||
#undef TARGET_ENCODE_SECTION_INFO
|
||||
#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
|
||||
#undef TARGET_STRIP_NAME_ENCODING
|
||||
#define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full
|
||||
|
||||
/* Output a reference to a label. */
|
||||
#undef ASM_OUTPUT_LABELREF
|
||||
#define ASM_OUTPUT_LABELREF i386_pe_output_labelref
|
||||
|
||||
/* Output a common block. */
|
||||
#undef ASM_OUTPUT_COMMON
|
||||
#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
|
||||
do { \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 1); \
|
||||
if (! i386_pe_dllimport_name_p (NAME)) \
|
||||
{ \
|
||||
fprintf ((STREAM), "\t.comm\t"); \
|
||||
assemble_name ((STREAM), (NAME)); \
|
||||
fprintf ((STREAM), ", %d\t%s %d\n", \
|
||||
(ROUNDED), ASM_COMMENT_START, (SIZE)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Output the label for an initialized variable. */
|
||||
#undef ASM_DECLARE_OBJECT_NAME
|
||||
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
|
||||
do { \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 1); \
|
||||
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Emit code to check the stack when allocating more that 4000
|
||||
bytes in one go. */
|
||||
|
||||
#define CHECK_STACK_LIMIT 4000
|
||||
|
||||
/* By default, target has a 80387, uses IEEE compatible arithmetic,
|
||||
returns float values in the 387 and needs stack probes.
|
||||
We also align doubles to 64-bits for MSVC default compatibility. */
|
||||
|
||||
#undef TARGET_SUBTARGET_DEFAULT
|
||||
#define TARGET_SUBTARGET_DEFAULT \
|
||||
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
|
||||
| MASK_ALIGN_DOUBLE)
|
||||
|
||||
/* This is how to output an assembler line
|
||||
that says to advance the location counter
|
||||
to a multiple of 2**LOG bytes. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGN
|
||||
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
||||
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
|
||||
|
||||
/* Define this macro if in some cases global symbols from one translation
|
||||
unit may not be bound to undefined symbols in another translation unit
|
||||
without user intervention. For instance, under Microsoft Windows
|
||||
symbols must be explicitly imported from shared libraries (DLLs). */
|
||||
#define MULTIPLE_SYMBOL_SPACES
|
||||
|
||||
extern void i386_pe_unique_section PARAMS ((TREE, int));
|
||||
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
|
||||
|
||||
#define SUPPORTS_ONE_ONLY 1
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
|
||||
|
||||
/* Select attributes for named sections. */
|
||||
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
|
||||
|
||||
/* Write the extra assembler code needed to declare a function
|
||||
properly. If we are generating SDB debugging information, this
|
||||
will happen automatically, so we only need to handle other cases. */
|
||||
#undef ASM_DECLARE_FUNCTION_NAME
|
||||
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 0); \
|
||||
if (write_symbols != SDB_DEBUG) \
|
||||
i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
|
||||
ASM_OUTPUT_LABEL (FILE, NAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Add an external function to the list of functions to be declared at
|
||||
the end of the file. */
|
||||
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
i386_pe_record_external_function (NAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Declare the type properly for any external libcall. */
|
||||
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
||||
i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
|
||||
|
||||
/* This says out to put a global symbol in the BSS section. */
|
||||
#undef ASM_OUTPUT_ALIGNED_BSS
|
||||
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
||||
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
|
||||
|
||||
/* Output function declarations at the end of the file. */
|
||||
#undef ASM_FILE_END
|
||||
#define ASM_FILE_END(FILE) \
|
||||
i386_pe_asm_file_end (FILE)
|
||||
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START " #"
|
||||
|
||||
/* DWARF2 Unwinding doesn't work with exception handling yet. To make
|
||||
it work, we need to build a libgcc_s.dll, and dcrt0.o should be
|
||||
changed to call __register_frame_info/__deregister_frame_info. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#undef PROFILE_HOOK
|
||||
#define PROFILE_HOOK(LABEL) \
|
||||
if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \
|
||||
{ \
|
||||
emit_call_insn (gen_rtx (CALL, VOIDmode, \
|
||||
gen_rtx_MEM (FUNCTION_MODE, \
|
||||
gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \
|
||||
const0_rtx)); \
|
||||
}
|
||||
|
||||
/* Java Native Interface (JNI) methods on Win32 are invoked using the
|
||||
stdcall calling convention. */
|
||||
#undef MODIFY_JNI_METHOD_CALL
|
||||
#define MODIFY_JNI_METHOD_CALL(MDECL) \
|
||||
build_type_attribute_variant ((MDECL), \
|
||||
build_tree_list (get_identifier ("stdcall"), \
|
||||
NULL))
|
||||
|
||||
/* External function declarations. */
|
||||
|
||||
extern void i386_pe_record_external_function PARAMS ((const char *));
|
||||
extern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int));
|
||||
extern void i386_pe_record_exported_symbol PARAMS ((const char *, int));
|
||||
extern void i386_pe_asm_file_end PARAMS ((FILE *));
|
||||
extern int i386_pe_dllexport_name_p PARAMS ((const char *));
|
||||
extern int i386_pe_dllimport_name_p PARAMS ((const char *));
|
||||
|
||||
/* For Win32 ABI compatibility */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* MSVC returns aggregate types of up to 8 bytes via registers.
|
||||
See i386.c:ix86_return_in_memory. */
|
||||
#undef MS_AGGREGATE_RETURN
|
||||
#define MS_AGGREGATE_RETURN 1
|
||||
|
||||
/* No data type wants to be aligned rounder than this. */
|
||||
#undef BIGGEST_ALIGNMENT
|
||||
#define BIGGEST_ALIGNMENT 128
|
||||
|
||||
/* Native complier aligns internal doubles in structures on dword boundaries. */
|
||||
#undef BIGGEST_FIELD_ALIGNMENT
|
||||
#define BIGGEST_FIELD_ALIGNMENT 64
|
||||
|
||||
/* A bit-field declared as `int' forces `int' alignment for the struct. */
|
||||
#undef PCC_BITFIELD_TYPE_MATTERS
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
|
||||
|
||||
/* Enable alias attribute support. */
|
||||
#ifndef SET_ASM_OP
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
#endif
|
||||
|
||||
#undef TREE
|
||||
|
||||
#ifndef BUFSIZ
|
||||
# undef FILE
|
||||
#endif
|
@ -20,135 +20,35 @@ along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
#define SDB_DEBUGGING_INFO 1
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
|
||||
#define TARGET_EXECUTABLE_SUFFIX ".exe"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Masks for subtarget switches used by other files. */
|
||||
#define MASK_NOP_FUN_DLLIMPORT 0x08000000 /* Ignore dllimport for functions */
|
||||
|
||||
/* Used in winnt.c. */
|
||||
#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "cygwin", 0, N_("Use the Cygwin interface") }, \
|
||||
{ "no-cygwin", 0, N_("Use the Mingw32 interface") }, \
|
||||
{ "windows", 0, N_("Create GUI application") }, \
|
||||
{ "no-win32", 0, N_("Don't set Windows defines") }, \
|
||||
{ "win32", 0, N_("Set Windows defines") }, \
|
||||
{ "console", 0, N_("Create console application") },\
|
||||
{ "dll", 0, N_("Generate code for a DLL") }, \
|
||||
{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
|
||||
N_("Ignore dllimport for functions") }, \
|
||||
{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \
|
||||
{ "threads", 0, N_("Use Mingw-specific thread support") },
|
||||
|
||||
#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing. */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_X86_=1"); \
|
||||
builtin_assert ("system=winnt"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_define ("__declspec(x)=__attribute__((x))"); \
|
||||
if (!flag_iso) \
|
||||
{ \
|
||||
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
|
||||
} \
|
||||
MAYBE_UWIN_CPP_BUILTINS (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#ifdef CROSS_COMPILE
|
||||
#define CYGWIN_INCLUDES "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include}"
|
||||
#define W32API_INC "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include/w32api}"
|
||||
#define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/"
|
||||
#define CYGWIN_LIB CYGWIN_CROSS_DIR "/lib"
|
||||
#define MINGW_LIBS "-L" CYGWIN_CROSS_DIR "/lib/mingw"
|
||||
#define MINGW_INCLUDES "%{!nostdinc:-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++-3 "\
|
||||
"-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++ "\
|
||||
"-idirafter " CYGWIN_CROSS_DIR "/include/mingw}"
|
||||
#else
|
||||
#define CYGWIN_INCLUDES "%{!nostdinc:-isystem /usr/local/include "\
|
||||
"-idirafter " CYGWIN_CROSS_DIR "/include "\
|
||||
"-idirafter /usr/include}"
|
||||
#define W32API_INC "%{!nostdinc:"\
|
||||
"-idirafter " CYGWIN_CROSS_DIR "/include/w32api "\
|
||||
"-idirafter /usr/include/w32api}"
|
||||
#define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/ -L/usr/lib/w32api/"
|
||||
#define CYGWIN_LIB "/usr/lib"
|
||||
#define MINGW_LIBS "-L/usr/local/lib/mingw -L/usr/lib/mingw"
|
||||
#define MINGW_INCLUDES "%{!nostdinc:-isystem /usr/include/mingw/g++-3 "\
|
||||
"-isystem /usr/include/mingw/g++ "\
|
||||
"-isystem /usr/local/include/mingw "\
|
||||
"-idirafter " CYGWIN_CROSS_DIR "/include/mingw "\
|
||||
"-idirafter /usr/include/mingw}"
|
||||
#endif
|
||||
|
||||
/* Get tree.c to declare a target-specific specialization of
|
||||
merge_decl_attributes. */
|
||||
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
|
||||
|
||||
/* Support the __declspec keyword by turning them into attributes.
|
||||
We currently only support: dllimport and dllexport.
|
||||
Note that the current way we do this may result in a collision with
|
||||
predefined attributes later on. This can be solved by using one attribute,
|
||||
say __declspec__, and passing args to it. The problem with that approach
|
||||
is that args are not accumulated: each new appearance would clobber any
|
||||
existing args. */
|
||||
#define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
|
||||
#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
|
||||
%{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
|
||||
%{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\
|
||||
MINGW_INCLUDES "} \
|
||||
%{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix "\
|
||||
CYGWIN_INCLUDES "}\
|
||||
%{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{!ansi:%{mthreads:-D_MT}}}\
|
||||
%{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix }\
|
||||
%{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
|
||||
%{!mno-win32:" W32API_INC "}\
|
||||
%{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
|
||||
"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "\
|
||||
%{shared|mdll: %{mno-cygwin:" MINGW_LIBS " dllcrt2%O%s}}\
|
||||
%{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " crt2%O%s}\
|
||||
%{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}\
|
||||
%{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}\
|
||||
%{pg:gcrt0%O%s}}}\
|
||||
"
|
||||
|
||||
/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
|
||||
want to allow things to be added to it when installing new versions of
|
||||
GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
|
||||
by calling the init function from the prologue. */
|
||||
by calling the init function from main. */
|
||||
|
||||
#undef LIBGCC_SPEC
|
||||
#define LIBGCC_SPEC "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} \
|
||||
-lgcc %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
|
||||
|
||||
/* This macro defines names of additional specifications to put in the specs
|
||||
that can be used in various specifications like CC1_SPEC. Its definition
|
||||
is an initializer with a subgrouping for each command option.
|
||||
|
||||
Each subgrouping contains a string constant, that defines the
|
||||
specification name, and a string constant that used by the GNU CC driver
|
||||
program.
|
||||
|
||||
Do not define this macro if it does not need to do anything. */
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "mingw_include_path", DEFAULT_TARGET_MACHINE }
|
||||
#define LIBGCC_SPEC \
|
||||
"%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
|
||||
%{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
|
||||
|
||||
/* We have to dynamic link to get to the system DLLs. All of libc, libm and
|
||||
the Unix stuff is in cygwin.dll. The import library is called
|
||||
@ -164,7 +64,7 @@ Boston, MA 02111-1307, USA. */
|
||||
%{mwindows:-lgdi32 -lcomdlg32} \
|
||||
-luser32 -lkernel32 -ladvapi32 -lshell32"
|
||||
|
||||
#define LINK_SPEC W32API_LIB "\
|
||||
#define LINK_SPEC "\
|
||||
%{mwindows:--subsystem windows} \
|
||||
%{mconsole:--subsystem console} \
|
||||
%{shared: %{mdll: %eshared and mdll are not compatible}} \
|
||||
@ -173,296 +73,158 @@ Boston, MA 02111-1307, USA. */
|
||||
%{shared|mdll: -e \
|
||||
%{mno-cygwin:_DllMainCRTStartup@12} \
|
||||
%{!mno-cygwin:__cygwin_dll_entry@12}}\
|
||||
--dll-search-prefix=cyg"
|
||||
%{!mno-cygwin:--dll-search-prefix=cyg}"
|
||||
|
||||
#undef MATH_LIBRARY
|
||||
#define MATH_LIBRARY ""
|
||||
/* Allocate space for all of the machine-spec-specific stuff.
|
||||
Allocate enough space for cygwin -> mingw32 munging plus
|
||||
possible addition of "/mingw". */
|
||||
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define PTRDIFF_TYPE "int"
|
||||
#define WCHAR_TYPE_SIZE 16
|
||||
#define WCHAR_TYPE "short unsigned int"
|
||||
#ifndef CYGWIN_MINGW_SUBDIR
|
||||
#define CYGWIN_MINGW_SUBDIR "/mingw"
|
||||
#endif
|
||||
#define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
|
||||
|
||||
|
||||
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
||||
|
||||
union tree_node;
|
||||
#define TREE union tree_node *
|
||||
|
||||
#undef EXTRA_SECTIONS
|
||||
#define EXTRA_SECTIONS in_drectve
|
||||
|
||||
#undef EXTRA_SECTION_FUNCTIONS
|
||||
#define EXTRA_SECTION_FUNCTIONS \
|
||||
DRECTVE_SECTION_FUNCTION \
|
||||
SWITCH_TO_SECTION_FUNCTION
|
||||
|
||||
#define DRECTVE_SECTION_FUNCTION \
|
||||
void \
|
||||
drectve_section () \
|
||||
{ \
|
||||
if (in_section != in_drectve) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \
|
||||
in_section = in_drectve; \
|
||||
} \
|
||||
}
|
||||
void drectve_section PARAMS ((void));
|
||||
|
||||
/* Switch to SECTION (an `enum in_section').
|
||||
|
||||
??? This facility should be provided by GCC proper.
|
||||
The problem is that we want to temporarily switch sections in
|
||||
ASM_DECLARE_OBJECT_NAME and then switch back to the original section
|
||||
afterwards. */
|
||||
#define SWITCH_TO_SECTION_FUNCTION \
|
||||
void switch_to_section PARAMS ((enum in_section, tree)); \
|
||||
void \
|
||||
switch_to_section (section, decl) \
|
||||
enum in_section section; \
|
||||
tree decl; \
|
||||
{ \
|
||||
switch (section) \
|
||||
{ \
|
||||
case in_text: text_section (); break; \
|
||||
case in_data: data_section (); break; \
|
||||
case in_named: named_section (decl, NULL, 0); break; \
|
||||
case in_drectve: drectve_section (); break; \
|
||||
default: abort (); break; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Don't allow flag_pic to propagate since gas may produce invalid code
|
||||
otherwise. */
|
||||
|
||||
#undef SUBTARGET_OVERRIDE_OPTIONS
|
||||
#define SUBTARGET_OVERRIDE_OPTIONS \
|
||||
do { \
|
||||
if (flag_pic) \
|
||||
{ \
|
||||
warning ("-f%s ignored for target (all code is position independent)",\
|
||||
(flag_pic > 1) ? "PIC" : "pic"); \
|
||||
flag_pic = 0; \
|
||||
} \
|
||||
} while (0) \
|
||||
|
||||
/* Define this macro if references to a symbol must be treated
|
||||
differently depending on something about the variable or
|
||||
function named by the symbol (such as what section it is in).
|
||||
|
||||
On i386 running Windows NT, modify the assembler name with a suffix
|
||||
consisting of an atsign (@) followed by string of digits that represents
|
||||
the number of bytes of arguments passed to the function, if it has the
|
||||
attribute STDCALL.
|
||||
|
||||
In addition, we must mark dll symbols specially. Definitions of
|
||||
dllexport'd objects install some info in the .drectve section.
|
||||
References to dllimport'd objects are fetched indirectly via
|
||||
_imp__. If both are declared, dllexport overrides. This is also
|
||||
needed to implement one-only vtables: they go into their own
|
||||
section and we need to set DECL_SECTION_NAME so we do that here.
|
||||
Note that we can be called twice on the same decl. */
|
||||
|
||||
#undef TARGET_ENCODE_SECTION_INFO
|
||||
#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
|
||||
#undef TARGET_STRIP_NAME_ENCODING
|
||||
#define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full
|
||||
|
||||
/* Output a reference to a label. */
|
||||
#undef ASM_OUTPUT_LABELREF
|
||||
#define ASM_OUTPUT_LABELREF i386_pe_output_labelref
|
||||
|
||||
/* Output a common block. */
|
||||
#undef ASM_OUTPUT_COMMON
|
||||
#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
|
||||
do { \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 1); \
|
||||
if (! i386_pe_dllimport_name_p (NAME)) \
|
||||
{ \
|
||||
fprintf ((STREAM), "\t.comm\t"); \
|
||||
assemble_name ((STREAM), (NAME)); \
|
||||
fprintf ((STREAM), ", %d\t%s %d\n", \
|
||||
(ROUNDED), ASM_COMMENT_START, (SIZE)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Output the label for an initialized variable. */
|
||||
#undef ASM_DECLARE_OBJECT_NAME
|
||||
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
|
||||
do { \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 1); \
|
||||
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Emit code to check the stack when allocating more that 4000
|
||||
bytes in one go. */
|
||||
|
||||
#define CHECK_STACK_LIMIT 4000
|
||||
|
||||
/* By default, target has a 80387, uses IEEE compatible arithmetic,
|
||||
returns float values in the 387 and needs stack probes.
|
||||
We also align doubles to 64-bits for MSVC default compatibility. */
|
||||
|
||||
#undef TARGET_SUBTARGET_DEFAULT
|
||||
#define TARGET_SUBTARGET_DEFAULT \
|
||||
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
|
||||
| MASK_ALIGN_DOUBLE)
|
||||
|
||||
/* This is how to output an assembler line
|
||||
that says to advance the location counter
|
||||
to a multiple of 2**LOG bytes. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGN
|
||||
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
||||
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
|
||||
|
||||
/* Define this macro if in some cases global symbols from one translation
|
||||
unit may not be bound to undefined symbols in another translation unit
|
||||
without user intervention. For instance, under Microsoft Windows
|
||||
symbols must be explicitly imported from shared libraries (DLLs). */
|
||||
#define MULTIPLE_SYMBOL_SPACES
|
||||
|
||||
extern void i386_pe_unique_section PARAMS ((TREE, int));
|
||||
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
|
||||
|
||||
#define SUPPORTS_ONE_ONLY 1
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
|
||||
|
||||
/* Select attributes for named sections. */
|
||||
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
|
||||
|
||||
/* Write the extra assembler code needed to declare a function
|
||||
properly. If we are generating SDB debugging information, this
|
||||
will happen automatically, so we only need to handle other cases. */
|
||||
#undef ASM_DECLARE_FUNCTION_NAME
|
||||
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
if (i386_pe_dllexport_name_p (NAME)) \
|
||||
i386_pe_record_exported_symbol (NAME, 0); \
|
||||
if (write_symbols != SDB_DEBUG) \
|
||||
i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
|
||||
ASM_OUTPUT_LABEL (FILE, NAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Add an external function to the list of functions to be declared at
|
||||
the end of the file. */
|
||||
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
i386_pe_record_external_function (NAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Declare the type properly for any external libcall. */
|
||||
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
||||
i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
|
||||
|
||||
/* This says out to put a global symbol in the BSS section. */
|
||||
#undef ASM_OUTPUT_ALIGNED_BSS
|
||||
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
||||
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
|
||||
|
||||
/* Output function declarations at the end of the file. */
|
||||
#undef ASM_FILE_END
|
||||
#define ASM_FILE_END(FILE) \
|
||||
i386_pe_asm_file_end (FILE)
|
||||
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START " #"
|
||||
|
||||
/* DWARF2 Unwinding doesn't work with exception handling yet. To make
|
||||
it work, we need to build a libgcc_s.dll, and dcrt0.o should be
|
||||
changed to call __register_frame_info/__deregister_frame_info. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#undef PROFILE_HOOK
|
||||
#define PROFILE_HOOK(LABEL) \
|
||||
if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \
|
||||
{ \
|
||||
emit_call_insn (gen_rtx (CALL, VOIDmode, \
|
||||
gen_rtx_MEM (FUNCTION_MODE, \
|
||||
gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \
|
||||
const0_rtx)); \
|
||||
}
|
||||
|
||||
/* Java Native Interface (JNI) methods on Win32 are invoked using the
|
||||
stdcall calling convention. */
|
||||
#undef MODIFY_JNI_METHOD_CALL
|
||||
#define MODIFY_JNI_METHOD_CALL(MDECL) \
|
||||
build_type_attribute_variant ((MDECL), \
|
||||
build_tree_list (get_identifier ("stdcall"), \
|
||||
NULL))
|
||||
|
||||
|
||||
/* External function declarations. */
|
||||
|
||||
extern void i386_pe_record_external_function PARAMS ((const char *));
|
||||
extern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int));
|
||||
extern void i386_pe_record_exported_symbol PARAMS ((const char *, int));
|
||||
extern void i386_pe_asm_file_end PARAMS ((FILE *));
|
||||
extern int i386_pe_dllexport_name_p PARAMS ((const char *));
|
||||
extern int i386_pe_dllimport_name_p PARAMS ((const char *));
|
||||
|
||||
/* For Win32 ABI compatibility */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* MSVC returns aggregate types of up to 8 bytes via registers.
|
||||
See i386.c:ix86_return_in_memory. */
|
||||
#undef MS_AGGREGATE_RETURN
|
||||
#define MS_AGGREGATE_RETURN 1
|
||||
|
||||
/* No data type wants to be aligned rounder than this. */
|
||||
#undef BIGGEST_ALIGNMENT
|
||||
#define BIGGEST_ALIGNMENT 128
|
||||
|
||||
/* Native complier aligns internal doubles in structures on dword boundaries. */
|
||||
#undef BIGGEST_FIELD_ALIGNMENT
|
||||
#define BIGGEST_FIELD_ALIGNMENT 64
|
||||
|
||||
/* A bit-field declared as `int' forces `int' alignment for the struct. */
|
||||
#undef PCC_BITFIELD_TYPE_MATTERS
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
|
||||
|
||||
|
||||
/* Enable alias attribute support. */
|
||||
#ifndef SET_ASM_OP
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
#ifdef GPLUSPLUS_INCLUDE_DIR
|
||||
char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
|
||||
+ (CYGWIN_MINGW_SUBDIR_LEN)]
|
||||
= GPLUSPLUS_INCLUDE_DIR;
|
||||
#undef GPLUSPLUS_INCLUDE_DIR
|
||||
#define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Override GCC's relative pathname lookup (ie., relocatability) unless
|
||||
otherwise told by other subtargets. */
|
||||
#ifndef WIN32_NO_ABSOLUTE_INST_DIRS
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
#define MD_STARTFILE_PREFIX "/usr/lib/"
|
||||
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
|
||||
char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= GPLUSPLUS_TOOL_INCLUDE_DIR;
|
||||
#undef GPLUSPLUS_TOOL_INCLUDE_DIR
|
||||
#define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef STANDARD_STARTFILE_PREFIX
|
||||
#define STANDARD_STARTFILE_PREFIX "/usr/lib/mingw/"
|
||||
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
||||
char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= GPLUSPLUS_BACKWARD_INCLUDE_DIR;
|
||||
#undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
||||
#define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL_INCLUDE_DIR
|
||||
char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= LOCAL_INCLUDE_DIR;
|
||||
#undef LOCAL_INCLUDE_DIR
|
||||
#define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CROSS_INCLUDE_DIR
|
||||
char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= CROSS_INCLUDE_DIR;
|
||||
#undef CROSS_INCLUDE_DIR
|
||||
#define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TOOL_INCLUDE_DIR
|
||||
char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= TOOL_INCLUDE_DIR;
|
||||
#undef TOOL_INCLUDE_DIR
|
||||
#define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
|
||||
|
||||
#ifndef CROSS_COMPILE
|
||||
#undef LOCAL_INCLUDE_DIR
|
||||
#undef TOOL_INCLUDE_DIR
|
||||
#undef SYSTEM_INCLUDE_DIR
|
||||
#undef STANDARD_INCLUDE_DIR
|
||||
#define STANDARD_INCLUDE_DIR 0
|
||||
#endif /* not CROSS_COMPILE */
|
||||
#endif /* not WIN32_NO_ABSOLUTE_INST_DIRS */
|
||||
|
||||
#undef TREE
|
||||
|
||||
#ifndef BUFSIZ
|
||||
# undef FILE
|
||||
#define STANDARD_INCLUDE_DIR "/usr/include"
|
||||
char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
|
||||
+ CYGWIN_MINGW_SUBDIR_LEN]
|
||||
= STANDARD_INCLUDE_DIR;
|
||||
#undef STANDARD_INCLUDE_DIR
|
||||
#define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
|
||||
#endif
|
||||
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
#define GEN_CVT_ARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GEN_CVT_ARRAY
|
||||
extern char *cvt_to_mingw[];
|
||||
#else
|
||||
char *cvt_to_mingw[] =
|
||||
{
|
||||
#ifdef GPLUSPLUS_INCLUDE_DIR
|
||||
cygwin_gplusplus_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
|
||||
cygwin_gplusplus_tool_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
||||
cygwin_gplusplus_backward_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL_INCLUDE_DIR
|
||||
cygwin_local_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef CROSS_INCLUDE_DIR
|
||||
cygwin_cross_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef TOOL_INCLUDE_DIR
|
||||
cygwin_tool_include_dir,
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD_INCLUDE_DIR
|
||||
cygwin_standard_include_dir,
|
||||
#endif
|
||||
|
||||
NULL
|
||||
};
|
||||
#undef GEN_CVT_ARRAY
|
||||
#endif /*GEN_CVT_ARRAY*/
|
||||
|
||||
void mingw_scan PARAMS ((int, const char * const *, char **));
|
||||
#if 1
|
||||
#define GCC_DRIVER_HOST_INITIALIZATION \
|
||||
do \
|
||||
{ \
|
||||
mingw_scan(argc, argv, (char **) &spec_machine); \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
#define GCC_DRIVER_HOST_INITIALIZATION \
|
||||
do \
|
||||
{ \
|
||||
char *cprefix = concat (tooldir_base_prefix, spec_machine, \
|
||||
dir_separator_str, NULL); \
|
||||
if (!IS_ABSOLUTE_PATHNAME (cprefix)) \
|
||||
cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
|
||||
spec_version, dir_separator_str, tooldir_prefix, NULL); \
|
||||
add_prefix (&exec_prefixes,\
|
||||
concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
|
||||
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
|
||||
add_prefix (&exec_prefixes, cprefix, \
|
||||
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
|
||||
add_prefix (&startfile_prefixes,\
|
||||
concat (standard_startfile_prefix, "w32api", NULL),\
|
||||
"GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
|
||||
mingw_scan(argc, argv, &spec_machine); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
55
gcc/config/i386/cygwin1.c
Normal file
55
gcc/config/i386/cygwin1.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* Helper routines for cygwin-specific command-line parsing.
|
||||
Contributed by Christopher Faylor (cgf@redhat.com)
|
||||
Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
#include <string.h>
|
||||
|
||||
void
|
||||
mingw_scan (argc, argv, spec_machine)
|
||||
int argc ATTRIBUTE_UNUSED;
|
||||
const char *const *argv;
|
||||
char **spec_machine;
|
||||
{
|
||||
putenv ("GCC_CYGWIN_MINGW=0");
|
||||
|
||||
while (*++argv)
|
||||
if (strcmp (*argv, "-mno-win32") == 0)
|
||||
putenv ("GCC_CYGWIN_WIN32=0");
|
||||
else if (strcmp (*argv, "-mwin32") == 0)
|
||||
putenv ("GCC_CYGWIN_WIN32=1");
|
||||
else if (strcmp (*argv, "-mno-cygwin") == 0)
|
||||
{
|
||||
char *p = strstr (*spec_machine, "-cygwin");
|
||||
if (p)
|
||||
{
|
||||
int len = p - *spec_machine;
|
||||
char *s = xmalloc (strlen (*spec_machine) + 3);
|
||||
memcpy (s, *spec_machine, len);
|
||||
strcpy (s + len, "-mingw32");
|
||||
*spec_machine = s;
|
||||
}
|
||||
putenv ("GCC_CYGWIN_MINGW=1");
|
||||
}
|
||||
return;
|
||||
}
|
67
gcc/config/i386/cygwin2.c
Normal file
67
gcc/config/i386/cygwin2.c
Normal file
@ -0,0 +1,67 @@
|
||||
/* Helper routines for cygwin-specific command-line parsing.
|
||||
Contributed by Christopher Faylor (cgf@redhat.com)
|
||||
Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
|
||||
#include "safe-ctype.h"
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
static void remove_w32api PARAMS ((void));
|
||||
*/
|
||||
static void add_mingw PARAMS ((void));
|
||||
static void set_mingw PARAMS((void)) __attribute__ ((constructor));
|
||||
|
||||
static void
|
||||
add_mingw ()
|
||||
{
|
||||
char **av;
|
||||
char *p;
|
||||
for (av = cvt_to_mingw; *av; av++)
|
||||
{
|
||||
int sawcygwin = 0;
|
||||
while ((p = strstr (*av, "-cygwin")))
|
||||
{
|
||||
char *over = p + sizeof ("-cygwin") - 1;
|
||||
memmove (over + 1, over, strlen (over));
|
||||
memcpy (p, "-mingw32", sizeof("-mingw32") - 1);
|
||||
p = ++over;
|
||||
while (ISALNUM (*p))
|
||||
p++;
|
||||
strcpy (over, p);
|
||||
sawcygwin = 1;
|
||||
}
|
||||
if (!sawcygwin && !strstr (*av, "mingw"))
|
||||
strcat (*av, CYGWIN_MINGW_SUBDIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_mingw ()
|
||||
{
|
||||
char *env = getenv ("GCC_CYGWIN_MINGW");
|
||||
if (env && *env == '1')
|
||||
add_mingw ();
|
||||
}
|
@ -20,16 +20,8 @@ along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Most of this is the same as for cygwin, except for changing some
|
||||
specs. */
|
||||
|
||||
/* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must
|
||||
be defined before any other files are included. */
|
||||
#ifndef WIN32_NO_ABSOLUTE_INST_DIRS
|
||||
#define WIN32_NO_ABSOLUTE_INST_DIRS 1
|
||||
#endif
|
||||
|
||||
#define TARGET_EXECUTABLE_SUFFIX ".exe"
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (x86 MinGW)");
|
||||
|
||||
/* See i386/crtdll.h for an alternative definition. */
|
||||
#define EXTRA_OS_CPP_BUILTINS() \
|
||||
@ -37,32 +29,12 @@ Boston, MA 02111-1307, USA. */
|
||||
{ \
|
||||
builtin_define ("__MSVCRT__"); \
|
||||
builtin_define ("__MINGW32__"); \
|
||||
builtin_define ("_WIN32"); \
|
||||
builtin_define_std ("WIN32"); \
|
||||
builtin_define_std ("WINNT"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS /* From cygwin.h. */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_WIN32"); \
|
||||
builtin_define_std ("WIN32"); \
|
||||
builtin_define_std ("WINNT"); \
|
||||
builtin_define ("_X86_=1"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_define ("__declspec(x)=__attribute__((x))"); \
|
||||
if (!flag_iso) \
|
||||
{ \
|
||||
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
|
||||
builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
|
||||
} \
|
||||
EXTRA_OS_CPP_BUILTINS (); \
|
||||
builtin_assert ("system=winnt"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Specific a different directory for the standard include files. */
|
||||
#undef STANDARD_INCLUDE_DIR
|
||||
#define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
|
||||
@ -96,10 +68,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
|
||||
%{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
|
||||
|
||||
/* MS runtime does not need a separate math library. */
|
||||
#undef MATH_LIBRARY
|
||||
#define MATH_LIBRARY ""
|
||||
|
||||
/* Output STRING, a string representing a filename, to FILE.
|
||||
We canonicalize it to be in Unix format (backslashes are replaced
|
||||
forward slashes. */
|
||||
|
21
gcc/config/i386/t-cygming
Normal file
21
gcc/config/i386/t-cygming
Normal file
@ -0,0 +1,21 @@
|
||||
LIB1ASMSRC = i386/cygwin.asm
|
||||
LIB1ASMFUNCS = _chkstk
|
||||
|
||||
# cygwin and mingw always have a limits.h, but, depending upon how we are
|
||||
# doing the build, it may not be installed yet.
|
||||
LIMITS_H_TEST = true
|
||||
|
||||
# If we are building next to winsup, this will let us find the real
|
||||
# limits.h when building libgcc2. Otherwise, winsup must be installed
|
||||
# first.
|
||||
LIBGCC2_INCLUDES = -I$(srcdir)/../winsup/w32api/include
|
||||
|
||||
winnt.o: $(srcdir)/config/i386/winnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
|
||||
$(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
||||
$(srcdir)/config/i386/winnt.c
|
||||
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO=
|
||||
STMP_FIXINC=stmp-fixinc
|
@ -1,23 +1,18 @@
|
||||
LIB1ASMSRC = i386/cygwin.asm
|
||||
LIB1ASMFUNCS = _chkstk
|
||||
|
||||
# cygwin always has a limits.h, but, depending upon how we are doing
|
||||
# the build, it may not be installed yet.
|
||||
LIMITS_H_TEST = true
|
||||
|
||||
T_CPPFLAGS=-DCYGWIN_CROSS_DIR=\"$(build_tooldir)\"
|
||||
EXTRA_GCC_OBJS = cygwin1.o
|
||||
|
||||
# If we are building next to winsup, this will let us find the real
|
||||
# limits.h when building libgcc2. Otherwise, winsup must be installed
|
||||
# first.
|
||||
LIBGCC2_INCLUDES = -I$(srcdir)/../winsup/include \
|
||||
-I$(srcdir)/../winsup/cygwin/include \
|
||||
-I$(srcdir)/../winsup/w32api/include
|
||||
LIBGCC2_INCLUDES += -I$(srcdir)/../winsup/include \
|
||||
-I$(srcdir)/../winsup/cygwin/include
|
||||
|
||||
winnt.o: $(srcdir)/config/i386/winnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
|
||||
$(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c
|
||||
cygwin1.o: $(srcdir)/config/i386/cygwin1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||
$(TM_H) $(TM_P_H)
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
||||
$(srcdir)/config/i386/cygwin1.c
|
||||
|
||||
cygwin2.o: $(srcdir)/config/i386/cygwin2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||
$(TM_H) $(TM_P_H)
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
||||
$(srcdir)/config/i386/cygwin2.c
|
||||
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
||||
|
Loading…
Reference in New Issue
Block a user