1 /* Configuration for an i386 running MS-DOS with DJGPP.
2    Copyright (C) 1997-2016 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC 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 3, or (at your option)
9 any later version.
10 
11 GCC 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 GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 /* Support generation of DWARF2 debugging info.  */
21 #define DWARF2_DEBUGGING_INFO 1
22 
23 #undef PREFERRED_DEBUGGING_TYPE
24 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
25 
26 /* Don't assume anything about the header files.  */
27 #define NO_IMPLICIT_EXTERN_C
28 
29 #undef BSS_SECTION_ASM_OP
30 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
31 
32 /* Define the name of the .data section.  */
33 #undef DATA_SECTION_ASM_OP
34 #define DATA_SECTION_ASM_OP "\t.section .data"
35 
36 /* Define the name of the .ident op.  */
37 #undef TARGET_ASM_OUTPUT_IDENT
38 #define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
39 
40 /* Enable alias attribute support.  */
41 #ifndef SET_ASM_OP
42 #define SET_ASM_OP "\t.set\t"
43 #endif
44 
45 /* Define the name of the .text section.  */
46 #undef TEXT_SECTION_ASM_OP
47 #define TEXT_SECTION_ASM_OP "\t.section .text"
48 
49 #define TARGET_OS_CPP_BUILTINS()		\
50   do						\
51     {						\
52         if (!flag_iso)                          \
53 	   builtin_define_with_int_value ("DJGPP",2);  \
54 	builtin_define_with_int_value ("__DJGPP",2);   \
55 	builtin_define_with_int_value ("__DJGPP__",2); \
56 	builtin_define_std ("MSDOS");		\
57 	builtin_define_std ("GO32");		\
58 	builtin_define_std ("unix");		\
59 	builtin_assert ("system=msdos");	\
60     }						\
61   while (0)
62 
63 #undef CPP_SPEC
64 #define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE}"
65 
66 #undef POST_LINK_SPEC
67 #define POST_LINK_SPEC "stubify %{v} %{o*:%*} %{!o*:a.out}"
68 
69 /* Always just link in 'libc.a'.  */
70 #undef LIB_SPEC
71 #define LIB_SPEC "-lc"
72 
73 /* Pick the right startup code depending on the -pg flag.  */
74 #undef STARTFILE_SPEC
75 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
76 
77 /* Switch into a generic section.  */
78 #define TARGET_ASM_NAMED_SECTION  i386_djgpp_asm_named_section
79 
80 /* This is how to output an assembler line
81    that says to advance the location counter
82    to a multiple of 2**LOG bytes.  */
83 
84 #undef ASM_OUTPUT_ALIGN
85 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
86   if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
87 
88 /* This is how to output a global symbol in the BSS section.  */
89 #undef ASM_OUTPUT_ALIGNED_BSS
90 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
91   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
92 
93 /* Write the extra assembler code needed to declare a function properly.  */
94 
95 #ifndef ASM_DECLARE_FUNCTION_NAME
96 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
97   do								\
98     {								\
99       ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL);		\
100     }								\
101   while (0)
102 #endif
103 
104 /* This is how to tell assembler that a symbol is weak  */
105 #undef ASM_WEAKEN_LABEL
106 #define ASM_WEAKEN_LABEL(FILE,NAME) \
107   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
108        fputc ('\n', FILE); } while (0)
109 
110 /* djgpp automatically calls its own version of __main, so don't define one
111    in libgcc, nor call one in main().  */
112 #define HAS_INIT_SECTION
113 
114 #undef TARGET_LIBC_HAS_FUNCTION
115 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
116 
117 /* Definitions for types and sizes. Wide characters are 16-bits long so
118    Win32 compiler add-ons will be wide character compatible.  */
119 #undef WCHAR_TYPE_SIZE
120 #define WCHAR_TYPE_SIZE 16
121 
122 #undef WCHAR_TYPE
123 #define WCHAR_TYPE "short unsigned int"
124 
125 #undef WINT_TYPE
126 #define WINT_TYPE "int"
127 
128 #undef SIZE_TYPE
129 #define SIZE_TYPE "long unsigned int"
130 
131 #undef PTRDIFF_TYPE
132 #define PTRDIFF_TYPE "int"
133 
134 #undef DBX_REGISTER_NUMBER
135 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
136 
137 /* Default to pcc-struct-return.  */
138 #define DEFAULT_PCC_STRUCT_RETURN 1
139 
140 /* Ignore (with warning) -fPIC for DJGPP */
141 #undef SUBTARGET_OVERRIDE_OPTIONS
142 #define SUBTARGET_OVERRIDE_OPTIONS                                      \
143     do {                                                                \
144         if (flag_pic)                                                   \
145         {                                                               \
146             fnotice(stdout, "-f%s ignored (not supported for DJGPP)\n", \
147                 (flag_pic > 1) ? "PIC" : "pic");                        \
148             flag_pic = 0;                                               \
149         }                                                               \
150                                                                         \
151         /* Don't emit DWARF3/4 unless specifically selected. */         \
152         /* DWARF3/4 currently does not work for DJGPP.  */              \
153         if (!global_options_set.x_dwarf_version)                        \
154             dwarf_version = 2;                                          \
155                                                                         \
156         }                                                               \
157     while (0)
158 
159 /* Support for C++ templates.  */
160 #undef MAKE_DECL_ONE_ONLY
161 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
162 
163 /* Function protypes for gcc/i386/djgpp.c */
164 
165 void
166 i386_djgpp_asm_named_section(const char *name, unsigned int flags,
167 			     tree decl);
168