cygwin.h revision 90075
152284Sobrien/* Operating system specific defines to be used when targeting GCC for 290075Sobrien hosting on Windows32, using a Unix style C library and tools. 390075Sobrien Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 490075Sobrien Free Software Foundation, Inc. 552284Sobrien 652284SobrienThis file is part of GNU CC. 752284Sobrien 852284SobrienGNU CC is free software; you can redistribute it and/or modify 952284Sobrienit under the terms of the GNU General Public License as published by 1052284Sobrienthe Free Software Foundation; either version 2, or (at your option) 1152284Sobrienany later version. 1252284Sobrien 1352284SobrienGNU CC is distributed in the hope that it will be useful, 1452284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1552284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1652284SobrienGNU General Public License for more details. 1752284Sobrien 1852284SobrienYou should have received a copy of the GNU General Public License 1952284Sobrienalong with GNU CC; see the file COPYING. If not, write to 2052284Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 2190075SobrienBoston, MA 02111-1307, USA. */ 2252284Sobrien 2352284Sobrien#define YES_UNDERSCORES 2452284Sobrien 2552284Sobrien#define DBX_DEBUGGING_INFO 2652284Sobrien#define SDB_DEBUGGING_INFO 2752284Sobrien#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 2852284Sobrien 2990075Sobrien#define TARGET_EXECUTABLE_SUFFIX ".exe" 3090075Sobrien 3190075Sobrien#include <stdio.h> 3252284Sobrien#include "i386/gas.h" 3352284Sobrien#include "dbxcoff.h" 3452284Sobrien 3590075Sobrien/* Augment TARGET_SWITCHES with the cygwin/no-cygwin options. */ 3652284Sobrien#define MASK_WIN32 0x40000000 /* Use -lming32 interface */ 3752284Sobrien#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */ 3852284Sobrien#define MASK_WINDOWS 0x10000000 /* Use windows interface */ 3952284Sobrien#define MASK_DLL 0x08000000 /* Use dll interface */ 4052284Sobrien#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */ 4152284Sobrien 4252284Sobrien#define TARGET_WIN32 (target_flags & MASK_WIN32) 4352284Sobrien#define TARGET_CYGWIN (target_flags & MASK_CYGWIN) 4452284Sobrien#define TARGET_WINDOWS (target_flags & MASK_WINDOWS) 4552284Sobrien#define TARGET_DLL (target_flags & MASK_DLL) 4652284Sobrien#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT) 4752284Sobrien 4852284Sobrien#undef SUBTARGET_SWITCHES 4952284Sobrien#define SUBTARGET_SWITCHES \ 5090075Sobrien{ "cygwin", MASK_CYGWIN, \ 5190075Sobrien N_("Use the Cygwin interface") }, \ 5290075Sobrien{ "no-cygwin", MASK_WIN32, \ 5390075Sobrien N_("Use the Mingw32 interface") }, \ 5490075Sobrien{ "windows", MASK_WINDOWS, N_("Create GUI application") }, \ 5590075Sobrien{ "no-win32", -MASK_WIN32, N_("Don't set Windows defines") },\ 5690075Sobrien{ "win32", 0, N_("Set Windows defines") }, \ 5790075Sobrien{ "console", -MASK_WINDOWS, \ 5890075Sobrien N_("Create console application") }, \ 5990075Sobrien{ "dll", MASK_DLL, N_("Generate code for a DLL") }, \ 6090075Sobrien{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \ 6190075Sobrien N_("Ignore dllimport for functions") }, \ 6290075Sobrien{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \ 6390075Sobrien{ "threads", 0, N_("Use Mingw-specific thread support") }, 6452284Sobrien 6590075Sobrien#undef CPP_PREDEFINES 6690075Sobrien#define CPP_PREDEFINES "-D_X86_=1 -Asystem=winnt" 6752284Sobrien 6890075Sobrien#ifdef CROSS_COMPILE 6990075Sobrien#define CYGWIN_INCLUDES "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include}" 7090075Sobrien#define W32API_INC "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include/w32api}" 7190075Sobrien#define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/" 7290075Sobrien#define CYGWIN_LIB CYGWIN_CROSS_DIR "/lib" 7390075Sobrien#define MINGW_LIBS "-L" CYGWIN_CROSS_DIR "/lib/mingw" 7490075Sobrien#define MINGW_INCLUDES "%{!nostdinc:-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++-3 "\ 7590075Sobrien "-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++ "\ 7690075Sobrien "-idirafter " CYGWIN_CROSS_DIR "/include/mingw}" 7790075Sobrien#else 7890075Sobrien#define CYGWIN_INCLUDES "%{!nostdinc:-isystem /usr/local/include "\ 7990075Sobrien "-idirafter " CYGWIN_CROSS_DIR "/include "\ 8090075Sobrien "-idirafter /usr/include}" 8190075Sobrien#define W32API_INC "%{!nostdinc:"\ 8290075Sobrien "-idirafter " CYGWIN_CROSS_DIR "/include/w32api "\ 8390075Sobrien "-idirafter /usr/include/w32api}" 8490075Sobrien#define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/ -L/usr/lib/w32api/" 8590075Sobrien#define CYGWIN_LIB "/usr/lib" 8690075Sobrien#define MINGW_LIBS "-L/usr/local/lib/mingw -L/usr/lib/mingw" 8790075Sobrien#define MINGW_INCLUDES "%{!nostdinc:-isystem /usr/include/mingw/g++-3 "\ 8890075Sobrien "-isystem /usr/include/mingw/g++ "\ 8990075Sobrien "-isystem /usr/local/include/mingw "\ 9090075Sobrien "-idirafter " CYGWIN_CROSS_DIR "/include/mingw "\ 9190075Sobrien "-idirafter /usr/include/mingw}" 9290075Sobrien#endif 9390075Sobrien 9490075Sobrien/* Get tree.c to declare a target-specific specialization of 9590075Sobrien merge_decl_attributes. */ 9690075Sobrien#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 9790075Sobrien 9852284Sobrien/* Support the __declspec keyword by turning them into attributes. 9952284Sobrien We currently only support: dllimport and dllexport. 10052284Sobrien Note that the current way we do this may result in a collision with 10152284Sobrien predefined attributes later on. This can be solved by using one attribute, 10252284Sobrien say __declspec__, and passing args to it. The problem with that approach 10352284Sobrien is that args are not accumulated: each new appearance would clobber any 10452284Sobrien existing args. */ 10552284Sobrien 10690075Sobrien#undef CPP_SPEC 10790075Sobrien#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ 10852284Sobrien -D__stdcall=__attribute__((__stdcall__)) \ 10952284Sobrien -D__cdecl=__attribute__((__cdecl__)) \ 11090075Sobrien %{!ansi:-D_stdcall=__attribute__((__stdcall__)) \ 11190075Sobrien -D_cdecl=__attribute__((__cdecl__))} \ 11252284Sobrien -D__declspec(x)=__attribute__((x)) \ 11390075Sobrien -D__i386__ -D__i386 \ 11490075Sobrien %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \ 11590075Sobrien %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\ 11690075Sobrien MINGW_INCLUDES "} \ 11790075Sobrien %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix "\ 11890075Sobrien CYGWIN_INCLUDES "}\ 11990075Sobrien %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\ 12090075Sobrien %{!mno-win32:" W32API_INC "}\ 12190075Sobrien" 12252284Sobrien 12390075Sobrien#undef STARTFILE_SPEC 12490075Sobrien#define STARTFILE_SPEC "\ 12590075Sobrien %{shared|mdll: %{mno-cygwin:" MINGW_LIBS " dllcrt2%O%s}}\ 12690075Sobrien %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " crt2%O%s}\ 12790075Sobrien %{pg:gcrt0%O%s}}}\ 12890075Sobrien" 12990075Sobrien 13052284Sobrien/* Normally, -lgcc is not needed since everything in it is in the DLL, but we 13152284Sobrien want to allow things to be added to it when installing new versions of 13252284Sobrien GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled 13390075Sobrien by calling the init function from the prologue. */ 13452284Sobrien 13590075Sobrien#undef LIBGCC_SPEC 13690075Sobrien#define LIBGCC_SPEC "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmsvcrt}" 13752284Sobrien 13852284Sobrien/* This macro defines names of additional specifications to put in the specs 13952284Sobrien that can be used in various specifications like CC1_SPEC. Its definition 14052284Sobrien is an initializer with a subgrouping for each command option. 14152284Sobrien 14252284Sobrien Each subgrouping contains a string constant, that defines the 14352284Sobrien specification name, and a string constant that used by the GNU CC driver 14452284Sobrien program. 14552284Sobrien 14652284Sobrien Do not define this macro if it does not need to do anything. */ 14752284Sobrien 14852284Sobrien#undef SUBTARGET_EXTRA_SPECS 14952284Sobrien#define SUBTARGET_EXTRA_SPECS \ 15052284Sobrien { "mingw_include_path", DEFAULT_TARGET_MACHINE } 15152284Sobrien 15252284Sobrien/* We have to dynamic link to get to the system DLLs. All of libc, libm and 15352284Sobrien the Unix stuff is in cygwin.dll. The import library is called 15452284Sobrien 'libcygwin.a'. For Windows applications, include more libraries, but 15552284Sobrien always include kernel32. We'd like to specific subsystem windows to 15652284Sobrien ld, but that doesn't work just yet. */ 15752284Sobrien 15852284Sobrien#undef LIB_SPEC 15990075Sobrien#define LIB_SPEC "\ 16090075Sobrien %{pg:-lgmon} \ 16190075Sobrien %{!mno-cygwin:-lcygwin} \ 16290075Sobrien %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \ 16390075Sobrien %{mwindows:-lgdi32 -lcomdlg32} \ 16490075Sobrien -luser32 -lkernel32 -ladvapi32 -lshell32" 16552284Sobrien 16690075Sobrien#define LINK_SPEC W32API_LIB "\ 16790075Sobrien %{mwindows:--subsystem windows} \ 16890075Sobrien %{mconsole:--subsystem console} \ 16990075Sobrien %{shared: %{mdll: %eshared and mdll are not compatible}} \ 17090075Sobrien %{shared: --shared} %{mdll:--dll} \ 17190075Sobrien %{static:-Bstatic} %{!static:-Bdynamic} \ 17290075Sobrien %{shared|mdll: -e \ 17390075Sobrien %{mno-cygwin:_DllMainCRTStartup@12} \ 17490075Sobrien %{!mno-cygwin:__cygwin_dll_entry@12}}\ 17590075Sobrien --dll-search-prefix=cyg" 17652284Sobrien 17790075Sobrien#undef MATH_LIBRARY 17890075Sobrien#define MATH_LIBRARY "" 17952284Sobrien 18052284Sobrien#define SIZE_TYPE "unsigned int" 18152284Sobrien#define PTRDIFF_TYPE "int" 18252284Sobrien#define WCHAR_UNSIGNED 1 18352284Sobrien#define WCHAR_TYPE_SIZE 16 18452284Sobrien#define WCHAR_TYPE "short unsigned int" 18552284Sobrien 18652284Sobrien 18752284Sobrien/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */ 18852284Sobrien#define HANDLE_PRAGMA_PACK_PUSH_POP 1 18952284Sobrien 19090075Sobrienunion tree_node; 19190075Sobrien#define TREE union tree_node * 19252284Sobrien 19352284Sobrien/* Used to implement dllexport overriding dllimport semantics. It's also used 19452284Sobrien to handle vtables - the first pass won't do anything because 19552284Sobrien DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0. 19652284Sobrien It's also used to handle dllimport override semantics. */ 19752284Sobrien#if 0 19852284Sobrien#define REDO_SECTION_INFO_P(DECL) \ 19990075Sobrien ((DECL_ATTRIBUTES (DECL) != NULL_TREE) \ 20052284Sobrien || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL))) 20152284Sobrien#else 20252284Sobrien#define REDO_SECTION_INFO_P(DECL) 1 20352284Sobrien#endif 20452284Sobrien 20552284Sobrien 20652284Sobrien#undef EXTRA_SECTIONS 20790075Sobrien#define EXTRA_SECTIONS in_drectve 20852284Sobrien 20952284Sobrien#undef EXTRA_SECTION_FUNCTIONS 21052284Sobrien#define EXTRA_SECTION_FUNCTIONS \ 21152284Sobrien DRECTVE_SECTION_FUNCTION \ 21252284Sobrien SWITCH_TO_SECTION_FUNCTION 21352284Sobrien 21452284Sobrien#define DRECTVE_SECTION_FUNCTION \ 21552284Sobrienvoid \ 21652284Sobriendrectve_section () \ 21752284Sobrien{ \ 21852284Sobrien if (in_section != in_drectve) \ 21952284Sobrien { \ 22052284Sobrien fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \ 22152284Sobrien in_section = in_drectve; \ 22252284Sobrien } \ 22352284Sobrien} 22490075Sobrienvoid drectve_section PARAMS ((void)); 22552284Sobrien 22652284Sobrien/* Switch to SECTION (an `enum in_section'). 22752284Sobrien 22852284Sobrien ??? This facility should be provided by GCC proper. 22952284Sobrien The problem is that we want to temporarily switch sections in 23052284Sobrien ASM_DECLARE_OBJECT_NAME and then switch back to the original section 23152284Sobrien afterwards. */ 23252284Sobrien#define SWITCH_TO_SECTION_FUNCTION \ 23390075Sobrienvoid switch_to_section PARAMS ((enum in_section, tree)); \ 23452284Sobrienvoid \ 23552284Sobrienswitch_to_section (section, decl) \ 23652284Sobrien enum in_section section; \ 23752284Sobrien tree decl; \ 23852284Sobrien{ \ 23952284Sobrien switch (section) \ 24052284Sobrien { \ 24152284Sobrien case in_text: text_section (); break; \ 24252284Sobrien case in_data: data_section (); break; \ 24352284Sobrien case in_named: named_section (decl, NULL, 0); break; \ 24452284Sobrien case in_drectve: drectve_section (); break; \ 24552284Sobrien default: abort (); break; \ 24652284Sobrien } \ 24752284Sobrien} 24852284Sobrien 24952284Sobrien/* Don't allow flag_pic to propagate since gas may produce invalid code 25090075Sobrien otherwise. */ 25152284Sobrien 25252284Sobrien#undef SUBTARGET_OVERRIDE_OPTIONS 25352284Sobrien#define SUBTARGET_OVERRIDE_OPTIONS \ 25452284Sobriendo { \ 25552284Sobrien if (flag_pic) \ 25652284Sobrien { \ 25752284Sobrien warning ("-f%s ignored for target (all code is position independent)",\ 25852284Sobrien (flag_pic > 1) ? "PIC" : "pic"); \ 25952284Sobrien flag_pic = 0; \ 26052284Sobrien } \ 26152284Sobrien} while (0) \ 26252284Sobrien 26352284Sobrien/* Define this macro if references to a symbol must be treated 26452284Sobrien differently depending on something about the variable or 26552284Sobrien function named by the symbol (such as what section it is in). 26652284Sobrien 26752284Sobrien On i386 running Windows NT, modify the assembler name with a suffix 26852284Sobrien consisting of an atsign (@) followed by string of digits that represents 26952284Sobrien the number of bytes of arguments passed to the function, if it has the 27052284Sobrien attribute STDCALL. 27152284Sobrien 27252284Sobrien In addition, we must mark dll symbols specially. Definitions of 27352284Sobrien dllexport'd objects install some info in the .drectve section. 27452284Sobrien References to dllimport'd objects are fetched indirectly via 27552284Sobrien _imp__. If both are declared, dllexport overrides. This is also 27652284Sobrien needed to implement one-only vtables: they go into their own 27752284Sobrien section and we need to set DECL_SECTION_NAME so we do that here. 27852284Sobrien Note that we can be called twice on the same decl. */ 27952284Sobrien 28090075Sobrienextern void i386_pe_encode_section_info PARAMS ((TREE)); 28152284Sobrien 28252284Sobrien#ifdef ENCODE_SECTION_INFO 28352284Sobrien#undef ENCODE_SECTION_INFO 28452284Sobrien#endif 28552284Sobrien#define ENCODE_SECTION_INFO(DECL) i386_pe_encode_section_info (DECL) 28652284Sobrien 28752284Sobrien/* Utility used only in this file. */ 28852284Sobrien#define I386_PE_STRIP_ENCODING(SYM_NAME) \ 28990075Sobrien ((SYM_NAME) + ((SYM_NAME)[0] == '@' \ 29090075Sobrien ? ((SYM_NAME)[3] == '*' ? 4 : 3) : 0) \ 29190075Sobrien + ((SYM_NAME)[0] == '*' ? 1 : 0)) 29252284Sobrien 29352284Sobrien/* This macro gets just the user-specified name 29452284Sobrien out of the string in a SYMBOL_REF. Discard 29552284Sobrien trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ 29652284Sobrien#undef STRIP_NAME_ENCODING 29752284Sobrien#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ 29852284Sobriendo { \ 29990075Sobrien const char *_p; \ 30090075Sobrien const char *_name = I386_PE_STRIP_ENCODING (SYMBOL_NAME); \ 30152284Sobrien for (_p = _name; *_p && *_p != '@'; ++_p) \ 30252284Sobrien ; \ 30352284Sobrien if (*_p == '@') \ 30452284Sobrien { \ 30552284Sobrien int _len = _p - _name; \ 30690075Sobrien char *_new_name = (char *) alloca (_len + 1); \ 30790075Sobrien strncpy (_new_name, _name, _len); \ 30890075Sobrien _new_name[_len] = '\0'; \ 30990075Sobrien (VAR) = _new_name; \ 31052284Sobrien } \ 31152284Sobrien else \ 31252284Sobrien (VAR) = _name; \ 31352284Sobrien} while (0) 31452284Sobrien 31552284Sobrien 31652284Sobrien/* Output a reference to a label. */ 31752284Sobrien#undef ASM_OUTPUT_LABELREF 31852284Sobrien#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ 31952284Sobrien fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \ 32090075Sobrien I386_PE_STRIP_ENCODING (NAME)) \ 32152284Sobrien 32252284Sobrien/* Output a common block. */ 32352284Sobrien#undef ASM_OUTPUT_COMMON 32452284Sobrien#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ 32552284Sobriendo { \ 32652284Sobrien if (i386_pe_dllexport_name_p (NAME)) \ 32790075Sobrien i386_pe_record_exported_symbol (NAME, 1); \ 32852284Sobrien if (! i386_pe_dllimport_name_p (NAME)) \ 32952284Sobrien { \ 33052284Sobrien fprintf ((STREAM), "\t.comm\t"); \ 33152284Sobrien assemble_name ((STREAM), (NAME)); \ 33252284Sobrien fprintf ((STREAM), ", %d\t%s %d\n", \ 33352284Sobrien (ROUNDED), ASM_COMMENT_START, (SIZE)); \ 33452284Sobrien } \ 33552284Sobrien} while (0) 33652284Sobrien 33752284Sobrien/* Output the label for an initialized variable. */ 33852284Sobrien#undef ASM_DECLARE_OBJECT_NAME 33952284Sobrien#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ 34052284Sobriendo { \ 34152284Sobrien if (i386_pe_dllexport_name_p (NAME)) \ 34290075Sobrien i386_pe_record_exported_symbol (NAME, 1); \ 34352284Sobrien ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ 34452284Sobrien} while (0) 34552284Sobrien 34652284Sobrien 34752284Sobrien/* Emit code to check the stack when allocating more that 4000 34890075Sobrien bytes in one go. */ 34952284Sobrien 35052284Sobrien#define CHECK_STACK_LIMIT 4000 35152284Sobrien 35252284Sobrien/* By default, target has a 80387, uses IEEE compatible arithmetic, 35352284Sobrien and returns float values in the 387 and needs stack probes */ 35490075Sobrien#undef TARGET_SUBTARGET_DEFAULT 35552284Sobrien 35690075Sobrien#define TARGET_SUBTARGET_DEFAULT \ 35752284Sobrien (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE) 35852284Sobrien 35952284Sobrien/* This is how to output an assembler line 36052284Sobrien that says to advance the location counter 36152284Sobrien to a multiple of 2**LOG bytes. */ 36252284Sobrien 36352284Sobrien#undef ASM_OUTPUT_ALIGN 36452284Sobrien#define ASM_OUTPUT_ALIGN(FILE,LOG) \ 36552284Sobrien if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) 36652284Sobrien 36752284Sobrien/* Define this macro if in some cases global symbols from one translation 36852284Sobrien unit may not be bound to undefined symbols in another translation unit 36952284Sobrien without user intervention. For instance, under Microsoft Windows 37052284Sobrien symbols must be explicitly imported from shared libraries (DLLs). */ 37152284Sobrien#define MULTIPLE_SYMBOL_SPACES 37252284Sobrien 37390075Sobrienextern void i386_pe_unique_section PARAMS ((TREE, int)); 37452284Sobrien#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) 37552284Sobrien 37652284Sobrien#define SUPPORTS_ONE_ONLY 1 37752284Sobrien 37890075Sobrien/* Switch into a generic section. */ 37990075Sobrien#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section 38052284Sobrien 38190075Sobrien/* Select attributes for named sections. */ 38290075Sobrien#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags 38390075Sobrien 38452284Sobrien/* Write the extra assembler code needed to declare a function 38552284Sobrien properly. If we are generating SDB debugging information, this 38652284Sobrien will happen automatically, so we only need to handle other cases. */ 38752284Sobrien#undef ASM_DECLARE_FUNCTION_NAME 38852284Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 38952284Sobrien do \ 39052284Sobrien { \ 39152284Sobrien if (i386_pe_dllexport_name_p (NAME)) \ 39290075Sobrien i386_pe_record_exported_symbol (NAME, 0); \ 39352284Sobrien if (write_symbols != SDB_DEBUG) \ 39452284Sobrien i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ 39552284Sobrien ASM_OUTPUT_LABEL (FILE, NAME); \ 39652284Sobrien } \ 39752284Sobrien while (0) 39852284Sobrien 39952284Sobrien/* Add an external function to the list of functions to be declared at 40052284Sobrien the end of the file. */ 40152284Sobrien#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ 40252284Sobrien do \ 40352284Sobrien { \ 40452284Sobrien if (TREE_CODE (DECL) == FUNCTION_DECL) \ 40552284Sobrien i386_pe_record_external_function (NAME); \ 40652284Sobrien } \ 40752284Sobrien while (0) 40852284Sobrien 40952284Sobrien/* Declare the type properly for any external libcall. */ 41052284Sobrien#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 41152284Sobrien i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) 41252284Sobrien 41390075Sobrien/* This says out to put a global symbol in the BSS section. */ 41490075Sobrien#undef ASM_OUTPUT_ALIGNED_BSS 41590075Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 41690075Sobrien asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) 41790075Sobrien 41852284Sobrien/* Output function declarations at the end of the file. */ 41990075Sobrien#undef ASM_FILE_END 42052284Sobrien#define ASM_FILE_END(FILE) \ 42152284Sobrien i386_pe_asm_file_end (FILE) 42252284Sobrien 42352284Sobrien#undef ASM_COMMENT_START 42452284Sobrien#define ASM_COMMENT_START " #" 42552284Sobrien 42690075Sobrien/* Don't assume anything about the header files. */ 42752284Sobrien#define NO_IMPLICIT_EXTERN_C 42852284Sobrien 42952284Sobrien#define SUBTARGET_PROLOGUE \ 43090075Sobrien if (current_function_profile \ 43190075Sobrien && MAIN_NAME_P (DECL_NAME (current_function_decl))) \ 43252284Sobrien { \ 43390075Sobrien emit_call_insn (gen_rtx (CALL, VOIDmode, \ 43490075Sobrien gen_rtx_MEM (FUNCTION_MODE, \ 43590075Sobrien gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \ 43690075Sobrien const0_rtx)); \ 43752284Sobrien } 43852284Sobrien 43952284Sobrien/* External function declarations. */ 44052284Sobrien 44190075Sobrienextern void i386_pe_record_external_function PARAMS ((const char *)); 44290075Sobrienextern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int)); 44390075Sobrienextern void i386_pe_record_exported_symbol PARAMS ((const char *, int)); 44490075Sobrienextern void i386_pe_asm_file_end PARAMS ((FILE *)); 44590075Sobrienextern int i386_pe_dllexport_name_p PARAMS ((const char *)); 44690075Sobrienextern int i386_pe_dllimport_name_p PARAMS ((const char *)); 44752284Sobrien 44852284Sobrien/* For Win32 ABI compatibility */ 44952284Sobrien#undef DEFAULT_PCC_STRUCT_RETURN 45052284Sobrien#define DEFAULT_PCC_STRUCT_RETURN 0 45152284Sobrien 45252284Sobrien/* No data type wants to be aligned rounder than this. */ 45352284Sobrien#undef BIGGEST_ALIGNMENT 45452284Sobrien#define BIGGEST_ALIGNMENT 128 45552284Sobrien 45690075Sobrien/* Native complier aligns internal doubles in structures on dword boundaries. */ 45790075Sobrien#undef BIGGEST_FIELD_ALIGNMENT 45890075Sobrien#define BIGGEST_FIELD_ALIGNMENT 64 45990075Sobrien 46052284Sobrien/* A bitfield declared as `int' forces `int' alignment for the struct. */ 46190075Sobrien#undef PCC_BITFIELD_TYPE_MATTERS 46290075Sobrien#define PCC_BITFIELD_TYPE_MATTERS 1 46390075Sobrien#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) 46452284Sobrien 46590075Sobrien 46652284Sobrien/* Enable alias attribute support. */ 46752284Sobrien#ifndef SET_ASM_OP 46890075Sobrien#define SET_ASM_OP "\t.set\t" 46952284Sobrien#endif 47052284Sobrien 47190075Sobrien/* Override GCC's relative pathname lookup (ie., relocatability) unless 47290075Sobrien otherwise told by other subtargets. */ 47390075Sobrien#ifndef WIN32_NO_ABSOLUTE_INST_DIRS 47490075Sobrien#undef MD_STARTFILE_PREFIX 47590075Sobrien#define MD_STARTFILE_PREFIX "/usr/lib/" 47690075Sobrien 47790075Sobrien#undef STANDARD_STARTFILE_PREFIX 47890075Sobrien#define STANDARD_STARTFILE_PREFIX "/usr/lib/mingw/" 47990075Sobrien 48090075Sobrien#ifndef CROSS_COMPILE 48190075Sobrien#undef LOCAL_INCLUDE_DIR 48290075Sobrien#undef TOOL_INCLUDE_DIR 48390075Sobrien#undef SYSTEM_INCLUDE_DIR 48490075Sobrien#undef STANDARD_INCLUDE_DIR 48590075Sobrien#define STANDARD_INCLUDE_DIR 0 48690075Sobrien#endif /* not CROSS_COMPILE */ 48790075Sobrien#endif /* not WIN32_NO_ABSOLUTE_INST_DIRS */ 48890075Sobrien 48990075Sobrien#undef TREE 49090075Sobrien 49190075Sobrien#ifndef BUFSIZ 49290075Sobrien# undef FILE 49390075Sobrien#endif 494