Initial import from FreeBSD RELENG_4:
[games.git] / contrib / gcc / config / i386 / djgpp.h
1 /* Configuration for an i386 running MS-DOS with DJGPP.
2    Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21
22 #include "dbxcoff.h"
23
24 /* Don't assume anything about the header files. */
25 #define NO_IMPLICIT_EXTERN_C
26
27 #define HANDLE_SYSV_PRAGMA
28
29 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
30 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
31
32 #define YES_UNDERSCORES
33
34 #include "i386/gas.h"
35
36 /* Enable alias attribute support.  */
37 #ifndef SET_ASM_OP
38 #define SET_ASM_OP "\t.set"
39 #endif
40
41 /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
42 #define MD_EXEC_PREFIX "$DJDIR/bin/"
43
44 /* Correctly handle absolute filename detection in cp/xref.c */
45 #define FILE_NAME_ABSOLUTE_P(NAME) \
46         (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
47         (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
48
49 #ifdef CPP_PREDEFINES
50 #undef CPP_PREDEFINES
51 #endif
52 #define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS \
53   -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)"
54
55 /* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
56    This cannot be done in LINK_SPECS as that LINK_SPECS is processed
57    before library search directories are known by the linker.
58    This avoids problems when specs file is not available. An alternate way,
59    suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
60 */ 
61
62 #undef LINK_COMMAND_SPEC
63 #define LINK_COMMAND_SPEC \
64 "%{!fsyntax-only: \
65 %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
66 \t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
67 \t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
68 \t%{static:} %{L*} %D %o\
69 \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
70 \t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
71 \t-Tdjgpp.djl %{T*}}}}}}}\n\
72 %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
73
74 /* Always just link in 'libc.a'.  */
75 #undef LIB_SPEC
76 #define LIB_SPEC "-lc"
77
78 /* Pick the right startup code depending on the -pg flag.  */
79 #undef STARTFILE_SPEC
80 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
81
82 /* Make sure that gcc will not look for .h files in /usr/local/include 
83    unless user explicitly requests it.  */
84 #undef LOCAL_INCLUDE_DIR
85
86 #undef EXTRA_SECTIONS
87 #define EXTRA_SECTIONS in_ctor, in_dtor
88
89 #undef EXTRA_SECTION_FUNCTIONS
90 #define EXTRA_SECTION_FUNCTIONS                                 \
91   CTOR_SECTION_FUNCTION                                         \
92   DTOR_SECTION_FUNCTION
93
94 #define CTOR_SECTION_FUNCTION                                   \
95 void                                                            \
96 ctor_section ()                                                 \
97 {                                                               \
98   if (in_section != in_ctor)                                    \
99     {                                                           \
100       fprintf (asm_out_file, "\t.section .ctor\n");             \
101       in_section = in_ctor;                                     \
102     }                                                           \
103 }
104
105 #define DTOR_SECTION_FUNCTION                                   \
106 void                                                            \
107 dtor_section ()                                                 \
108 {                                                               \
109   if (in_section != in_dtor)                                    \
110     {                                                           \
111       fprintf (asm_out_file, "\t.section .dtor\n");             \
112       in_section = in_dtor;                                     \
113     }                                                           \
114 }
115
116 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)       \
117   do {                                          \
118     ctor_section ();                            \
119     fprintf (FILE, "%s\t", ASM_LONG);           \
120     assemble_name (FILE, NAME);                 \
121     fprintf (FILE, "\n");                       \
122   } while (0)
123
124 /* Allow (eg) __attribute__((section "locked")) to work */
125 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
126   do {                                          \
127     fprintf (FILE, "\t.section %s\n", NAME);    \
128   } while (0)
129
130 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)        \
131   do {                                          \
132     dtor_section ();                            \
133     fprintf (FILE, "%s\t", ASM_LONG);           \
134     assemble_name (FILE, NAME);                 \
135     fprintf (FILE, "\n");                       \
136   } while (0)
137
138 /* Output at beginning of assembler file.  */
139 /* The .file command should always begin the output.  */
140
141 #undef ASM_FILE_START
142 #define ASM_FILE_START(FILE)                                            \
143   do {                                                                  \
144         output_file_directive (FILE, main_input_filename);              \
145   } while (0)
146
147 /* This is how to output an assembler line
148    that says to advance the location counter
149    to a multiple of 2**LOG bytes.  */
150
151 #undef ASM_OUTPUT_ALIGN
152 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
153   if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
154
155 /* djgpp has atexit ().  */
156 #undef HAVE_ATEXIT
157 #define HAVE_ATEXIT
158
159 /* djgpp automatically calls its own version of __main, so don't define one
160    in libgcc, nor call one in main().  */
161 #define HAS_INIT_SECTION