elf.h 4.91 KB
Newer Older
1 2
/* Definitions of target machine for GNU compiler.
   For ARM with ELF obj format.
3
   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2007,
4
   2008, 2009, 2011 Free Software Foundation, Inc.
5 6 7
   Contributed by Philip Blundell <philb@gnu.org> and
   Catherine Moore <clm@cygnus.com>
   
8
   This file is part of GCC.
9

10 11
   GCC is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published
12
   by the Free Software Foundation; either version 3, or (at your
13
   option) any later version.
14

15 16 17 18
   GCC is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.
19

20
   You should have received a copy of the GNU General Public License
21 22
   along with GCC; see the file COPYING3.  If not see
   <http://www.gnu.org/licenses/>.  */
23

nickc's avatar
nickc committed
24 25 26
#ifndef OBJECT_FORMAT_ELF
 #error elf.h included before elfos.h
#endif
27 28 29 30 31

#ifndef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX "."
#endif

nickc's avatar
nickc committed
32
#ifndef SUBTARGET_CPP_SPEC
nickc's avatar
nickc committed
33
#define SUBTARGET_CPP_SPEC  "-D__ELF__"
34 35
#endif

36 37
#ifndef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
38
  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
39 40
  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
  SUBSUBTARGET_EXTRA_SPECS
41 42
#endif

43
#ifndef SUBTARGET_EXTRA_ASM_SPEC
44
#define SUBTARGET_EXTRA_ASM_SPEC ""
45 46
#endif

47 48
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
pbrook's avatar
pbrook committed
49
%{mapcs-float:-mfloat}"
50 51
#endif

52 53 54
#undef SUBSUBTARGET_EXTRA_SPECS
#define SUBSUBTARGET_EXTRA_SPECS

55 56 57
#ifndef ASM_SPEC
#define ASM_SPEC "\
%{mbig-endian:-EB} \
58
%{mlittle-endian:-EL} \
59 60
%{mcpu=*:-mcpu=%*} \
%{march=*:-march=%*} \
61
%{mapcs-*:-mapcs-%*} \
62
%(subtarget_asm_float_spec) \
63
%{mthumb-interwork:-mthumb-interwork} \
pbrook's avatar
pbrook committed
64
%{mfloat-abi=*} %{mfpu=*} \
65
%(subtarget_extra_asm_spec)"
66 67
#endif

nickc's avatar
nickc committed
68 69 70
/* The ARM uses @ are a comment character so we need to redefine
   TYPE_OPERAND_FMT.  */
#undef  TYPE_OPERAND_FMT
71
#define TYPE_OPERAND_FMT	"%%%s"
72

nickc's avatar
nickc committed
73 74
/* We might need a ARM specific header to function declarations.  */
#undef  ASM_DECLARE_FUNCTION_NAME
75 76 77 78 79 80 81
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
  do								\
    {								\
      ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL);		\
      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
      ASM_OUTPUT_LABEL(FILE, NAME);				\
82
      ARM_OUTPUT_FN_UNWIND (FILE, TRUE);			\
83
    }								\
84
  while (0)
85

nickc's avatar
nickc committed
86 87
/* We might need an ARM specific trailer for function declarations.  */
#undef  ASM_DECLARE_FUNCTION_SIZE
88 89 90
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
  do								\
    {								\
91
      ARM_OUTPUT_FN_UNWIND (FILE, FALSE);			\
92
      if (!flag_inhibit_size_directive)				\
93
	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
94 95
    }								\
  while (0)
96 97 98 99

/* Define this macro if jump tables (for `tablejump' insns) should be
   output in the text section, along with the assembler instructions.
   Otherwise, the readonly data section is used.  */
100 101
/* We put ARM and Thumb-2 jump tables in the text section, because it makes
   the code more efficient, but for Thumb-1 it's better to put them out of
102 103 104
   band unless we are generating compressed tables.  */
#define JUMP_TABLES_IN_TEXT_SECTION					\
   (TARGET_32BIT || (TARGET_THUMB && (optimize_size || flag_pic)))
105 106

#ifndef LINK_SPEC
107
#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
108 109 110 111 112 113 114 115
#endif
  
/* Run-time Target Specification.  */
#ifndef TARGET_VERSION
#define TARGET_VERSION fputs (" (ARM/elf)", stderr)
#endif

#ifndef TARGET_DEFAULT
116
#define TARGET_DEFAULT (MASK_APCS_FRAME)
117 118 119
#endif

#ifndef MULTILIB_DEFAULTS
120
#define MULTILIB_DEFAULTS \
121
  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
122 123
#endif

124 125
#define TARGET_ASM_FILE_START_APP_OFF true
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
126

127

128 129 130 131
/* Output an element in the static constructor array.  */
#undef TARGET_ASM_CONSTRUCTOR
#define TARGET_ASM_CONSTRUCTOR arm_elf_asm_constructor

132 133 134
#undef TARGET_ASM_DESTRUCTOR
#define TARGET_ASM_DESTRUCTOR arm_elf_asm_destructor

135
/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
136 137
#define NEED_PLT_RELOC	flag_pic
#define NEED_GOT_RELOC	flag_pic
138

law's avatar
 
law committed
139 140 141
/* The ELF assembler handles GOT addressing differently to NetBSD.  */
#define GOT_PCREL	0

142 143 144 145 146 147 148 149 150
/* Align output to a power of two.  Note ".align 0" is redundant,
   and also GAS will treat it as ".align 2" which we do not want.  */
#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
  do							\
    {							\
      if ((POWER) > 0)					\
	fprintf (STREAM, "\t.align\t%d\n", POWER);	\
    }							\
  while (0)
nickc's avatar
nickc committed
151

152 153 154 155 156 157 158 159 160 161 162 163 164 165
/* Horrible hack: We want to prevent some libgcc routines being included
   for some multilibs.  */
#ifndef __ARM_ARCH_6M__
#undef L_fixdfsi
#undef L_fixunsdfsi
#undef L_truncdfsf2
#undef L_fixsfsi
#undef L_fixunssfsi
#undef L_floatdidf
#undef L_floatdisf
#undef L_floatundidf
#undef L_floatundisf
#endif