152284Sobrien/* Configuration for an i386 running MS-DOS with DJGPP.
2169689Skan   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
3117395Skan   Free Software Foundation, Inc.
452284Sobrien
5132718SkanThis file is part of GCC.
652284Sobrien
7132718SkanGCC is free software; you can redistribute it and/or modify
852284Sobrienit under the terms of the GNU General Public License as published by
952284Sobrienthe Free Software Foundation; either version 2, or (at your option)
1052284Sobrienany later version.
1152284Sobrien
12132718SkanGCC is distributed in the hope that it will be useful,
1352284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1452284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1552284SobrienGNU General Public License for more details.
1652284Sobrien
1752284SobrienYou should have received a copy of the GNU General Public License
18132718Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
2152284Sobrien
2290075Sobrien/* Support generation of DWARF2 debugging info.  */
23117395Skan#define DWARF2_DEBUGGING_INFO 1
2490075Sobrien
2590075Sobrien/* Don't assume anything about the header files.  */
2652284Sobrien#define NO_IMPLICIT_EXTERN_C
2752284Sobrien
28117395Skan#define HANDLE_SYSV_PRAGMA 1
2952284Sobrien
3052284Sobrien/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
3152284Sobrien#define HANDLE_PRAGMA_PACK_PUSH_POP 1
3252284Sobrien
3390075Sobrien/* If defined, a C expression whose value is a string containing the
3490075Sobrien   assembler operation to identify the following data as
3590075Sobrien   uninitialized global data.  If not defined, and neither
3690075Sobrien   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
3790075Sobrien   uninitialized global data will be output in the data section if
3890075Sobrien   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
3990075Sobrien   used.  */
4090075Sobrien#undef BSS_SECTION_ASM_OP
4190075Sobrien#define BSS_SECTION_ASM_OP "\t.section\t.bss"
4290075Sobrien
4390075Sobrien/* Define the name of the .data section.  */
4490075Sobrien#undef DATA_SECTION_ASM_OP
4590075Sobrien#define DATA_SECTION_ASM_OP "\t.section .data"
4690075Sobrien
4790075Sobrien/* Define the name of the .ident op.  */
4890075Sobrien#undef IDENT_ASM_OP
4990075Sobrien#define IDENT_ASM_OP "\t.ident\t"
5090075Sobrien
5152284Sobrien/* Enable alias attribute support.  */
5252284Sobrien#ifndef SET_ASM_OP
5390075Sobrien#define SET_ASM_OP "\t.set\t"
5452284Sobrien#endif
5552284Sobrien
5690075Sobrien/* Define the name of the .text section.  */
5790075Sobrien#undef TEXT_SECTION_ASM_OP
5890075Sobrien#define TEXT_SECTION_ASM_OP "\t.section .text"
5952284Sobrien
60132718Skan/* Define standard DJGPP installation paths.  */
6190075Sobrien/* We override default /usr or /usr/local part with /dev/env/DJDIR which */
62132718Skan/* points to actual DJGPP installation directory.  */
6390075Sobrien
6490075Sobrien/* Standard include directory */
6590075Sobrien#undef STANDARD_INCLUDE_DIR
6690075Sobrien#define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/"
6790075Sobrien
6890075Sobrien/* Search for as.exe and ld.exe in DJGPP's binary directory.  */
6990075Sobrien#undef MD_EXEC_PREFIX
7090075Sobrien#define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
7190075Sobrien
7290075Sobrien/* Standard DJGPP library and startup files */
7390075Sobrien#undef MD_STARTFILE_PREFIX
7490075Sobrien#define MD_STARTFILE_PREFIX "/dev/env/DJDIR/lib/"
7590075Sobrien
7652284Sobrien/* Correctly handle absolute filename detection in cp/xref.c */
7752284Sobrien#define FILE_NAME_ABSOLUTE_P(NAME) \
7852284Sobrien        (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
7952284Sobrien        (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
8052284Sobrien
81117395Skan#define TARGET_OS_CPP_BUILTINS()		\
82117395Skan  do						\
83117395Skan    {						\
84117395Skan	builtin_define_std ("MSDOS");		\
85117395Skan	builtin_define_std ("GO32");		\
86117395Skan	builtin_assert ("system=msdos");	\
87117395Skan    }						\
88117395Skan  while (0)
8952284Sobrien
9090075Sobrien/* Include <sys/version.h> so __DJGPP__ and __DJGPP_MINOR__ are defined.  */
9190075Sobrien#undef CPP_SPEC
92117395Skan#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
9390075Sobrien  -imacros %s../include/sys/version.h"
9490075Sobrien
9552284Sobrien/* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
9652284Sobrien   This cannot be done in LINK_SPECS as that LINK_SPECS is processed
9752284Sobrien   before library search directories are known by the linker.
9852284Sobrien   This avoids problems when specs file is not available. An alternate way,
9952284Sobrien   suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
10052284Sobrien*/
10152284Sobrien
10252284Sobrien#undef LINK_COMMAND_SPEC
10352284Sobrien#define LINK_COMMAND_SPEC \
10452284Sobrien"%{!fsyntax-only: \
10552284Sobrien%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
10652284Sobrien\t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
10752284Sobrien\t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
10852284Sobrien\t%{static:} %{L*} %D %o\
10952284Sobrien\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
11052284Sobrien\t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
11152284Sobrien\t-Tdjgpp.djl %{T*}}}}}}}\n\
11252284Sobrien%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
11352284Sobrien
11452284Sobrien/* Always just link in 'libc.a'.  */
11552284Sobrien#undef LIB_SPEC
11652284Sobrien#define LIB_SPEC "-lc"
11752284Sobrien
11852284Sobrien/* Pick the right startup code depending on the -pg flag.  */
11952284Sobrien#undef STARTFILE_SPEC
12052284Sobrien#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
12152284Sobrien
12252284Sobrien/* Make sure that gcc will not look for .h files in /usr/local/include
12352284Sobrien   unless user explicitly requests it.  */
12452284Sobrien#undef LOCAL_INCLUDE_DIR
12552284Sobrien
12690075Sobrien/* Switch into a generic section.  */
12790075Sobrien#define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_section
12852284Sobrien
12952284Sobrien/* This is how to output an assembler line
13052284Sobrien   that says to advance the location counter
13152284Sobrien   to a multiple of 2**LOG bytes.  */
13252284Sobrien
13352284Sobrien#undef ASM_OUTPUT_ALIGN
13452284Sobrien#define ASM_OUTPUT_ALIGN(FILE,LOG) \
13552284Sobrien  if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
13652284Sobrien
13790075Sobrien/* This is how to output a global symbol in the BSS section.  */
13890075Sobrien#undef ASM_OUTPUT_ALIGNED_BSS
13990075Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
14090075Sobrien  asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
14152284Sobrien
14290075Sobrien/* This is how to tell assembler that a symbol is weak  */
14390075Sobrien#undef ASM_WEAKEN_LABEL
14490075Sobrien#define ASM_WEAKEN_LABEL(FILE,NAME) \
14590075Sobrien  do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
14690075Sobrien       fputc ('\n', FILE); } while (0)
14790075Sobrien
14852284Sobrien/* djgpp automatically calls its own version of __main, so don't define one
14952284Sobrien   in libgcc, nor call one in main().  */
15052284Sobrien#define HAS_INIT_SECTION
15190075Sobrien
15290075Sobrien/* Definitions for types and sizes. Wide characters are 16-bits long so
15390075Sobrien   Win32 compiler add-ons will be wide character compatible.  */
15490075Sobrien#undef WCHAR_TYPE_SIZE
15590075Sobrien#define WCHAR_TYPE_SIZE 16
15690075Sobrien
15790075Sobrien#undef WCHAR_TYPE
15890075Sobrien#define WCHAR_TYPE "short unsigned int"
15990075Sobrien
16090075Sobrien#undef WINT_TYPE
16190075Sobrien#define WINT_TYPE "int"
16290075Sobrien
16390075Sobrien#undef SIZE_TYPE
16490075Sobrien#define SIZE_TYPE "long unsigned int"
16590075Sobrien
16690075Sobrien#undef PTRDIFF_TYPE
16790075Sobrien#define PTRDIFF_TYPE "int"
16890075Sobrien
16990075Sobrien/* Used to be defined in xm-djgpp.h, but moved here for cross-compilers.  */
17090075Sobrien#define LIBSTDCXX "-lstdcxx"
17190075Sobrien
172117395Skan#define TARGET_VERSION fprintf (stderr, " (80386, MS-DOS DJGPP)");
173117395Skan
17490075Sobrien/* Warn that -mbnu210 is now obsolete.  */
17590075Sobrien#undef  SUBTARGET_OVERRIDE_OPTIONS
17690075Sobrien#define SUBTARGET_OVERRIDE_OPTIONS \
17790075Sobriendo \
17890075Sobrien  { \
179169689Skan    if (TARGET_BNU210) \
18090075Sobrien      {	\
181169689Skan        warning (0, "-mbnu210 is ignored (option is obsolete)"); \
18290075Sobrien      }	\
18390075Sobrien  } \
18490075Sobrienwhile (0)
18590075Sobrien
18690075Sobrien/* Support for C++ templates.  */
18790075Sobrien#undef MAKE_DECL_ONE_ONLY
18890075Sobrien#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
189