xref: /openbsd/gnu/gcc/gcc/config/arm/elf.h (revision 73471bf0)
1 /* Definitions of target machine for GNU compiler.
2    For ARM with ELF obj format.
3    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
4    Free Software Foundation, Inc.
5    Contributed by Philip Blundell <philb@gnu.org> and
6    Catherine Moore <clm@cygnus.com>
7 
8    This file is part of GCC.
9 
10    GCC is free software; you can redistribute it and/or modify it
11    under the terms of the GNU General Public License as published
12    by the Free Software Foundation; either version 2, or (at your
13    option) any later version.
14 
15    GCC is distributed in the hope that it will be useful, but WITHOUT
16    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
18    License for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with GCC; see the file COPYING.  If not, write to
22    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23    Boston, MA 02110-1301, USA.  */
24 
25 #ifndef OBJECT_FORMAT_ELF
26  #error elf.h included before elfos.h
27 #endif
28 
29 #ifndef LOCAL_LABEL_PREFIX
30 #define LOCAL_LABEL_PREFIX "."
31 #endif
32 
33 #ifndef SUBTARGET_CPP_SPEC
34 #define SUBTARGET_CPP_SPEC  "-D__ELF__"
35 #endif
36 
37 #ifndef SUBTARGET_EXTRA_SPECS
38 #define SUBTARGET_EXTRA_SPECS \
39   { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
40   { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC },
41 #endif
42 
43 #ifndef SUBTARGET_EXTRA_ASM_SPEC
44 #define SUBTARGET_EXTRA_ASM_SPEC ""
45 #endif
46 
47 #ifndef SUBTARGET_ASM_FLOAT_SPEC
48 #define SUBTARGET_ASM_FLOAT_SPEC "\
49 %{mapcs-float:-mfloat}"
50 #endif
51 
52 #ifndef ASM_SPEC
53 #define ASM_SPEC "\
54 %{mbig-endian:-EB} \
55 %{mlittle-endian:-EL} \
56 %{mcpu=*:-mcpu=%*} \
57 %{march=*:-march=%*} \
58 %{mapcs-*:-mapcs-%*} \
59 %(subtarget_asm_float_spec) \
60 %{mthumb-interwork:-mthumb-interwork} \
61 %{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \
62 %{mfloat-abi=*} %{mfpu=*} \
63 %(subtarget_extra_asm_spec)"
64 #endif
65 
66 /* The ARM uses @ are a comment character so we need to redefine
67    TYPE_OPERAND_FMT.  */
68 #undef  TYPE_OPERAND_FMT
69 #define TYPE_OPERAND_FMT	"%%%s"
70 
71 /* We might need a ARM specific header to function declarations.  */
72 #undef  ASM_DECLARE_FUNCTION_NAME
73 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
74   do								\
75     {								\
76       ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL);		\
77       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
78       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
79       ASM_OUTPUT_LABEL(FILE, NAME);				\
80       ARM_OUTPUT_FN_UNWIND (FILE, TRUE);			\
81     }								\
82   while (0)
83 
84 /* We might need an ARM specific trailer for function declarations.  */
85 #undef  ASM_DECLARE_FUNCTION_SIZE
86 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
87   do								\
88     {								\
89       ARM_OUTPUT_FN_UNWIND (FILE, FALSE);			\
90       ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL);		\
91       if (!flag_inhibit_size_directive)				\
92 	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
93     }								\
94   while (0)
95 
96 /* Define this macro if jump tables (for `tablejump' insns) should be
97    output in the text section, along with the assembler instructions.
98    Otherwise, the readonly data section is used.  */
99 /* We put ARM jump tables in the text section, because it makes the code
100    more efficient, but for Thumb it's better to put them out of band.  */
101 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
102 
103 #ifndef LINK_SPEC
104 #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
105 #endif
106 
107 /* Run-time Target Specification.  */
108 #ifndef TARGET_VERSION
109 #define TARGET_VERSION fputs (" (ARM/elf)", stderr)
110 #endif
111 
112 #ifndef TARGET_DEFAULT
113 #define TARGET_DEFAULT (MASK_APCS_FRAME)
114 #endif
115 
116 #ifndef MULTILIB_DEFAULTS
117 #define MULTILIB_DEFAULTS \
118   { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork", "fno-leading-underscore" }
119 #endif
120 
121 #define TARGET_ASM_FILE_START_APP_OFF true
122 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
123 
124 
125 /* Output an element in the static constructor array.  */
126 #undef TARGET_ASM_CONSTRUCTOR
127 #define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
128 
129 /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
130 #define NEED_PLT_RELOC	flag_pic
131 #define NEED_GOT_RELOC	flag_pic
132 
133 /* The ELF assembler handles GOT addressing differently to NetBSD.  */
134 #define GOT_PCREL	0
135 
136 /* Biggest alignment supported by the object file format of this
137    machine.  Use this macro to limit the alignment which can be
138    specified using the `__attribute__ ((aligned (N)))' construct.  If
139    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
140 #define MAX_OFILE_ALIGNMENT (32768 * 8)
141 
142 /* Align output to a power of two.  Note ".align 0" is redundant,
143    and also GAS will treat it as ".align 2" which we do not want.  */
144 #define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
145   do							\
146     {							\
147       if ((POWER) > 0)					\
148 	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
149     }							\
150   while (0)
151 
152 /* The EABI doesn't provide a way of implementing init_priority.  */
153 #define SUPPORTS_INIT_PRIORITY (!TARGET_AAPCS_BASED)
154