elf.h revision 132718
190075Sobrien/* Definitions of target machine for GNU compiler.
290075Sobrien   For ARM with ELF obj format.
390075Sobrien   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
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
22132718Skan   the Free Software Foundation, 59 Temple Place - Suite 330,
23132718Skan   Boston, MA 02111-1307, 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 "\
49132718Skan%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
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} \
6190075Sobrien%(subtarget_extra_asm_spec)"
6290075Sobrien#endif
6390075Sobrien
6490075Sobrien/* The ARM uses @ are a comment character so we need to redefine
6590075Sobrien   TYPE_OPERAND_FMT.  */
6690075Sobrien#undef  TYPE_OPERAND_FMT
67117395Skan#define TYPE_OPERAND_FMT	"%%%s"
6890075Sobrien
6990075Sobrien/* We might need a ARM specific header to function declarations.  */
7090075Sobrien#undef  ASM_DECLARE_FUNCTION_NAME
71117395Skan#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
72117395Skan  do								\
73117395Skan    {								\
74117395Skan      ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL);		\
75117395Skan      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
76117395Skan      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
77117395Skan      ASM_OUTPUT_LABEL(FILE, NAME);				\
78117395Skan    }								\
7990075Sobrien  while (0)
8090075Sobrien
8190075Sobrien/* We might need an ARM specific trailer for function declarations.  */
8290075Sobrien#undef  ASM_DECLARE_FUNCTION_SIZE
8390075Sobrien#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
8490075Sobrien  do								\
8590075Sobrien    {								\
8690075Sobrien      ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL);		\
8790075Sobrien      if (!flag_inhibit_size_directive)				\
88117395Skan	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
8990075Sobrien    }								\
9090075Sobrien  while (0)
9190075Sobrien
9290075Sobrien/* Define this macro if jump tables (for `tablejump' insns) should be
9390075Sobrien   output in the text section, along with the assembler instructions.
9490075Sobrien   Otherwise, the readonly data section is used.  */
9596263Sobrien/* We put ARM jump tables in the text section, because it makes the code
9696263Sobrien   more efficient, but for Thumb it's better to put them out of band.  */
9796263Sobrien#define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
9890075Sobrien
9990075Sobrien#ifndef LINK_SPEC
100117395Skan#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
10190075Sobrien#endif
10290075Sobrien
10390075Sobrien/* Run-time Target Specification.  */
10490075Sobrien#ifndef TARGET_VERSION
10590075Sobrien#define TARGET_VERSION fputs (" (ARM/elf)", stderr)
10690075Sobrien#endif
10790075Sobrien
10890075Sobrien#ifndef TARGET_DEFAULT
109132718Skan#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
11090075Sobrien#endif
11190075Sobrien
11290075Sobrien#ifndef MULTILIB_DEFAULTS
11390075Sobrien#define MULTILIB_DEFAULTS \
11490075Sobrien  { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
11590075Sobrien#endif
11690075Sobrien
117132718Skan#define TARGET_ASM_FILE_START_APP_OFF true
118132718Skan#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
11990075Sobrien
12090075Sobrien#undef  TARGET_ASM_NAMED_SECTION
12190075Sobrien#define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
12290075Sobrien
12390075Sobrien
12490075Sobrien/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
12590075Sobrien#define NEED_PLT_RELOC	flag_pic
12690075Sobrien#define NEED_GOT_RELOC	flag_pic
12790075Sobrien
12890075Sobrien/* The ELF assembler handles GOT addressing differently to NetBSD.  */
12990075Sobrien#define GOT_PCREL	0
13090075Sobrien
13190075Sobrien/* Biggest alignment supported by the object file format of this
13290075Sobrien   machine.  Use this macro to limit the alignment which can be
13390075Sobrien   specified using the `__attribute__ ((aligned (N)))' construct.  If
13490075Sobrien   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
13590075Sobrien#define MAX_OFILE_ALIGNMENT (32768 * 8)
13690075Sobrien
13790075Sobrien/* Align output to a power of two.  Note ".align 0" is redundant,
13890075Sobrien   and also GAS will treat it as ".align 2" which we do not want.  */
13990075Sobrien#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
14090075Sobrien  do							\
14190075Sobrien    {							\
14290075Sobrien      if ((POWER) > 0)					\
14390075Sobrien	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
14490075Sobrien    }							\
14590075Sobrien  while (0)
14690075Sobrien
14790075Sobrien#define SUPPORTS_INIT_PRIORITY 1
148