#define DBX_DEBUGGING_INFO 1
#define SDB_DEBUGGING_INFO 1
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
#define TARGET_EXECUTABLE_SUFFIX ".exe"
#include <stdio.h>
#include "i386/i386.h"
#include "i386/unix.h"
#include "i386/bsd.h"
#include "i386/gas.h"
#include "dbxcoff.h"
#define MASK_NOP_FUN_DLLIMPORT 0x08000000
#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()
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("_X86_=1"); \
builtin_assert ("system=winnt"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
if (!flag_iso) \
{ \
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
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
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
#undef CPP_SPEC
#define CPP_SPEC "%{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 "}\
%{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
%{!mno-win32:" W32API_INC "}\
"
#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}\
%{pg:gcrt0%O%s}}}\
"
#undef LIBGCC_SPEC
#define LIBGCC_SPEC "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmsvcrt}"
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "mingw_include_path", DEFAULT_TARGET_MACHINE }
#undef LIB_SPEC
#define LIB_SPEC "\
%{pg:-lgmon} \
%{!mno-cygwin:-lcygwin} \
%{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
%{mwindows:-lgdi32 -lcomdlg32} \
-luser32 -lkernel32 -ladvapi32 -lshell32"
#define LINK_SPEC W32API_LIB "\
%{mwindows:--subsystem windows} \
%{mconsole:--subsystem console} \
%{shared: %{mdll: %eshared and mdll are not compatible}} \
%{shared: --shared} %{mdll:--dll} \
%{static:-Bstatic} %{!static:-Bdynamic} \
%{shared|mdll: -e \
%{mno-cygwin:_DllMainCRTStartup@12} \
%{!mno-cygwin:__cygwin_dll_entry@12}}\
--dll-search-prefix=cyg"
#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"
#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));
#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; \
} \
}
#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) \
#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
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \
i386_pe_strip_name_encoding (NAME)) \
#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)
#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)
#define CHECK_STACK_LIMIT 4000
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
| MASK_ALIGN_DOUBLE)
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
#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
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
#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)
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
do \
{ \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
i386_pe_record_external_function (NAME); \
} \
while (0)
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
#undef ASM_FILE_END
#define ASM_FILE_END(FILE) \
i386_pe_asm_file_end (FILE)
#undef ASM_COMMENT_START
#define ASM_COMMENT_START " #"
#define DWARF2_UNWIND_INFO 0
#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)); \
}
#undef MODIFY_JNI_METHOD_CALL
#define MODIFY_JNI_METHOD_CALL(MDECL) \
build_type_attribute_variant ((MDECL), \
build_tree_list (get_identifier ("stdcall"), \
NULL))
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 *));
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
#undef BIGGEST_ALIGNMENT
#define BIGGEST_ALIGNMENT 128
#undef BIGGEST_FIELD_ALIGNMENT
#define BIGGEST_FIELD_ALIGNMENT 64
#undef PCC_BITFIELD_TYPE_MATTERS
#define PCC_BITFIELD_TYPE_MATTERS 1
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
#ifndef SET_ASM_OP
#define SET_ASM_OP "\t.set\t"
#endif
#ifndef WIN32_NO_ABSOLUTE_INST_DIRS
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/usr/lib/"
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/usr/lib/mingw/"
#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
#endif
#undef TREE
#ifndef BUFSIZ
# undef FILE
#endif