]>
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 | ||
7ec022b2 | 5 | This file is part of GCC. |
8f90be4c | 6 | |
7ec022b2 | 7 | GCC is free software; you can redistribute it and/or modify |
8f90be4c NC |
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 | ||
7ec022b2 | 12 | GCC is distributed in the hope that it will be useful, |
8f90be4c NC |
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 | |
7ec022b2 | 18 | along with GCC; see the file COPYING. If not, write to |
8f90be4c NC |
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 | ||
8f90be4c | 28 | /* Use DWARF2 debugging info. */ |
8f90be4c | 29 | #define DWARF2_DEBUGGING_INFO 1 |
8f90be4c NC |
30 | |
31 | #undef PREFERRED_DEBUGGING_TYPE | |
32 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
33 | ||
8f90be4c NC |
34 | #define EXPORTS_SECTION_ASM_OP "\t.section .exports" |
35 | ||
d48bc59a | 36 | #define SUBTARGET_EXTRA_SECTIONS in_exports |
8f90be4c NC |
37 | |
38 | #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ | |
d48bc59a | 39 | EXPORT_SECTION_FUNCTION |
8f90be4c NC |
40 | |
41 | #define EXPORT_SECTION_FUNCTION \ | |
42 | void \ | |
43 | exports_section () \ | |
44 | { \ | |
45 | if (in_section != in_exports) \ | |
46 | { \ | |
47 | fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \ | |
48 | in_section = in_exports; \ | |
49 | } \ | |
50 | } | |
51 | ||
52 | #define SUBTARGET_SWITCH_SECTIONS \ | |
d48bc59a | 53 | case in_exports: exports_section (); break; |
8f90be4c NC |
54 | |
55 | ||
56 | #define MCORE_EXPORT_NAME(STREAM, NAME) \ | |
57 | do \ | |
58 | { \ | |
59 | exports_section (); \ | |
60 | fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \ | |
772c5265 | 61 | (* targetm.strip_name_encoding) (NAME)); \ |
8f90be4c NC |
62 | } \ |
63 | while (0); | |
64 | ||
65 | /* Write the extra assembler code needed to declare a function properly. | |
66 | Some svr4 assemblers need to also have something extra said about the | |
67 | function's return value. We allow for that here. */ | |
68 | #undef ASM_DECLARE_FUNCTION_NAME | |
2be2ac70 ZW |
69 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ |
70 | do \ | |
71 | { \ | |
72 | if (mcore_dllexport_name_p (NAME)) \ | |
73 | { \ | |
74 | MCORE_EXPORT_NAME (FILE, NAME); \ | |
75 | function_section (DECL); \ | |
76 | } \ | |
77 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ | |
78 | ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ | |
79 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
80 | } \ | |
8f90be4c NC |
81 | while (0) |
82 | ||
83 | /* Write the extra assembler code needed to declare an object properly. */ | |
84 | #undef ASM_DECLARE_OBJECT_NAME | |
2be2ac70 ZW |
85 | #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ |
86 | do \ | |
87 | { \ | |
88 | HOST_WIDE_INT size; \ | |
89 | if (mcore_dllexport_name_p (NAME)) \ | |
90 | { \ | |
91 | enum in_section save_section = in_section; \ | |
92 | MCORE_EXPORT_NAME (FILE, NAME); \ | |
93 | switch_to_section (save_section, (DECL)); \ | |
94 | } \ | |
95 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ | |
96 | size_directive_output = 0; \ | |
97 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ | |
98 | { \ | |
99 | size_directive_output = 1; \ | |
100 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
101 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ | |
102 | } \ | |
103 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
104 | } \ | |
8f90be4c NC |
105 | while (0) |
106 | ||
107 | /* Output the size directive for a decl in rest_of_decl_compilation | |
108 | in the case where we did not do so before the initializer. | |
109 | Once we find the error_mark_node, we know that the value of | |
110 | size_directive_output was set | |
111 | by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ | |
112 | #undef ASM_FINISH_DECLARE_OBJECT | |
113 | #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ | |
114 | do \ | |
115 | { \ | |
3cce094d | 116 | const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ |
2be2ac70 | 117 | HOST_WIDE_INT size; \ |
8f90be4c NC |
118 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ |
119 | && ! AT_END && TOP_LEVEL \ | |
120 | && DECL_INITIAL (DECL) == error_mark_node \ | |
121 | && !size_directive_output) \ | |
122 | { \ | |
2be2ac70 ZW |
123 | size_directive_output = 1; \ |
124 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
125 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ | |
8f90be4c NC |
126 | } \ |
127 | } \ | |
128 | while (0) | |
129 | ||
130 | ||
131 | #undef STARTFILE_SPEC | |
132 | #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" | |
133 | ||
134 | /* Include the OS stub library, so that the code can be simulated. | |
135 | This is not the right way to do this. Ideally this kind of thing | |
136 | should be done in the linker script - but I have not worked out how | |
137 | to specify the location of a linker script in a gcc command line yet. */ | |
138 | #undef ENDFILE_SPEC | |
139 | #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s" | |
140 | ||
8f90be4c NC |
141 | /* The subroutine calls in the .init and .fini sections create literal |
142 | pools which must be jumped around... */ | |
cea3bd3e | 143 | #define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:"); |
8f90be4c NC |
144 | |
145 | #undef CTORS_SECTION_ASM_OP | |
78d057d8 | 146 | #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" |
8f90be4c | 147 | #undef DTORS_SECTION_ASM_OP |
78d057d8 | 148 | #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" |
8f90be4c NC |
149 | |
150 | #endif /* __MCORE_ELF_H__ */ |