1 |
12 |
jlechner |
/* Definitions of MCore target.
|
2 |
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Cygnus Solutions.
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
11 |
|
|
any later version.
|
12 |
|
|
|
13 |
|
|
GCC is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GCC; see the file COPYING. If not, write to
|
20 |
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
21 |
|
|
Boston, MA 02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#ifndef __MCORE_ELF_H__
|
24 |
|
|
#define __MCORE_ELF_H__
|
25 |
|
|
|
26 |
|
|
/* Run-time Target Specification. */
|
27 |
|
|
#define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
|
28 |
|
|
|
29 |
|
|
/* Use DWARF2 debugging info. */
|
30 |
|
|
#define DWARF2_DEBUGGING_INFO 1
|
31 |
|
|
|
32 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
33 |
|
|
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
34 |
|
|
|
35 |
|
|
#define EXPORTS_SECTION_ASM_OP "\t.section .exports"
|
36 |
|
|
|
37 |
|
|
#define SUBTARGET_EXTRA_SECTIONS in_exports
|
38 |
|
|
|
39 |
|
|
#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
|
40 |
|
|
EXPORT_SECTION_FUNCTION
|
41 |
|
|
|
42 |
|
|
#define EXPORT_SECTION_FUNCTION \
|
43 |
|
|
void \
|
44 |
|
|
exports_section () \
|
45 |
|
|
{ \
|
46 |
|
|
if (in_section != in_exports) \
|
47 |
|
|
{ \
|
48 |
|
|
fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
|
49 |
|
|
in_section = in_exports; \
|
50 |
|
|
} \
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
#define SUBTARGET_SWITCH_SECTIONS \
|
54 |
|
|
case in_exports: exports_section (); break;
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
#define MCORE_EXPORT_NAME(STREAM, NAME) \
|
58 |
|
|
do \
|
59 |
|
|
{ \
|
60 |
|
|
exports_section (); \
|
61 |
|
|
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
|
62 |
|
|
(* targetm.strip_name_encoding) (NAME)); \
|
63 |
|
|
} \
|
64 |
|
|
while (0);
|
65 |
|
|
|
66 |
|
|
/* Write the extra assembler code needed to declare a function properly.
|
67 |
|
|
Some svr4 assemblers need to also have something extra said about the
|
68 |
|
|
function's return value. We allow for that here. */
|
69 |
|
|
#undef ASM_DECLARE_FUNCTION_NAME
|
70 |
|
|
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
71 |
|
|
do \
|
72 |
|
|
{ \
|
73 |
|
|
if (mcore_dllexport_name_p (NAME)) \
|
74 |
|
|
{ \
|
75 |
|
|
MCORE_EXPORT_NAME (FILE, NAME); \
|
76 |
|
|
function_section (DECL); \
|
77 |
|
|
} \
|
78 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
79 |
|
|
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
|
80 |
|
|
ASM_OUTPUT_LABEL (FILE, NAME); \
|
81 |
|
|
} \
|
82 |
|
|
while (0)
|
83 |
|
|
|
84 |
|
|
/* Write the extra assembler code needed to declare an object properly. */
|
85 |
|
|
#undef ASM_DECLARE_OBJECT_NAME
|
86 |
|
|
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
87 |
|
|
do \
|
88 |
|
|
{ \
|
89 |
|
|
HOST_WIDE_INT size; \
|
90 |
|
|
if (mcore_dllexport_name_p (NAME)) \
|
91 |
|
|
{ \
|
92 |
|
|
enum in_section save_section = in_section; \
|
93 |
|
|
MCORE_EXPORT_NAME (FILE, NAME); \
|
94 |
|
|
switch_to_section (save_section, (DECL)); \
|
95 |
|
|
} \
|
96 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
97 |
|
|
size_directive_output = 0; \
|
98 |
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
|
99 |
|
|
{ \
|
100 |
|
|
size_directive_output = 1; \
|
101 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
102 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
|
103 |
|
|
} \
|
104 |
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
105 |
|
|
} \
|
106 |
|
|
while (0)
|
107 |
|
|
|
108 |
|
|
/* Output the size directive for a decl in rest_of_decl_compilation
|
109 |
|
|
in the case where we did not do so before the initializer.
|
110 |
|
|
Once we find the error_mark_node, we know that the value of
|
111 |
|
|
size_directive_output was set
|
112 |
|
|
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
|
113 |
|
|
#undef ASM_FINISH_DECLARE_OBJECT
|
114 |
|
|
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
|
115 |
|
|
do \
|
116 |
|
|
{ \
|
117 |
|
|
const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
118 |
|
|
HOST_WIDE_INT size; \
|
119 |
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
|
120 |
|
|
&& ! AT_END && TOP_LEVEL \
|
121 |
|
|
&& DECL_INITIAL (DECL) == error_mark_node \
|
122 |
|
|
&& !size_directive_output) \
|
123 |
|
|
{ \
|
124 |
|
|
size_directive_output = 1; \
|
125 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
126 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
|
127 |
|
|
} \
|
128 |
|
|
} \
|
129 |
|
|
while (0)
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
#undef STARTFILE_SPEC
|
133 |
|
|
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
|
134 |
|
|
|
135 |
|
|
/* Include the OS stub library, so that the code can be simulated.
|
136 |
|
|
This is not the right way to do this. Ideally this kind of thing
|
137 |
|
|
should be done in the linker script - but I have not worked out how
|
138 |
|
|
to specify the location of a linker script in a gcc command line yet. */
|
139 |
|
|
#undef ENDFILE_SPEC
|
140 |
|
|
#define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
|
141 |
|
|
|
142 |
|
|
/* The subroutine calls in the .init and .fini sections create literal
|
143 |
|
|
pools which must be jumped around.... */
|
144 |
|
|
#define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:");
|
145 |
|
|
|
146 |
|
|
#undef CTORS_SECTION_ASM_OP
|
147 |
|
|
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
|
148 |
|
|
#undef DTORS_SECTION_ASM_OP
|
149 |
|
|
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
|
150 |
|
|
|
151 |
|
|
#endif /* __MCORE_ELF_H__ */
|