]>
Commit | Line | Data |
---|---|---|
8f90be4c | 1 | /* Definitions of MCore target. |
aeee4812 | 2 | Copyright (C) 1998-2023 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 | 8 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 9 | the Free Software Foundation; either version 3, or (at your option) |
8f90be4c NC |
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 | |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
8f90be4c NC |
20 | |
21 | #ifndef __MCORE_ELF_H__ | |
22 | #define __MCORE_ELF_H__ | |
23 | ||
8f90be4c | 24 | /* Use DWARF2 debugging info. */ |
8f90be4c | 25 | #define DWARF2_DEBUGGING_INFO 1 |
8f90be4c NC |
26 | |
27 | #undef PREFERRED_DEBUGGING_TYPE | |
28 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
29 | ||
8f90be4c NC |
30 | #define MCORE_EXPORT_NAME(STREAM, NAME) \ |
31 | do \ | |
32 | { \ | |
d6b5193b | 33 | fprintf (STREAM, "\t.section .exports\n"); \ |
8f90be4c | 34 | fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \ |
772c5265 | 35 | (* targetm.strip_name_encoding) (NAME)); \ |
d6b5193b | 36 | in_section = NULL; \ |
8f90be4c | 37 | } \ |
60141420 | 38 | while (0) |
8f90be4c NC |
39 | |
40 | /* Write the extra assembler code needed to declare a function properly. | |
41 | Some svr4 assemblers need to also have something extra said about the | |
42 | function's return value. We allow for that here. */ | |
43 | #undef ASM_DECLARE_FUNCTION_NAME | |
2be2ac70 ZW |
44 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ |
45 | do \ | |
46 | { \ | |
47 | if (mcore_dllexport_name_p (NAME)) \ | |
48 | { \ | |
49 | MCORE_EXPORT_NAME (FILE, NAME); \ | |
d6b5193b | 50 | switch_to_section (function_section (DECL)); \ |
2be2ac70 ZW |
51 | } \ |
52 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ | |
53 | ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ | |
54 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
55 | } \ | |
8f90be4c NC |
56 | while (0) |
57 | ||
58 | /* Write the extra assembler code needed to declare an object properly. */ | |
59 | #undef ASM_DECLARE_OBJECT_NAME | |
2be2ac70 ZW |
60 | #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ |
61 | do \ | |
62 | { \ | |
63 | HOST_WIDE_INT size; \ | |
64 | if (mcore_dllexport_name_p (NAME)) \ | |
65 | { \ | |
d6b5193b | 66 | section *save_section = in_section; \ |
2be2ac70 | 67 | MCORE_EXPORT_NAME (FILE, NAME); \ |
d6b5193b | 68 | switch_to_section (save_section); \ |
2be2ac70 ZW |
69 | } \ |
70 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ | |
71 | size_directive_output = 0; \ | |
72 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ | |
73 | { \ | |
74 | size_directive_output = 1; \ | |
75 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
76 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ | |
77 | } \ | |
78 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
79 | } \ | |
8f90be4c NC |
80 | while (0) |
81 | ||
82 | /* Output the size directive for a decl in rest_of_decl_compilation | |
83 | in the case where we did not do so before the initializer. | |
84 | Once we find the error_mark_node, we know that the value of | |
85 | size_directive_output was set | |
86 | by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ | |
87 | #undef ASM_FINISH_DECLARE_OBJECT | |
88 | #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ | |
89 | do \ | |
90 | { \ | |
3cce094d | 91 | const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ |
2be2ac70 | 92 | HOST_WIDE_INT size; \ |
8f90be4c NC |
93 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ |
94 | && ! AT_END && TOP_LEVEL \ | |
95 | && DECL_INITIAL (DECL) == error_mark_node \ | |
96 | && !size_directive_output) \ | |
97 | { \ | |
2be2ac70 ZW |
98 | size_directive_output = 1; \ |
99 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
100 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ | |
8f90be4c NC |
101 | } \ |
102 | } \ | |
103 | while (0) | |
104 | ||
105 | ||
106 | #undef STARTFILE_SPEC | |
107 | #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" | |
108 | ||
109 | /* Include the OS stub library, so that the code can be simulated. | |
110 | This is not the right way to do this. Ideally this kind of thing | |
111 | should be done in the linker script - but I have not worked out how | |
112 | to specify the location of a linker script in a gcc command line yet. */ | |
113 | #undef ENDFILE_SPEC | |
114 | #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s" | |
115 | ||
8f90be4c | 116 | /* The subroutine calls in the .init and .fini sections create literal |
14bc6742 | 117 | pools which must be jumped around.... */ |
cea3bd3e | 118 | #define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:"); |
8f90be4c NC |
119 | |
120 | #undef CTORS_SECTION_ASM_OP | |
78d057d8 | 121 | #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" |
8f90be4c | 122 | #undef DTORS_SECTION_ASM_OP |
78d057d8 | 123 | #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" |
8f90be4c NC |
124 | |
125 | #endif /* __MCORE_ELF_H__ */ |