1/* Definitions for non-Linux based ARM systems using ELF 2 Copyright (C) 1998 Free Software Foundation, Inc. 3 Contributed by Catherine Moore <clm@cygnus.com> 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. 11 12GNU CC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with this program; see the file COPYING. If not, write to 19the Free Software Foundation, 59 Temple Place - Suite 330, 20Boston, MA 02111-1307, USA. */ 21 22/* Run-time Target Specification. */ 23#ifndef TARGET_VERSION 24#define TARGET_VERSION fputs (" (ARM/ELF non-Linux)", stderr); 25#endif 26 27/* If you don't define HAVE_ATEXIT, and the object file format/OS/whatever 28 does not support constructors/destructors, then gcc implements destructors 29 by defining its own exit function, which calls the destructors. This gcc 30 exit function overrides the C library's exit function, and this can cause 31 all kinds of havoc if the C library has a non-trivial exit function. You 32 really don't want to use the exit function in libgcc2.c. */ 33#define HAVE_ATEXIT 34 35/* Default to using APCS-32 and software floating point. */ 36#ifndef TARGET_DEFAULT 37#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) 38#endif 39 40/* Now we define the strings used to build the spec file. */ 41#define STARTFILE_SPEC "crtbegin%O%s crt0%O%s" 42 43#define ENDFILE_SPEC "crtend%O%s" 44 45#define USER_LABEL_PREFIX "" 46#define LOCAL_LABEL_PREFIX "." 47 48#define TEXT_SECTION " .text" 49 50#define INVOKE__main 51 52/* Debugging */ 53#define DWARF_DEBUGGING_INFO 54#define DWARF2_DEBUGGING_INFO 55#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 56 57/* Support for Constructors and Destrcutors . */ 58#define READONLY_DATA_SECTION rdata_section 59 60/* A list of other sections which the compiler might be "in" at any 61 given time. */ 62#define SUBTARGET_EXTRA_SECTIONS in_rdata, 63 64/* A list of extra section function definitions. */ 65#define SUBTARGET_EXTRA_SECTION_FUNCTIONS RDATA_SECTION_FUNCTION 66 67#define RDATA_SECTION_ASM_OP "\t.section .rodata" 68 69#define RDATA_SECTION_FUNCTION \ 70void \ 71rdata_section () \ 72{ \ 73 if (in_section != in_rdata) \ 74 { \ 75 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ 76 in_section = in_rdata; \ 77 } \ 78} 79 80#define CTOR_LIST_BEGIN \ 81asm (CTORS_SECTION_ASM_OP); \ 82func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) } 83 84#define CTOR_LIST_END \ 85asm (CTORS_SECTION_ASM_OP); \ 86func_ptr __CTOR_END__[1] = { (func_ptr) 0 }; 87 88#define DTOR_LIST_BEGIN \ 89asm (DTORS_SECTION_ASM_OP); \ 90func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) } 91 92#define DTOR_LIST_END \ 93asm (DTORS_SECTION_ASM_OP); \ 94func_ptr __DTOR_END__[1] = { (func_ptr) 0 }; 95 96/* A C statement to output something to the assembler file to switch to section 97 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 98 NULL_TREE. Some target formats do not support arbitrary sections. Do not 99 define this macro in such cases. */ 100#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ 101do { \ 102 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 103 fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ 104 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ 105 fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \ 106 else \ 107 fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \ 108} while (0) 109 110/* Don't know how to order these. UNALIGNED_WORD_ASM_OP is in 111 dwarf2.out. */ 112#define UNALIGNED_WORD_ASM_OP ".4byte" 113 114#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \ 115 fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, ADDR) 116 117#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \ 118do { \ 119 fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \ 120 output_addr_const ((FILE), (RTX)); \ 121 fputc ('\n', (FILE)); \ 122} while (0) 123 124 125/* The ARM development system defines __main. */ 126#define NAME__MAIN "__gccmain" 127#define SYMBOL__MAIN __gccmain 128 129#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) 130#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) 131#define UNIQUE_SECTION(DECL,RELOC) \ 132do { \ 133 int len; \ 134 char * name, * string, * prefix; \ 135 \ 136 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ 137 \ 138 if (! DECL_ONE_ONLY (DECL)) \ 139 { \ 140 prefix = "."; \ 141 if (TREE_CODE (DECL) == FUNCTION_DECL) \ 142 prefix = ".text."; \ 143 else if (DECL_READONLY_SECTION (DECL, RELOC)) \ 144 prefix = ".rodata."; \ 145 else \ 146 prefix = ".data."; \ 147 } \ 148 else if (TREE_CODE (DECL) == FUNCTION_DECL) \ 149 prefix = ".gnu.linkonce.t."; \ 150 else if (DECL_READONLY_SECTION (DECL, RELOC)) \ 151 prefix = ".gnu.linkonce.r."; \ 152 else \ 153 prefix = ".gnu.linkonce.d."; \ 154 \ 155 len = strlen (name) + strlen (prefix); \ 156 string = alloca (len + 1); \ 157 sprintf (string, "%s%s", prefix, name); \ 158 \ 159 DECL_SECTION_NAME (DECL) = build_string (len, string); \ 160} while (0) 161 162#ifndef CPP_APCS_PC_DEFAULT_SPEC 163#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" 164#endif 165 166#ifndef SUBTARGET_CPU_DEFAULT 167#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi 168#endif 169 170/* Now get the routine arm-elf definitions. */ 171#include "arm/elf.h" 172