]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/mcore/mcore-pe.h
configure.in: Check whether assembler supports section merging.
[thirdparty/gcc.git] / gcc / config / mcore / mcore-pe.h
1 /* Definitions of target machine for GNU compiler, for MCore using COFF/PE.
2 Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com).
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Run-time Target Specification. */
23 #define TARGET_VERSION fputs (" (MCORE/pe)", stderr)
24
25 #define SUBTARGET_CPP_PREDEFINES " -D__pe__"
26
27 #include "svr3.h"
28 #include "mcore/mcore.h"
29 #include "dbxcoff.h"
30
31 #undef SDB_DEBUGGING_INFO
32 #undef DBX_DEBUGGING_INFO
33 #define DBX_DEBUGGING_INFO 1
34
35 /* Computed in toplev.c. */
36 #undef PREFERRED_DEBUGGING_TYPE
37
38 /* Lay out additional 'sections' where we place things like code
39 and readonly data. This gets them out of default places. */
40
41 #define SUBTARGET_SWITCH_SECTIONS \
42 case in_drectve: drectve_section (); break; \
43 case in_rdata: rdata_section (); break;
44
45 #define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
46 #define RDATA_SECTION_ASM_OP "\t.section .rdata"
47
48 #define SUBTARGET_EXTRA_SECTIONS in_drectve, in_rdata
49
50 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
51 DRECTVE_SECTION_FUNCTION \
52 RDATA_SECTION_FUNCTION
53
54 #define DRECTVE_SECTION_FUNCTION \
55 void \
56 drectve_section () \
57 { \
58 if (in_section != in_drectve) \
59 { \
60 fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \
61 in_section = in_drectve; \
62 } \
63 }
64
65 #define RDATA_SECTION_FUNCTION \
66 void \
67 rdata_section () \
68 { \
69 if (in_section != in_rdata) \
70 { \
71 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
72 in_section = in_rdata; \
73 } \
74 }
75
76 #undef READONLY_DATA_SECTION
77 #define READONLY_DATA_SECTION() rdata_section ()
78
79 /* A C statement or statements to switch to the appropriate
80 section for output of DECL. DECL is either a `VAR_DECL' node
81 or a constant of some sort. RELOC indicates whether forming
82 the initial value of DECL requires link-time relocations. */
83 #undef SELECT_SECTION
84 #define SELECT_SECTION(DECL, RELOC, ALIGN) \
85 { \
86 if (TREE_CODE (DECL) == STRING_CST) \
87 { \
88 if (! flag_writable_strings) \
89 rdata_section (); \
90 else \
91 data_section (); \
92 } \
93 else if (TREE_CODE (DECL) == VAR_DECL) \
94 { \
95 if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
96 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
97 || !DECL_INITIAL (DECL) \
98 || (DECL_INITIAL (DECL) != error_mark_node \
99 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
100 data_section (); \
101 else \
102 rdata_section (); \
103 } \
104 else \
105 rdata_section (); \
106 }
107
108 /* A C statement or statements to switch to the appropriate
109 section for output of RTX in mode MODE. RTX is some kind
110 of constant in RTL. The argument MODE is redundant except
111 in the case of a `const_int' rtx. Currently, these always
112 go into the const section. */
113 #undef SELECT_RTX_SECTION
114 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) rdata_section ()
115
116 #define MCORE_EXPORT_NAME(STREAM, NAME) \
117 do \
118 { \
119 drectve_section (); \
120 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
121 MCORE_STRIP_NAME_ENCODING (NAME)); \
122 } \
123 while (0);
124
125 /* Output the label for an initialized variable. */
126 #undef ASM_DECLARE_OBJECT_NAME
127 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
128 do \
129 { \
130 if (mcore_dllexport_name_p (NAME)) \
131 { \
132 enum in_section save_section = in_section; \
133 MCORE_EXPORT_NAME (STREAM, NAME); \
134 switch_to_section (save_section, (DECL)); \
135 } \
136 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
137 } \
138 while (0)
139
140 /* Output a function label definition. */
141 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
142 do \
143 { \
144 if (mcore_dllexport_name_p (NAME)) \
145 { \
146 MCORE_EXPORT_NAME (STREAM, NAME); \
147 function_section (DECL); \
148 } \
149 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
150 } \
151 while (0);
152
153 #undef ASM_FILE_START
154 #define ASM_FILE_START(STREAM) \
155 do \
156 { \
157 fprintf (STREAM, "%s Generated by gcc %s for MCore/pe\n", \
158 ASM_COMMENT_START, version_string); \
159 output_file_directive ((STREAM), main_input_filename); \
160 } \
161 while (0)
162
163 #undef ASM_OUTPUT_SOURCE_LINE
164 #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
165 { \
166 if (write_symbols == DBX_DEBUG) \
167 { \
168 static int sym_lineno = 1; \
169 char buffer[256]; \
170 \
171 ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \
172 fprintf (FILE, ".stabn 68,0,%d,", LINE); \
173 assemble_name (FILE, buffer); \
174 putc ('-', FILE); \
175 assemble_name (FILE, \
176 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
177 putc ('\n', FILE); \
178 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno); \
179 sym_lineno ++; \
180 } \
181 }
182
183 #define STARTFILE_SPEC "crt0.o%s"
184 #define ENDFILE_SPEC "%{!mno-lsim:-lsim}"
185
186 #define INT_ASM_OP "\t.long\t"
187
188 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */
189 #define CTOR_LISTS_DEFINED_EXTERNALLY
190
191 #undef DO_GLOBAL_CTORS_BODY
192 #undef DO_GLOBAL_DTORS_BODY
193 #undef INIT_SECTION_ASM_OP
194 #undef DTORS_SECTION_ASM_OP
195
196 #define SUPPORTS_ONE_ONLY 1
197
198 /* Switch into a generic section. */
199 #undef TARGET_ASM_NAMED_SECTION
200 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section