elf.h revision 169689
144743Smarkm/* Definitions of target machine for GNU compiler.
244743Smarkm   For ARM with ELF obj format.
344743Smarkm   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
444743Smarkm   Free Software Foundation, Inc.
544743Smarkm   Contributed by Philip Blundell <philb@gnu.org> and
644743Smarkm   Catherine Moore <clm@cygnus.com>
744743Smarkm
844743Smarkm   This file is part of GCC.
944743Smarkm
1044743Smarkm   GCC is free software; you can redistribute it and/or modify it
1144743Smarkm   under the terms of the GNU General Public License as published
1244743Smarkm   by the Free Software Foundation; either version 2, or (at your
1344743Smarkm   option) any later version.
1444743Smarkm
1544743Smarkm   GCC is distributed in the hope that it will be useful, but WITHOUT
1644743Smarkm   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1744743Smarkm   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1851495Ssheldonh   License for more details.
1951495Ssheldonh
2044743Smarkm   You should have received a copy of the GNU General Public License
2144743Smarkm   along with GCC; see the file COPYING.  If not, write to
2244743Smarkm   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2344743Smarkm   Boston, MA 02110-1301, USA.  */
2444743Smarkm
2544743Smarkm#ifndef OBJECT_FORMAT_ELF
2644743Smarkm #error elf.h included before elfos.h
2744743Smarkm#endif
2844743Smarkm
2956977Sshin#ifndef LOCAL_LABEL_PREFIX
3056977Sshin#define LOCAL_LABEL_PREFIX "."
3156977Sshin#endif
3244743Smarkm
3356977Sshin#ifndef SUBTARGET_CPP_SPEC
3456977Sshin#define SUBTARGET_CPP_SPEC  "-D__ELF__"
3556977Sshin#endif
3644743Smarkm
3744743Smarkm#ifndef SUBTARGET_EXTRA_SPECS
3844743Smarkm#define SUBTARGET_EXTRA_SPECS \
3944743Smarkm  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
4044743Smarkm  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC },
4144743Smarkm#endif
4244743Smarkm
4344743Smarkm#ifndef SUBTARGET_EXTRA_ASM_SPEC
4444743Smarkm#define SUBTARGET_EXTRA_ASM_SPEC ""
4544743Smarkm#endif
4644743Smarkm
4744743Smarkm#ifndef SUBTARGET_ASM_FLOAT_SPEC
4844743Smarkm#define SUBTARGET_ASM_FLOAT_SPEC "\
4944743Smarkm%{mapcs-float:-mfloat}"
5044743Smarkm#endif
5144743Smarkm
5244743Smarkm#ifndef ASM_SPEC
5344743Smarkm#define ASM_SPEC "\
5444743Smarkm%{mbig-endian:-EB} \
5544743Smarkm%{mlittle-endian:-EL} \
5644743Smarkm%{mcpu=*:-mcpu=%*} \
5744743Smarkm%{march=*:-march=%*} \
5844743Smarkm%{mapcs-*:-mapcs-%*} \
5944743Smarkm%(subtarget_asm_float_spec) \
6044743Smarkm%{mthumb-interwork:-mthumb-interwork} \
6144743Smarkm%{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \
6244743Smarkm%{mfloat-abi=*} %{mfpu=*} \
6344743Smarkm%(subtarget_extra_asm_spec)"
6444743Smarkm#endif
6544743Smarkm
6644743Smarkm/* The ARM uses @ are a comment character so we need to redefine
6744743Smarkm   TYPE_OPERAND_FMT.  */
6844743Smarkm#undef  TYPE_OPERAND_FMT
6944743Smarkm#define TYPE_OPERAND_FMT	"%%%s"
7044743Smarkm
7144743Smarkm/* We might need a ARM specific header to function declarations.  */
7244743Smarkm#undef  ASM_DECLARE_FUNCTION_NAME
7344743Smarkm#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
7444743Smarkm  do								\
7544743Smarkm    {								\
7644743Smarkm      ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL);		\
7744743Smarkm      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
7844743Smarkm      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
7944743Smarkm      ASM_OUTPUT_LABEL(FILE, NAME);				\
8044743Smarkm      ARM_OUTPUT_FN_UNWIND (FILE, TRUE);			\
8144743Smarkm    }								\
8244743Smarkm  while (0)
8344743Smarkm
8444743Smarkm/* We might need an ARM specific trailer for function declarations.  */
8544743Smarkm#undef  ASM_DECLARE_FUNCTION_SIZE
8644743Smarkm#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
8744743Smarkm  do								\
8844743Smarkm    {								\
8944743Smarkm      ARM_OUTPUT_FN_UNWIND (FILE, FALSE);			\
9044743Smarkm      ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL);		\
9144743Smarkm      if (!flag_inhibit_size_directive)				\
9244743Smarkm	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
9356977Sshin    }								\
9456977Sshin  while (0)
9556977Sshin
9656977Sshin/* Define this macro if jump tables (for `tablejump' insns) should be
9744743Smarkm   output in the text section, along with the assembler instructions.
9844743Smarkm   Otherwise, the readonly data section is used.  */
9944743Smarkm/* We put ARM jump tables in the text section, because it makes the code
10044743Smarkm   more efficient, but for Thumb it's better to put them out of band.  */
10144743Smarkm#define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
10244743Smarkm
10344743Smarkm#ifndef LINK_SPEC
10444743Smarkm#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
10544743Smarkm#endif
10644743Smarkm
10744743Smarkm/* Run-time Target Specification.  */
10844743Smarkm#ifndef TARGET_VERSION
10944743Smarkm#define TARGET_VERSION fputs (" (ARM/elf)", stderr)
11044743Smarkm#endif
11144743Smarkm
11244743Smarkm#ifndef TARGET_DEFAULT
11344743Smarkm#define TARGET_DEFAULT (MASK_APCS_FRAME)
11444743Smarkm#endif
11544743Smarkm
11644743Smarkm#ifndef MULTILIB_DEFAULTS
11744743Smarkm#define MULTILIB_DEFAULTS \
11844743Smarkm  { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork", "fno-leading-underscore" }
11944743Smarkm#endif
12044743Smarkm
12144743Smarkm#define TARGET_ASM_FILE_START_APP_OFF true
12244743Smarkm#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
12344743Smarkm
12444743Smarkm
12544743Smarkm/* Output an element in the static constructor array.  */
12644743Smarkm#undef TARGET_ASM_CONSTRUCTOR
12744743Smarkm#define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor
12844743Smarkm
12944743Smarkm/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
13044743Smarkm#define NEED_PLT_RELOC	flag_pic
13144743Smarkm#define NEED_GOT_RELOC	flag_pic
13244743Smarkm
13344743Smarkm/* The ELF assembler handles GOT addressing differently to NetBSD.  */
13444743Smarkm#define GOT_PCREL	0
13544743Smarkm
13644743Smarkm/* Biggest alignment supported by the object file format of this
13744743Smarkm   machine.  Use this macro to limit the alignment which can be
13844743Smarkm   specified using the `__attribute__ ((aligned (N)))' construct.  If
13944743Smarkm   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
14044743Smarkm#define MAX_OFILE_ALIGNMENT (32768 * 8)
14144743Smarkm
14244743Smarkm/* Align output to a power of two.  Note ".align 0" is redundant,
14344743Smarkm   and also GAS will treat it as ".align 2" which we do not want.  */
14444743Smarkm#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
14544743Smarkm  do							\
14644743Smarkm    {							\
14744743Smarkm      if ((POWER) > 0)					\
14844743Smarkm	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
14944743Smarkm    }							\
15044743Smarkm  while (0)
15144743Smarkm
15244743Smarkm/* The EABI doesn't provide a way of implementing init_priority.  */
15344743Smarkm#define SUPPORTS_INIT_PRIORITY (!TARGET_AAPCS_BASED)
15444743Smarkm