* target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op,
[official-gcc.git] / gcc / config / mcore / mcore-elf.h
blob45cb3e86df1415cb33d3d57e8fe78c7e97406efd
1 /* Definitions of MCore target.
2 Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
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)
10 any later version.
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 #ifndef __MCORE_ELF_H__
23 #define __MCORE_ELF_H__
25 /* Run-time Target Specification. */
26 #define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
28 #define SUBTARGET_CPP_PREDEFINES " -D__ELF__"
30 /* Use DWARF2 debugging info. */
31 #ifndef DWARF2_DEBUGGING_INFO
32 #define DWARF2_DEBUGGING_INFO 1
33 #endif
35 #undef PREFERRED_DEBUGGING_TYPE
36 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
38 /* But allow DWARF 1 if the user wants it. */
39 #ifndef DWARF_DEBUGGING_INFO
40 #define DWARF_DEBUGGING_INFO 1
41 #endif
43 #define EXPORTS_SECTION_ASM_OP "\t.section .exports"
45 #define SUBTARGET_EXTRA_SECTIONS in_const, in_exports
47 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
48 CONST_SECTION_FUNCTION \
49 EXPORT_SECTION_FUNCTION \
51 /* CONST_SECTION_FUNCTION is defined svr4.h. */
53 #define EXPORT_SECTION_FUNCTION \
54 void \
55 exports_section () \
56 { \
57 if (in_section != in_exports) \
58 { \
59 fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
60 in_section = in_exports; \
61 } \
64 #define SUBTARGET_SWITCH_SECTIONS \
65 case in_exports: exports_section (); break; \
66 case in_const: const_section (); break;
69 #define MCORE_EXPORT_NAME(STREAM, NAME) \
70 do \
71 { \
72 exports_section (); \
73 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
74 MCORE_STRIP_NAME_ENCODING (NAME)); \
75 } \
76 while (0);
78 /* Write the extra assembler code needed to declare a function properly.
79 Some svr4 assemblers need to also have something extra said about the
80 function's return value. We allow for that here. */
81 #undef ASM_DECLARE_FUNCTION_NAME
82 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
83 do \
84 { \
85 if (mcore_dllexport_name_p (NAME)) \
86 { \
87 MCORE_EXPORT_NAME (FILE, NAME); \
88 function_section (DECL); \
89 } \
90 fprintf (FILE, "%s", TYPE_ASM_OP); \
91 assemble_name (FILE, NAME); \
92 putc (',', FILE); \
93 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
94 putc ('\n', FILE); \
95 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
96 ASM_OUTPUT_LABEL (FILE, NAME); \
97 } \
98 while (0)
100 /* Write the extra assembler code needed to declare an object properly. */
101 #undef ASM_DECLARE_OBJECT_NAME
102 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
103 do \
105 if (mcore_dllexport_name_p (NAME)) \
107 enum in_section save_section = in_section; \
108 MCORE_EXPORT_NAME (FILE, NAME); \
109 switch_to_section (save_section, (DECL)); \
111 fprintf (FILE, "%s", TYPE_ASM_OP); \
112 assemble_name (FILE, NAME); \
113 putc (',', FILE); \
114 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
115 putc ('\n', FILE); \
116 size_directive_output = 0; \
117 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
119 size_directive_output = 1; \
120 fprintf (FILE, "%s", SIZE_ASM_OP); \
121 assemble_name (FILE, NAME); \
122 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
124 ASM_OUTPUT_LABEL(FILE, NAME); \
126 while (0)
128 /* Output the size directive for a decl in rest_of_decl_compilation
129 in the case where we did not do so before the initializer.
130 Once we find the error_mark_node, we know that the value of
131 size_directive_output was set
132 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
133 #undef ASM_FINISH_DECLARE_OBJECT
134 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
135 do \
137 const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
138 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
139 && ! AT_END && TOP_LEVEL \
140 && DECL_INITIAL (DECL) == error_mark_node \
141 && !size_directive_output) \
143 fprintf (FILE, "%s", SIZE_ASM_OP); \
144 assemble_name (FILE, name); \
145 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
148 while (0)
151 #undef STARTFILE_SPEC
152 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
154 /* Include the OS stub library, so that the code can be simulated.
155 This is not the right way to do this. Ideally this kind of thing
156 should be done in the linker script - but I have not worked out how
157 to specify the location of a linker script in a gcc command line yet. */
158 #undef ENDFILE_SPEC
159 #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
162 /* The subroutine calls in the .init and .fini sections create literal
163 pools which must be jumped around... */
164 #define FORCE_INIT_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
165 #define FORCE_FINI_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
167 #undef CTORS_SECTION_ASM_OP
168 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
169 #undef DTORS_SECTION_ASM_OP
170 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
172 #endif /* __MCORE_ELF_H__ */