190075Sobrien/* Definitions of target machine for GNU compiler.
290075Sobrien   For ARM with ELF obj format.
3169689Skan   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
490075Sobrien   Free Software Foundation, Inc.
590075Sobrien   Contributed by Philip Blundell <philb@gnu.org> and
690075Sobrien   Catherine Moore <clm@cygnus.com>
790075Sobrien
8132718Skan   This file is part of GCC.
990075Sobrien
10132718Skan   GCC is free software; you can redistribute it and/or modify it
11132718Skan   under the terms of the GNU General Public License as published
12132718Skan   by the Free Software Foundation; either version 2, or (at your
13132718Skan   option) any later version.
1490075Sobrien
15132718Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
16132718Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17132718Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
18132718Skan   License for more details.
1990075Sobrien
20132718Skan   You should have received a copy of the GNU General Public License
21132718Skan   along with GCC; see the file COPYING.  If not, write to
22169689Skan   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23169689Skan   Boston, MA 02110-1301, USA.  */
2490075Sobrien
2590075Sobrien#ifndef OBJECT_FORMAT_ELF
2690075Sobrien #error elf.h included before elfos.h
2790075Sobrien#endif
2890075Sobrien
2990075Sobrien#ifndef LOCAL_LABEL_PREFIX
3090075Sobrien#define LOCAL_LABEL_PREFIX "."
3190075Sobrien#endif
3290075Sobrien
3390075Sobrien#ifndef SUBTARGET_CPP_SPEC
3490075Sobrien#define SUBTARGET_CPP_SPEC  "-D__ELF__"
3590075Sobrien#endif
3690075Sobrien
3790075Sobrien#ifndef SUBTARGET_EXTRA_SPECS
3890075Sobrien#define SUBTARGET_EXTRA_SPECS \
39117395Skan  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
40117395Skan  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC },
4190075Sobrien#endif
4290075Sobrien
4390075Sobrien#ifndef SUBTARGET_EXTRA_ASM_SPEC
4490075Sobrien#define SUBTARGET_EXTRA_ASM_SPEC ""
4590075Sobrien#endif
4690075Sobrien
47117395Skan#ifndef SUBTARGET_ASM_FLOAT_SPEC
48117395Skan#define SUBTARGET_ASM_FLOAT_SPEC "\
49169689Skan%{mapcs-float:-mfloat}"
50117395Skan#endif
51117395Skan
5290075Sobrien#ifndef ASM_SPEC
5390075Sobrien#define ASM_SPEC "\
5490075Sobrien%{mbig-endian:-EB} \
55117395Skan%{mlittle-endian:-EL} \
56117395Skan%{mcpu=*:-mcpu=%*} \
57117395Skan%{march=*:-march=%*} \
5890075Sobrien%{mapcs-*:-mapcs-%*} \
59117395Skan%(subtarget_asm_float_spec) \
6090075Sobrien%{mthumb-interwork:-mthumb-interwork} \
61169689Skan%{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \
62169689Skan%{mfloat-abi=*} %{mfpu=*} \
6390075Sobrien%(subtarget_extra_asm_spec)"
6490075Sobrien#endif
6590075Sobrien
6690075Sobrien/* The ARM uses @ are a comment character so we need to redefine
6790075Sobrien   TYPE_OPERAND_FMT.  */
6890075Sobrien#undef  TYPE_OPERAND_FMT
69117395Skan#define TYPE_OPERAND_FMT	"%%%s"
7090075Sobrien
7190075Sobrien/* We might need a ARM specific header to function declarations.  */
7290075Sobrien#undef  ASM_DECLARE_FUNCTION_NAME
73117395Skan#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
74117395Skan  do								\
75117395Skan    {								\
76117395Skan      ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL);		\
77117395Skan      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
78117395Skan      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
79117395Skan      ASM_OUTPUT_LABEL(FILE, NAME);				\
80169689Skan      ARM_OUTPUT_FN_UNWIND (FILE, TRUE);			\
81117395Skan    }								\
8290075Sobrien  while (0)
8390075Sobrien
8490075Sobrien/* We might need an ARM specific trailer for function declarations.  */
8590075Sobrien#undef  ASM_DECLARE_FUNCTION_SIZE
8690075Sobrien#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
8790075Sobrien  do								\
8890075Sobrien    {								\
89169689Skan      ARM_OUTPUT_FN_UNWIND (FILE, FALSE);			\
9090075Sobrien      ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL);		\
9190075Sobrien      if (!flag_inhibit_size_directive)				\
92117395Skan	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
9390075Sobrien    }								\
9490075Sobrien  while (0)
9590075Sobrien
9690075Sobrien/* Define this macro if jump tables (for `tablejump' insns) should be
9790075Sobrien   output in the text section, along with the assembler instructions.
9890075Sobrien   Otherwise, the readonly data section is used.  */
9996263Sobrien/* We put ARM jump tables in the text section, because it makes the code
10096263Sobrien   more efficient, but for Thumb it's better to put them out of band.  */
10196263Sobrien#define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
10290075Sobrien
10390075Sobrien#ifndef LINK_SPEC
104117395Skan#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
10590075Sobrien#endif
10690075Sobrien
10790075Sobrien/* Run-time Target Specification.  */
10890075Sobrien#ifndef TARGET_VERSION
10990075Sobrien#define TARGET_VERSION fputs (" (ARM/elf)", stderr)
11090075Sobrien#endif
11190075Sobrien
11290075Sobrien#ifndef TARGET_DEFAULT
113169689Skan#define TARGET_DEFAULT (MASK_APCS_FRAME)
11490075Sobrien#endif
11590075Sobrien
11690075Sobrien#ifndef MULTILIB_DEFAULTS
11790075Sobrien#define MULTILIB_DEFAULTS \
118169689Skan  { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork", "fno-leading-underscore" }
11990075Sobrien#endif
12090075Sobrien
121132718Skan#define TARGET_ASM_FILE_START_APP_OFF true
122132718Skan#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
12390075Sobrien
12490075Sobrien
125169689Skan/* Output an element in the static constructor array.  */
126169689Skan#undef TARGET_ASM_CONSTRUCTOR
127169689Skan#define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
128169689Skan
12990075Sobrien/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
13090075Sobrien#define NEED_PLT_RELOC	flag_pic
13190075Sobrien#define NEED_GOT_RELOC	flag_pic
13290075Sobrien
13390075Sobrien/* The ELF assembler handles GOT addressing differently to NetBSD.  */
13490075Sobrien#define GOT_PCREL	0
13590075Sobrien
13690075Sobrien/* Biggest alignment supported by the object file format of this
13790075Sobrien   machine.  Use this macro to limit the alignment which can be
13890075Sobrien   specified using the `__attribute__ ((aligned (N)))' construct.  If
13990075Sobrien   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
14090075Sobrien#define MAX_OFILE_ALIGNMENT (32768 * 8)
14190075Sobrien
14290075Sobrien/* Align output to a power of two.  Note ".align 0" is redundant,
14390075Sobrien   and also GAS will treat it as ".align 2" which we do not want.  */
14490075Sobrien#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
14590075Sobrien  do							\
14690075Sobrien    {							\
14790075Sobrien      if ((POWER) > 0)					\
14890075Sobrien	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
14990075Sobrien    }							\
15090075Sobrien  while (0)
15190075Sobrien
152169689Skan/* The EABI doesn't provide a way of implementing init_priority.  */
153169689Skan#define SUPPORTS_INIT_PRIORITY (!TARGET_AAPCS_BASED)
154