1 /* Definitions for ARM running Linux-based GNU systems using ELF
2 Copyright (C) 1993, 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
3 Contributed by Philip Blundell <philb@gnu.org>
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 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. */
22 /* Run-time Target Specification. */
23 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
25 /* We have libgcc2. */
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}"
37 /* Now we define the strings used to build the spec file. */
38 #define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
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}"
44 #define STARTFILE_SPEC "%{!shared:crt1.o%s} \
46 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
48 #define LINK_SPEC "%{h*} %{version:-v} \
52 %{symbolic:-Bsymbolic} \
53 %{rdynamic:-export-dynamic} \
54 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
57 SUBTARGET_EXTRA_LINK_SPEC
60 #define CPP_PREDEFINES \
61 "-Dunix -Darm -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(arm) \
62 -Amachine(arm) -D__ELF__ -Darm_elf"
64 #ifndef SUBTARGET_DEFAULT_APCS26
65 #undef CPP_APCS_PC_DEFAULT_SPEC
66 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
69 /* Allow #sccs in preprocessor. */
70 #define SCCS_DIRECTIVE
72 #define USER_LABEL_PREFIX "" /* For ELF the default is no underscores */
73 #define LOCAL_LABEL_PREFIX "."
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"
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);
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)
89 #define ASM_FILE_END(FILE) \
92 fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
93 IDENT_ASM_OP, version_string); \
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
106 /* Support for Constructors and Destructors. */
107 #define READONLY_DATA_SECTION() const_section ()
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,
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
120 extern void text_section ();
122 #define CONST_SECTION_ASM_OP ".section\t.rodata"
124 #define CONST_SECTION_FUNCTION \
128 if (!USE_CONST_SECTION) \
130 else if (in_section != in_const) \
132 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
133 in_section = in_const; \
137 /* Switch into a generic section.
138 This is currently only used to support section attributes.
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")
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) \
153 if (TREE_CODE (DECL) == STRING_CST) \
155 if (! flag_writable_strings) \
160 else if (TREE_CODE (DECL) == VAR_DECL) \
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)))) \
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 ()
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"
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)
196 /* This is how we tell the assembler that two symbols have the same value. */
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)
205 #include "arm/linux-gas.h"