1/* Definitions of target machine for GNU compiler.
2   For ARM with ELF obj format.
3   Copyright (C) 1995-2015 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   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.
22
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/>.  */
27
28#ifndef OBJECT_FORMAT_ELF
29 #error elf.h included before elfos.h
30#endif
31
32#ifndef LOCAL_LABEL_PREFIX
33#define LOCAL_LABEL_PREFIX "."
34#endif
35
36#ifndef SUBTARGET_CPP_SPEC
37#define SUBTARGET_CPP_SPEC  "-D__ELF__"
38#endif
39
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
46
47#ifndef SUBTARGET_EXTRA_ASM_SPEC
48#define SUBTARGET_EXTRA_ASM_SPEC ""
49#endif
50
51#ifndef SUBTARGET_ASM_FLOAT_SPEC
52#define SUBTARGET_ASM_FLOAT_SPEC "\
53%{mapcs-float:-mfloat}"
54#endif
55
56#undef SUBSUBTARGET_EXTRA_SPECS
57#define SUBSUBTARGET_EXTRA_SPECS
58
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
70
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"
75
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)
88
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)
99
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)))
108
109#ifndef LINK_SPEC
110#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
111#endif
112
113/* Run-time Target Specification.  */
114#ifndef TARGET_DEFAULT
115#define TARGET_DEFAULT (MASK_APCS_FRAME)
116#endif
117
118#ifndef MULTILIB_DEFAULTS
119#define MULTILIB_DEFAULTS \
120  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
121#endif
122
123#define TARGET_ASM_FILE_START_APP_OFF true
124#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
125
126
127/* Output an element in the static constructor array.  */
128#undef TARGET_ASM_CONSTRUCTOR
129#define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
130
131#undef TARGET_ASM_DESTRUCTOR
132#define TARGET_ASM_DESTRUCTOR arm_elf_asm_destructor
133
134/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
135#define NEED_PLT_RELOC	flag_pic
136#define NEED_GOT_RELOC	flag_pic
137
138/* The ELF assembler handles GOT addressing differently to NetBSD.  */
139#define GOT_PCREL	0
140
141/* Align output to a power of two.  Note ".align 0" is redundant,
142   and also GAS will treat it as ".align 2" which we do not want.  */
143#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
144  do							\
145    {							\
146      if ((POWER) > 0)					\
147	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
148    }							\
149  while (0)
150
151/* Horrible hack: We want to prevent some libgcc routines being included
152   for some multilibs.  */
153#ifndef __ARM_ARCH_6M__
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
164
165