]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/mcore/mcore-elf.h
All files: Updated copyright information.
[thirdparty/gcc.git] / gcc / config / mcore / mcore-elf.h
CommitLineData
8f90be4c
NC
1/* Definitions of MCore target.
2 Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#ifndef __MCORE_ELF_H__
23#define __MCORE_ELF_H__
24
25/* Run-time Target Specification. */
26#define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
27
28#define SUBTARGET_CPP_PREDEFINES " -D__ELF__"
29
30#include "svr4.h"
31#include "mcore/mcore.h"
32
33/* Use DWARF2 debugging info. */
34#ifndef DWARF2_DEBUGGING_INFO
35#define DWARF2_DEBUGGING_INFO 1
36#endif
37
38#undef PREFERRED_DEBUGGING_TYPE
39#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
40
41/* But allow DWARF 1 if the user wants it. */
42#ifndef DWARF_DEBUGGING_INFO
43#define DWARF_DEBUGGING_INFO 1
44#endif
45
46/* The numbers used to denote specific machine registers in the System V
47 Release 4 DWARF debugging information are quite likely to be totally
48 different from the numbers used in BSD stabs debugging information
49 for the same kind of target machine. Thus, we undefine the macro
50 DBX_REGISTER_NUMBER here as an extra inducement to get people to
51 provide proper machine-specific definitions of DBX_REGISTER_NUMBER
52 (which is also used to provide DWARF registers numbers in dwarfout.c)
53 in their tm.h files which include this file. */
54
55#undef DBX_REGISTER_NUMBER
56#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
57
58/* When using stabs, gcc2_compiled must be a stabs entry, not an
59 ordinary symbol, or gdb won't see it. The stabs entry must be
60 before the N_SO in order for gdb to find it. */
61#undef ASM_IDENTIFY_GCC
62#define ASM_IDENTIFY_GCC(FILE) \
63do \
64 { \
65 if (write_symbols != DBX_DEBUG) \
66 fputs ("gcc2_compiled.:\n", FILE); \
67 else \
68 fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
69 } \
70while (0)
71
72/* MCore defines .long and .short to NOT force any alignment.
73 This lets you misalign as much as you wish. */
74#define UNALIGNED_INT_ASM_OP ".long"
75#define UNALIGNED_SHORT_ASM_OP ".short"
76
77#define EXPORTS_SECTION_ASM_OP "\t.section .exports"
78
79#define SUBTARGET_EXTRA_SECTIONS in_const, in_exports
80
81#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
82 CONST_SECTION_FUNCTION \
83 EXPORT_SECTION_FUNCTION \
84
85/* CONST_SECTION_FUNCTION is defined svr4.h. */
86
87#define EXPORT_SECTION_FUNCTION \
88void \
89exports_section () \
90{ \
91 if (in_section != in_exports) \
92 { \
93 fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
94 in_section = in_exports; \
95 } \
96}
97
98#define SUBTARGET_SWITCH_SECTIONS \
99 case in_exports: exports_section (); break; \
100 case in_const: const_section (); break;
101
102
103#define MCORE_EXPORT_NAME(STREAM, NAME) \
104 do \
105 { \
106 exports_section (); \
107 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
108 MCORE_STRIP_NAME_ENCODING (NAME)); \
109 } \
110 while (0);
111
112/* Write the extra assembler code needed to declare a function properly.
113 Some svr4 assemblers need to also have something extra said about the
114 function's return value. We allow for that here. */
115#undef ASM_DECLARE_FUNCTION_NAME
116#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
117 do \
118 { \
119 if (mcore_dllexport_name_p (NAME)) \
120 { \
121 MCORE_EXPORT_NAME (FILE, NAME); \
122 function_section (DECL); \
123 } \
124 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
125 assemble_name (FILE, NAME); \
126 putc (',', FILE); \
127 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
128 putc ('\n', FILE); \
129 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
130 ASM_OUTPUT_LABEL (FILE, NAME); \
131 } \
132 while (0)
133
134/* Write the extra assembler code needed to declare an object properly. */
135#undef ASM_DECLARE_OBJECT_NAME
136#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
137 do \
138 { \
139 if (mcore_dllexport_name_p (NAME)) \
140 { \
141 enum in_section save_section = in_section; \
142 MCORE_EXPORT_NAME (FILE, NAME); \
143 switch_to_section (save_section, (DECL)); \
144 } \
145 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
146 assemble_name (FILE, NAME); \
147 putc (',', FILE); \
148 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
149 putc ('\n', FILE); \
150 size_directive_output = 0; \
151 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
152 { \
153 size_directive_output = 1; \
154 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
155 assemble_name (FILE, NAME); \
156 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
157 } \
158 ASM_OUTPUT_LABEL(FILE, NAME); \
159 } \
160 while (0)
161
162/* Output the size directive for a decl in rest_of_decl_compilation
163 in the case where we did not do so before the initializer.
164 Once we find the error_mark_node, we know that the value of
165 size_directive_output was set
166 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
167#undef ASM_FINISH_DECLARE_OBJECT
168#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
169 do \
170 { \
171 char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
172 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
173 && ! AT_END && TOP_LEVEL \
174 && DECL_INITIAL (DECL) == error_mark_node \
175 && !size_directive_output) \
176 { \
177 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
178 assemble_name (FILE, name); \
179 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
180 } \
181 } \
182 while (0)
183
184
185#undef STARTFILE_SPEC
186#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
187
188/* Include the OS stub library, so that the code can be simulated.
189 This is not the right way to do this. Ideally this kind of thing
190 should be done in the linker script - but I have not worked out how
191 to specify the location of a linker script in a gcc command line yet. */
192#undef ENDFILE_SPEC
193#define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
194
195
196/* The subroutine calls in the .init and .fini sections create literal
197 pools which must be jumped around... */
198#define FORCE_INIT_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
199#define FORCE_FINI_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
200
201#undef CTORS_SECTION_ASM_OP
202#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
203#undef DTORS_SECTION_ASM_OP
204#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
205
206#endif /* __MCORE_ELF_H__ */