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).
5 This file is part of GNU CC.
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)
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.
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. */
22 /* Run-time Target Specification. */
23 #define TARGET_VERSION fputs (" (MCORE/pe)", stderr)
25 #define SUBTARGET_CPP_PREDEFINES " -D__pe__"
27 /* The MCore ABI says that bitfields are unsigned by default. */
28 /* The EPOC C++ environment does not support exceptions. */
29 #define CC1_SPEC "-funsigned-bitfields %{!DIN_GCC:-fno-rtti} %{!DIN_GCC:-fno-exceptions}"
32 #include "mcore/mcore.h"
35 #undef SDB_DEBUGGING_INFO
36 #undef DBX_DEBUGGING_INFO
37 #define DBX_DEBUGGING_INFO 1
39 /* Computed in toplev.c. */
40 #undef PREFERRED_DEBUGGING_TYPE
42 /* Lay out additional 'sections' where we place things like code
43 and readonly data. This gets them out of default places. */
45 #define SUBTARGET_SWITCH_SECTIONS \
46 case in_drectve: drectve_section (); break; \
47 case in_rdata: rdata_section (); break;
49 #define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
50 #define RDATA_SECTION_ASM_OP "\t.section .rdata"
52 #define SUBTARGET_EXTRA_SECTIONS in_drectve, in_rdata
54 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
55 DRECTVE_SECTION_FUNCTION \
56 RDATA_SECTION_FUNCTION
58 #define DRECTVE_SECTION_FUNCTION \
62 if (in_section != in_drectve) \
64 fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \
65 in_section = in_drectve; \
69 #define RDATA_SECTION_FUNCTION \
73 if (in_section != in_rdata) \
75 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
76 in_section = in_rdata; \
80 #undef READONLY_DATA_SECTION
81 #define READONLY_DATA_SECTION() rdata_section ()
83 /* A C statement or statements to switch to the appropriate
84 section for output of DECL. DECL is either a `VAR_DECL' node
85 or a constant of some sort. RELOC indicates whether forming
86 the initial value of DECL requires link-time relocations. */
88 #define SELECT_SECTION(DECL, RELOC, ALIGN) \
90 if (TREE_CODE (DECL) == STRING_CST) \
92 if (! flag_writable_strings) \
97 else if (TREE_CODE (DECL) == VAR_DECL) \
99 if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
100 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
101 || !DECL_INITIAL (DECL) \
102 || (DECL_INITIAL (DECL) != error_mark_node \
103 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
112 /* A C statement or statements to switch to the appropriate
113 section for output of RTX in mode MODE. RTX is some kind
114 of constant in RTL. The argument MODE is redundant except
115 in the case of a `const_int' rtx. Currently, these always
116 go into the const section. */
117 #undef SELECT_RTX_SECTION
118 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) rdata_section ()
120 #define MCORE_EXPORT_NAME(STREAM, NAME) \
123 drectve_section (); \
124 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
125 MCORE_STRIP_NAME_ENCODING (NAME)); \
129 /* Output the label for an initialized variable. */
130 #undef ASM_DECLARE_OBJECT_NAME
131 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
134 if (mcore_dllexport_name_p (NAME)) \
136 enum in_section save_section = in_section; \
137 MCORE_EXPORT_NAME (STREAM, NAME); \
138 switch_to_section (save_section, (DECL)); \
140 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
144 /* Output a function label definition. */
145 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
148 if (mcore_dllexport_name_p (NAME)) \
150 MCORE_EXPORT_NAME (STREAM, NAME); \
151 function_section (DECL); \
153 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
157 #undef ASM_FILE_START
158 #define ASM_FILE_START(STREAM) \
161 fprintf (STREAM, "%s Generated by gcc %s for MCore/pe\n", \
162 ASM_COMMENT_START, version_string); \
163 output_file_directive ((STREAM), main_input_filename); \
167 #undef ASM_OUTPUT_SOURCE_LINE
168 #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
170 if (write_symbols == DBX_DEBUG) \
172 static int sym_lineno = 1; \
175 ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \
176 fprintf (FILE, ".stabn 68,0,%d,", LINE); \
177 assemble_name (FILE, buffer); \
179 assemble_name (FILE, \
180 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
182 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno); \
187 #define STARTFILE_SPEC "crt0.o%s"
188 #define ENDFILE_SPEC "%{!mno-lsim:-lsim}"
190 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */
191 #define CTOR_LISTS_DEFINED_EXTERNALLY
193 #undef DO_GLOBAL_CTORS_BODY
194 #undef DO_GLOBAL_DTORS_BODY
195 #undef INIT_SECTION_ASM_OP
196 #undef DTORS_SECTION_ASM_OP
198 #define SUPPORTS_ONE_ONLY 1
200 /* Switch into a generic section. */
201 #undef TARGET_ASM_NAMED_SECTION
202 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section