elf.h revision 117395
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 890075SobrienThis file is part of GNU CC. 990075Sobrien 1090075SobrienGNU CC is free software; you can redistribute it and/or modify 1190075Sobrienit under the terms of the GNU General Public License as published by 1290075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1390075Sobrienany later version. 1490075Sobrien 1590075SobrienGNU CC is distributed in the hope that it will be useful, 1690075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1790075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1890075SobrienGNU General Public License for more details. 1990075Sobrien 2090075SobrienYou should have received a copy of the GNU General Public License 2190075Sobrienalong with GNU CC; see the file COPYING. If not, write to 2290075Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 2390075SobrienBoston, 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 "\ 49117395Skan%{mapcs-float:-mfloat} %{msoft-float:-mno-fpu}" 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 10990075Sobrien#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME) 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 11790075Sobrien 11890075Sobrien/* This outputs a lot of .req's to define alias for various registers. 11990075Sobrien Let's try to avoid this. */ 12090075Sobrien#ifndef ASM_FILE_START 12190075Sobrien#define ASM_FILE_START(STREAM) \ 12290075Sobrien do \ 12390075Sobrien { \ 12490075Sobrien fprintf (STREAM, "%s Generated by gcc %s for ARM/elf\n", \ 12590075Sobrien ASM_COMMENT_START, version_string); \ 12690075Sobrien output_file_directive (STREAM, main_input_filename); \ 12790075Sobrien fprintf (STREAM, ASM_APP_OFF); \ 12890075Sobrien } \ 12990075Sobrien while (0) 13090075Sobrien#endif 13190075Sobrien 13290075Sobrien/* Output an internal label definition. */ 13390075Sobrien#undef ASM_OUTPUT_INTERNAL_LABEL 13490075Sobrien#define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \ 13590075Sobrien do \ 13690075Sobrien { \ 13790075Sobrien char * s = (char *) alloca (40 + strlen (PREFIX)); \ 13890075Sobrien extern int arm_target_label, arm_ccfsm_state; \ 13990075Sobrien extern rtx arm_target_insn; \ 14090075Sobrien \ 14190075Sobrien if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \ 14290075Sobrien && !strcmp (PREFIX, "L")) \ 14390075Sobrien { \ 14490075Sobrien arm_ccfsm_state = 0; \ 14590075Sobrien arm_target_insn = NULL; \ 14690075Sobrien } \ 14790075Sobrien ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \ 14890075Sobrien ASM_OUTPUT_LABEL (STREAM, s); \ 14990075Sobrien } \ 15090075Sobrien while (0) 15190075Sobrien 15290075Sobrien#undef TARGET_ASM_NAMED_SECTION 15390075Sobrien#define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section 15490075Sobrien 15590075Sobrien#undef ASM_OUTPUT_ALIGNED_COMMON 15690075Sobrien#define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \ 15790075Sobrien do \ 15890075Sobrien { \ 15990075Sobrien fprintf (STREAM, "\t.comm\t"); \ 16090075Sobrien assemble_name (STREAM, NAME); \ 16190075Sobrien fprintf (STREAM, ", %d, %d\n", SIZE, ALIGN); \ 16290075Sobrien } \ 16390075Sobrien while (0) 16490075Sobrien 16590075Sobrien/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs. */ 16690075Sobrien#define NEED_PLT_RELOC flag_pic 16790075Sobrien#define NEED_GOT_RELOC flag_pic 16890075Sobrien 16990075Sobrien/* The ELF assembler handles GOT addressing differently to NetBSD. */ 17090075Sobrien#define GOT_PCREL 0 17190075Sobrien 17290075Sobrien/* Biggest alignment supported by the object file format of this 17390075Sobrien machine. Use this macro to limit the alignment which can be 17490075Sobrien specified using the `__attribute__ ((aligned (N)))' construct. If 17590075Sobrien not defined, the default value is `BIGGEST_ALIGNMENT'. */ 17690075Sobrien#define MAX_OFILE_ALIGNMENT (32768 * 8) 17790075Sobrien 17890075Sobrien/* Align output to a power of two. Note ".align 0" is redundant, 17990075Sobrien and also GAS will treat it as ".align 2" which we do not want. */ 18090075Sobrien#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ 18190075Sobrien do \ 18290075Sobrien { \ 18390075Sobrien if ((POWER) > 0) \ 18490075Sobrien fprintf (STREAM, "\t.align\t%d\n", POWER); \ 18590075Sobrien } \ 18690075Sobrien while (0) 18790075Sobrien 18890075Sobrien#define SUPPORTS_INIT_PRIORITY 1 189