2016-07-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / config / arm / elf.h
blob246de5492665ba2a0292736a9c53fbaaef184d72
1 /* Definitions of target machine for GNU compiler.
2 For ARM with ELF obj format.
3 Copyright (C) 1995-2016 Free Software Foundation, Inc.
4 Contributed by Philip Blundell <philb@gnu.org> and
5 Catherine Moore <clm@cygnus.com>
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
28 #ifndef OBJECT_FORMAT_ELF
29 #error elf.h included before elfos.h
30 #endif
32 #ifndef LOCAL_LABEL_PREFIX
33 #define LOCAL_LABEL_PREFIX "."
34 #endif
36 #ifndef SUBTARGET_CPP_SPEC
37 #define SUBTARGET_CPP_SPEC "-D__ELF__"
38 #endif
40 #ifndef SUBTARGET_EXTRA_SPECS
41 #define SUBTARGET_EXTRA_SPECS \
42 { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
43 { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
44 SUBSUBTARGET_EXTRA_SPECS
45 #endif
47 #ifndef SUBTARGET_EXTRA_ASM_SPEC
48 #define SUBTARGET_EXTRA_ASM_SPEC ""
49 #endif
51 #ifndef SUBTARGET_ASM_FLOAT_SPEC
52 #define SUBTARGET_ASM_FLOAT_SPEC "\
53 %{mapcs-float:-mfloat}"
54 #endif
56 #undef SUBSUBTARGET_EXTRA_SPECS
57 #define SUBSUBTARGET_EXTRA_SPECS
59 #ifndef ASM_SPEC
60 #define ASM_SPEC "\
61 %{mbig-endian:-EB} \
62 %{mlittle-endian:-EL} \
63 %(asm_cpu_spec) \
64 %{mapcs-*:-mapcs-%*} \
65 %(subtarget_asm_float_spec) \
66 %{mthumb-interwork:-mthumb-interwork} \
67 %{mfloat-abi=*} %{mfpu=*} \
68 %(subtarget_extra_asm_spec)"
69 #endif
71 /* The ARM uses @ are a comment character so we need to redefine
72 TYPE_OPERAND_FMT. */
73 #undef TYPE_OPERAND_FMT
74 #define TYPE_OPERAND_FMT "%%%s"
76 /* We might need a ARM specific header to function declarations. */
77 #undef ASM_DECLARE_FUNCTION_NAME
78 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
79 do \
80 { \
81 ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL); \
82 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
83 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
84 ASM_OUTPUT_LABEL(FILE, NAME); \
85 ARM_OUTPUT_FN_UNWIND (FILE, TRUE); \
86 } \
87 while (0)
89 /* We might need an ARM specific trailer for function declarations. */
90 #undef ASM_DECLARE_FUNCTION_SIZE
91 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
92 do \
93 { \
94 ARM_OUTPUT_FN_UNWIND (FILE, FALSE); \
95 if (!flag_inhibit_size_directive) \
96 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
97 } \
98 while (0)
100 /* Define this macro if jump tables (for `tablejump' insns) should be
101 output in the text section, along with the assembler instructions.
102 Otherwise, the readonly data section is used. */
103 /* We put ARM and Thumb-2 jump tables in the text section, because it makes
104 the code more efficient, but for Thumb-1 it's better to put them out of
105 band unless we are generating compressed tables. */
106 #define JUMP_TABLES_IN_TEXT_SECTION \
107 (TARGET_32BIT || (TARGET_THUMB && (optimize_size || flag_pic)))
109 #ifndef LINK_SPEC
110 #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
111 #endif
113 /* Run-time Target Specification. */
114 #ifndef TARGET_DEFAULT
115 #define TARGET_DEFAULT (MASK_APCS_FRAME)
116 #endif
118 #ifndef MULTILIB_DEFAULTS
119 #define MULTILIB_DEFAULTS \
120 { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
121 #endif
123 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
126 /* Output an element in the static constructor array. */
127 #undef TARGET_ASM_CONSTRUCTOR
128 #define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
130 #undef TARGET_ASM_DESTRUCTOR
131 #define TARGET_ASM_DESTRUCTOR arm_elf_asm_destructor
133 /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs. */
134 #define NEED_PLT_RELOC flag_pic
135 #define NEED_GOT_RELOC flag_pic
137 /* The ELF assembler handles GOT addressing differently to NetBSD. */
138 #define GOT_PCREL 0
140 /* Align output to a power of two. Note ".align 0" is redundant,
141 and also GAS will treat it as ".align 2" which we do not want. */
142 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
143 do \
145 if ((POWER) > 0) \
146 fprintf (STREAM, "\t.align\t%d\n", POWER); \
148 while (0)
150 /* Horrible hack: We want to prevent some libgcc routines being included
151 for some multilibs. The condition should match the one in
152 libgcc/config/arm/lib1funcs.S. */
153 #if __ARM_ARCH_ISA_ARM || __ARM_ARCH_ISA_THUMB != 1
154 #undef L_fixdfsi
155 #undef L_fixunsdfsi
156 #undef L_truncdfsf2
157 #undef L_fixsfsi
158 #undef L_fixunssfsi
159 #undef L_floatdidf
160 #undef L_floatdisf
161 #undef L_floatundidf
162 #undef L_floatundisf
163 #endif