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