Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / config / arm / elf.h
1 /* Definitions of target machine for GNU compiler.
2    For ARM with ELF obj format.
3    Copyright (C) 1995-2013 Free Software Foundation, Inc.
4    Contributed by Philip Blundell <philb@gnu.org> and
5    Catherine Moore <clm@cygnus.com>
6    
7    This file is part of GCC.
8
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.
13
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.
18
19    You should have received a copy of the GNU General Public License
20    along with GCC; see the file COPYING3.  If not see
21    <http://www.gnu.org/licenses/>.  */
22
23 #ifndef OBJECT_FORMAT_ELF
24  #error elf.h included before elfos.h
25 #endif
26
27 #ifndef LOCAL_LABEL_PREFIX
28 #define LOCAL_LABEL_PREFIX "."
29 #endif
30
31 #ifndef SUBTARGET_CPP_SPEC
32 #define SUBTARGET_CPP_SPEC  "-D__ELF__"
33 #endif
34
35 #ifndef SUBTARGET_EXTRA_SPECS
36 #define SUBTARGET_EXTRA_SPECS \
37   { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
38   { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
39   SUBSUBTARGET_EXTRA_SPECS
40 #endif
41
42 #ifndef SUBTARGET_EXTRA_ASM_SPEC
43 #define SUBTARGET_EXTRA_ASM_SPEC ""
44 #endif
45
46 #ifndef SUBTARGET_ASM_FLOAT_SPEC
47 #define SUBTARGET_ASM_FLOAT_SPEC "\
48 %{mapcs-float:-mfloat}"
49 #endif
50
51 #undef SUBSUBTARGET_EXTRA_SPECS
52 #define SUBSUBTARGET_EXTRA_SPECS
53
54 #ifndef ASM_SPEC
55 #define ASM_SPEC "\
56 %{mbig-endian:-EB} \
57 %{mlittle-endian:-EL} \
58 %(asm_cpu_spec) \
59 %{mapcs-*:-mapcs-%*} \
60 %(subtarget_asm_float_spec) \
61 %{mthumb-interwork:-mthumb-interwork} \
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       if (!flag_inhibit_size_directive)                         \
91         ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                 \
92     }                                                           \
93   while (0)
94
95 /* Define this macro if jump tables (for `tablejump' insns) should be
96    output in the text section, along with the assembler instructions.
97    Otherwise, the readonly data section is used.  */
98 /* We put ARM and Thumb-2 jump tables in the text section, because it makes
99    the code more efficient, but for Thumb-1 it's better to put them out of
100    band unless we are generating compressed tables.  */
101 #define JUMP_TABLES_IN_TEXT_SECTION                                     \
102    (TARGET_32BIT || (TARGET_THUMB && (optimize_size || flag_pic)))
103
104 #ifndef LINK_SPEC
105 #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
106 #endif
107   
108 /* Run-time Target Specification.  */
109 #ifndef TARGET_DEFAULT
110 #define TARGET_DEFAULT (MASK_APCS_FRAME)
111 #endif
112
113 #ifndef MULTILIB_DEFAULTS
114 #define MULTILIB_DEFAULTS \
115   { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
116 #endif
117 \f
118 #define TARGET_ASM_FILE_START_APP_OFF true
119 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
120 \f
121
122 /* Output an element in the static constructor array.  */
123 #undef TARGET_ASM_CONSTRUCTOR
124 #define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
125
126 #undef TARGET_ASM_DESTRUCTOR
127 #define TARGET_ASM_DESTRUCTOR arm_elf_asm_destructor
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 /* Align output to a power of two.  Note ".align 0" is redundant,
137    and also GAS will treat it as ".align 2" which we do not want.  */
138 #define ASM_OUTPUT_ALIGN(STREAM, POWER)                 \
139   do                                                    \
140     {                                                   \
141       if ((POWER) > 0)                                  \
142         fprintf (STREAM, "\t.align\t%d\n", POWER);      \
143     }                                                   \
144   while (0)
145
146 /* Horrible hack: We want to prevent some libgcc routines being included
147    for some multilibs.  */
148 #ifndef __ARM_ARCH_6M__
149 #undef L_fixdfsi
150 #undef L_fixunsdfsi
151 #undef L_truncdfsf2
152 #undef L_fixsfsi
153 #undef L_fixunssfsi
154 #undef L_floatdidf
155 #undef L_floatdisf
156 #undef L_floatundidf
157 #undef L_floatundisf
158 #endif
159