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 GNU CC.
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)
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.
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. */
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 #define TARGET_OS_CPP_BUILTINS() \
31 builtin_define ("__ELF__"); \
35 /* Use DWARF2 debugging info. */
36 #define DWARF2_DEBUGGING_INFO 1
38 #undef PREFERRED_DEBUGGING_TYPE
39 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
41 /* But allow DWARF 1 if the user wants it. */
42 #define DWARF_DEBUGGING_INFO 1
44 #define EXPORTS_SECTION_ASM_OP "\t.section .exports"
46 #define SUBTARGET_EXTRA_SECTIONS in_exports
48 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
49 EXPORT_SECTION_FUNCTION
51 #define EXPORT_SECTION_FUNCTION \
55 if (in_section != in_exports) \
57 fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
58 in_section = in_exports; \
62 #define SUBTARGET_SWITCH_SECTIONS \
63 case in_exports: exports_section (); break;
66 #define MCORE_EXPORT_NAME(STREAM, NAME) \
70 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
71 (* targetm.strip_name_encoding) (NAME)); \
75 /* Write the extra assembler code needed to declare a function properly.
76 Some svr4 assemblers need to also have something extra said about the
77 function's return value. We allow for that here. */
78 #undef ASM_DECLARE_FUNCTION_NAME
79 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
82 if (mcore_dllexport_name_p (NAME)) \
84 MCORE_EXPORT_NAME (FILE, NAME); \
85 function_section (DECL); \
87 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
88 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
89 ASM_OUTPUT_LABEL (FILE, NAME); \
93 /* Write the extra assembler code needed to declare an object properly. */
94 #undef ASM_DECLARE_OBJECT_NAME
95 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
99 if (mcore_dllexport_name_p (NAME)) \
101 enum in_section save_section = in_section; \
102 MCORE_EXPORT_NAME (FILE, NAME); \
103 switch_to_section (save_section, (DECL)); \
105 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
106 size_directive_output = 0; \
107 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
109 size_directive_output = 1; \
110 size = int_size_in_bytes (TREE_TYPE (DECL)); \
111 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
113 ASM_OUTPUT_LABEL(FILE, NAME); \
117 /* Output the size directive for a decl in rest_of_decl_compilation
118 in the case where we did not do so before the initializer.
119 Once we find the error_mark_node, we know that the value of
120 size_directive_output was set
121 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
122 #undef ASM_FINISH_DECLARE_OBJECT
123 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
126 const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
127 HOST_WIDE_INT size; \
128 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
129 && ! AT_END && TOP_LEVEL \
130 && DECL_INITIAL (DECL) == error_mark_node \
131 && !size_directive_output) \
133 size_directive_output = 1; \
134 size = int_size_in_bytes (TREE_TYPE (DECL)); \
135 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
141 #undef STARTFILE_SPEC
142 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
144 /* Include the OS stub library, so that the code can be simulated.
145 This is not the right way to do this. Ideally this kind of thing
146 should be done in the linker script - but I have not worked out how
147 to specify the location of a linker script in a gcc command line yet. */
149 #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
151 /* The subroutine calls in the .init and .fini sections create literal
152 pools which must be jumped around... */
153 #define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:");
155 #undef CTORS_SECTION_ASM_OP
156 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
157 #undef DTORS_SECTION_ASM_OP
158 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
160 #endif /* __MCORE_ELF_H__ */