]>
Commit | Line | Data |
---|---|---|
b355a481 | 1 | /* Definitions for ARM running Linux-based GNU systems using ELF |
be163a70 | 2 | Copyright (C) 1993, 1994, 1997, 1998, 1999 Free Software Foundation, Inc. |
b355a481 NC |
3 | Contributed by Philip Blundell <philb@gnu.org> |
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 this program; 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 | /* Run-time Target Specification. */ | |
23 | #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); | |
24 | ||
25 | /* We have libgcc2. */ | |
26 | #define HAVE_ATEXIT | |
27 | ||
28 | /* Default is to use APCS-32 mode. */ | |
29 | #ifndef SUBTARGET_DEFAULT_APCS26 | |
30 | #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SHORT_BYTE) | |
31 | #define SUBTARGET_EXTRA_LINK_SPEC \ | |
32 | " %{mapcs-26:-m elf32arm26} %{!mapcs-26:-m elf32arm}" | |
33 | #define SUBTARGET_EXTRA_ASM_SPEC \ | |
34 | " %{mapcs-26:-mapcs-26} %(!mapcs-26:-mapcs-32}" | |
35 | #endif | |
36 | ||
37 | /* Now we define the strings used to build the spec file. */ | |
38 | #define LIB_SPEC "%{!shared:%{!symbolic:-lc}}" | |
39 | ||
40 | /* Add the compiler's crtend, and the library's crtn. */ | |
41 | #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ | |
42 | %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" | |
43 | ||
44 | #define STARTFILE_SPEC "%{!shared:crt1.o%s} \ | |
45 | crti.o%s \ | |
46 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
47 | ||
48 | #define LINK_SPEC "%{h*} %{version:-v} \ | |
49 | %{b} %{Wl,*:%*} \ | |
50 | %{static:-Bstatic} \ | |
51 | %{shared:-shared} \ | |
52 | %{symbolic:-Bsymbolic} \ | |
53 | %{rdynamic:-export-dynamic} \ | |
54 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ | |
55 | -X \ | |
56 | %{mbig-endian:-EB}" \ | |
57 | SUBTARGET_EXTRA_LINK_SPEC | |
58 | ||
59 | #undef CPP_PREDEFINES | |
60 | #define CPP_PREDEFINES \ | |
61 | "-Dunix -Darm -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(arm) \ | |
62 | -Amachine(arm) -D__ELF__ -Darm_elf" | |
63 | ||
64 | #ifndef SUBTARGET_DEFAULT_APCS26 | |
65 | #undef CPP_APCS_PC_DEFAULT_SPEC | |
66 | #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" | |
67 | #endif | |
68 | ||
69 | /* Allow #sccs in preprocessor. */ | |
70 | #define SCCS_DIRECTIVE | |
71 | ||
72 | #define USER_LABEL_PREFIX "" /* For ELF the default is no underscores */ | |
73 | #define LOCAL_LABEL_PREFIX "." | |
74 | ||
75 | /* Attach a special .ident directive to the end of the file to identify | |
76 | the version of GCC which compiled this code. */ | |
77 | #define IDENT_ASM_OP ".ident" | |
78 | ||
79 | /* Output #ident as a .ident. */ | |
80 | #define ASM_OUTPUT_IDENT(FILE, NAME) \ | |
81 | fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); | |
82 | ||
83 | #ifdef IDENTIFY_WITH_IDENT | |
84 | #define ASM_IDENTIFY_GCC(FILE) /* nothing */ | |
85 | #define ASM_IDENTIFY_LANGUAGE(FILE) \ | |
86 | fprintf (FILE, "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP, \ | |
87 | lang_identify (), version_string) | |
88 | #else | |
89 | #define ASM_FILE_END(FILE) \ | |
90 | do { \ | |
be163a70 ZW |
91 | if (!flag_no_ident) \ |
92 | fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ | |
93 | IDENT_ASM_OP, version_string); \ | |
b355a481 NC |
94 | } while (0) |
95 | #endif | |
96 | ||
97 | /* Support const sections and the ctors and dtors sections for g++. | |
98 | Note that there appears to be two different ways to support const | |
99 | sections at the moment. You can either #define the symbol | |
100 | READONLY_DATA_SECTION (giving it some code which switches to the | |
101 | readonly data section) or else you can #define the symbols | |
102 | EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and | |
103 | SELECT_RTX_SECTION. We do both here just to be on the safe side. */ | |
104 | #define USE_CONST_SECTION 1 | |
105 | ||
106 | /* Support for Constructors and Destructors. */ | |
107 | #define READONLY_DATA_SECTION() const_section () | |
108 | ||
109 | /* A default list of other sections which we might be "in" at any given | |
110 | time. For targets that use additional sections (e.g. .tdesc) you | |
111 | should override this definition in the target-specific file which | |
112 | includes this file. */ | |
113 | #define SUBTARGET_EXTRA_SECTIONS in_const, | |
114 | ||
115 | /* A default list of extra section function definitions. For targets | |
116 | that use additional sections (e.g. .tdesc) you should override this | |
117 | definition in the target-specific file which includes this file. */ | |
118 | #define SUBTARGET_EXTRA_SECTION_FUNCTIONS CONST_SECTION_FUNCTION | |
119 | ||
120 | extern void text_section (); | |
121 | ||
122 | #define CONST_SECTION_ASM_OP ".section\t.rodata" | |
123 | ||
124 | #define CONST_SECTION_FUNCTION \ | |
125 | void \ | |
126 | const_section () \ | |
127 | { \ | |
128 | if (!USE_CONST_SECTION) \ | |
129 | text_section (); \ | |
130 | else if (in_section != in_const) \ | |
131 | { \ | |
132 | fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ | |
133 | in_section = in_const; \ | |
134 | } \ | |
135 | } | |
136 | ||
137 | /* Switch into a generic section. | |
138 | This is currently only used to support section attributes. | |
139 | ||
140 | We make the section read-only and executable for a function decl, | |
141 | read-only for a const data decl, and writable for a non-const data decl. */ | |
142 | #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ | |
143 | fprintf (FILE, ".section\t%s,\"%s\",%%progbits\n", NAME, \ | |
144 | (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ | |
145 | (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") | |
146 | ||
147 | /* A C statement or statements to switch to the appropriate | |
148 | section for output of DECL. DECL is either a `VAR_DECL' node | |
149 | or a constant of some sort. RELOC indicates whether forming | |
150 | the initial value of DECL requires link-time relocations. */ | |
151 | #define SELECT_SECTION(DECL,RELOC) \ | |
152 | { \ | |
153 | if (TREE_CODE (DECL) == STRING_CST) \ | |
154 | { \ | |
155 | if (! flag_writable_strings) \ | |
156 | const_section (); \ | |
157 | else \ | |
158 | data_section (); \ | |
159 | } \ | |
160 | else if (TREE_CODE (DECL) == VAR_DECL) \ | |
161 | { \ | |
162 | if ((flag_pic && RELOC) \ | |
163 | || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ | |
164 | || !DECL_INITIAL (DECL) \ | |
165 | || (DECL_INITIAL (DECL) != error_mark_node \ | |
166 | && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ | |
167 | data_section (); \ | |
168 | else \ | |
169 | const_section (); \ | |
170 | } \ | |
171 | else \ | |
172 | const_section (); \ | |
173 | } | |
174 | ||
175 | /* A C statement or statements to switch to the appropriate | |
176 | section for output of RTX in mode MODE. RTX is some kind | |
177 | of constant in RTL. The argument MODE is redundant except | |
178 | in the case of a `const_int' rtx. Currently, these always | |
179 | go into the const section. */ | |
180 | #define SELECT_RTX_SECTION(MODE,RTX) const_section () | |
181 | ||
182 | /* On svr4, we *do* have support for the .init and .fini sections, and we | |
183 | can put stuff in there to be executed before and after `main'. We let | |
184 | crtstuff.c and other files know this by defining the following symbols. | |
185 | The definitions say how to change sections to the .init and .fini | |
186 | sections. This is the same for all known svr4 assemblers. */ | |
187 | #define INIT_SECTION_ASM_OP ".section\t.init" | |
188 | #define FINI_SECTION_ASM_OP ".section\t.fini" | |
189 | ||
190 | ||
191 | /* This is how we tell the assembler that a symbol is weak. */ | |
192 | #define ASM_WEAKEN_LABEL(FILE,NAME) \ | |
193 | do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ | |
194 | fputc ('\n', FILE); } while (0) | |
195 | ||
196 | /* This is how we tell the assembler that two symbols have the same value. */ | |
197 | ||
198 | #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ | |
199 | do { assemble_name (FILE, NAME1); \ | |
200 | fputs (" = ", FILE); \ | |
201 | assemble_name (FILE, NAME2); \ | |
202 | fputc ('\n', FILE); } while (0) | |
203 | ||
204 | #include "arm/elf.h" | |
205 | #include "arm/linux-gas.h" |