PR c++/3478
[official-gcc.git] / gcc / config / mcore / mcore-elf.h
blob2234e7d1957e466ddafe4714a431923a53a9cf9e
1 /* Definitions of MCore target.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of GCC.
7 GCC 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 GCC 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 GCC; 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 /* Use DWARF2 debugging info. */
29 #define DWARF2_DEBUGGING_INFO 1
31 #undef PREFERRED_DEBUGGING_TYPE
32 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
34 #define EXPORTS_SECTION_ASM_OP "\t.section .exports"
36 #define SUBTARGET_EXTRA_SECTIONS in_exports
38 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
39 EXPORT_SECTION_FUNCTION
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 } \
52 #define SUBTARGET_SWITCH_SECTIONS \
53 case in_exports: exports_section (); break;
56 #define MCORE_EXPORT_NAME(STREAM, NAME) \
57 do \
58 { \
59 exports_section (); \
60 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
61 (* targetm.strip_name_encoding) (NAME)); \
62 } \
63 while (0);
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
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 } \
81 while (0)
83 /* Write the extra assembler code needed to declare an object properly. */
84 #undef ASM_DECLARE_OBJECT_NAME
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); \
103 ASM_OUTPUT_LABEL(FILE, NAME); \
105 while (0)
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 \
116 const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
117 HOST_WIDE_INT size; \
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) \
123 size_directive_output = 1; \
124 size = int_size_in_bytes (TREE_TYPE (DECL)); \
125 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
128 while (0)
131 #undef STARTFILE_SPEC
132 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
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"
141 /* The subroutine calls in the .init and .fini sections create literal
142 pools which must be jumped around.... */
143 #define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:");
145 #undef CTORS_SECTION_ASM_OP
146 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
147 #undef DTORS_SECTION_ASM_OP
148 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
150 #endif /* __MCORE_ELF_H__ */