1/* Definitions of target machine for GNU compiler, 2 for Thumb with COFF obj format. 3 Copyright (C) 1995, 1996 Free Software Foundation, Inc. 4 Derived from arm/coff.h originally by Doug Evans (dje@cygnus.com). 5 6This file is part of GNU CC. 7 8GNU CC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 2, or (at your option) 11any later version. 12 13GNU CC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with GNU CC; see the file COPYING. If not, write to 20the Free Software Foundation, 59 Temple Place - Suite 330, 21Boston, MA 02111-1307, USA. */ 22 23#include "arm/thumb.h" 24 25/* Run-time Target Specification. */ 26#undef TARGET_VERSION 27#define TARGET_VERSION fputs (" (Thumb/coff)", stderr) 28 29#define MULTILIB_DEFAULTS { "mlittle-endian" } 30 31/* Setting this to 32 produces more efficient code, but the value set in previous 32 versions of this toolchain was 8, which produces more compact structures. The 33 command line option -mstructure_size_boundary=<n> can be used to change this 34 value. */ 35#undef STRUCTURE_SIZE_BOUNDARY 36#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary 37 38extern int arm_structure_size_boundary; 39 40/* This is COFF, but prefer stabs. */ 41#define SDB_DEBUGGING_INFO 42 43#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 44 45#include "dbxcoff.h" 46 47/* Note - it is important that these definitions match those in semi.h for the ARM port. */ 48#undef LOCAL_LABEL_PREFIX 49#define LOCAL_LABEL_PREFIX "." 50 51#undef USER_LABEL_PREFIX 52#define USER_LABEL_PREFIX "" 53 54/* A C statement to output assembler commands which will identify the 55 object file as having been compiled with GNU CC (or another GNU 56 compiler). */ 57#define ASM_IDENTIFY_GCC(STREAM) \ 58 fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX ) 59 60#undef ASM_FILE_START 61#define ASM_FILE_START(STREAM) \ 62do { \ 63 extern char *version_string; \ 64 fprintf ((STREAM), "%s Generated by gcc %s for Thumb/coff\n", \ 65 ASM_COMMENT_START, version_string); \ 66 fprintf ((STREAM), ASM_APP_OFF); \ 67} while (0) 68 69/* A C statement to output something to the assembler file to switch to section 70 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 71 NULL_TREE. Some target formats do not support arbitrary sections. Do not 72 define this macro in such cases. */ 73#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ 74do { \ 75 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 76 fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \ 77 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ 78 fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \ 79 else \ 80 fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \ 81} while (0) 82 83/* Support the ctors/dtors and other sections. */ 84 85#undef INIT_SECTION_ASM_OP 86 87/* Define this macro if jump tables (for `tablejump' insns) should be 88 output in the text section, along with the assembler instructions. 89 Otherwise, the readonly data section is used. */ 90#define JUMP_TABLES_IN_TEXT_SECTION 1 91 92#undef READONLY_DATA_SECTION 93#define READONLY_DATA_SECTION rdata_section 94#undef RDATA_SECTION_ASM_OP 95#define RDATA_SECTION_ASM_OP "\t.section .rdata" 96 97#undef CTORS_SECTION_ASM_OP 98#define CTORS_SECTION_ASM_OP "\t.section .ctors,\"x\"" 99#undef DTORS_SECTION_ASM_OP 100#define DTORS_SECTION_ASM_OP "\t.section .dtors,\"x\"" 101 102/* A list of other sections which the compiler might be "in" at any 103 given time. */ 104 105#undef EXTRA_SECTIONS 106#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors 107 108#define SUBTARGET_EXTRA_SECTIONS 109 110/* A list of extra section function definitions. */ 111 112#undef EXTRA_SECTION_FUNCTIONS 113#define EXTRA_SECTION_FUNCTIONS \ 114 RDATA_SECTION_FUNCTION \ 115 CTORS_SECTION_FUNCTION \ 116 DTORS_SECTION_FUNCTION \ 117 SUBTARGET_EXTRA_SECTION_FUNCTIONS 118 119#define SUBTARGET_EXTRA_SECTION_FUNCTIONS 120 121#define RDATA_SECTION_FUNCTION \ 122void \ 123rdata_section () \ 124{ \ 125 if (in_section != in_rdata) \ 126 { \ 127 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ 128 in_section = in_rdata; \ 129 } \ 130} 131 132#define CTORS_SECTION_FUNCTION \ 133void \ 134ctors_section () \ 135{ \ 136 if (in_section != in_ctors) \ 137 { \ 138 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ 139 in_section = in_ctors; \ 140 } \ 141} 142 143#define DTORS_SECTION_FUNCTION \ 144void \ 145dtors_section () \ 146{ \ 147 if (in_section != in_dtors) \ 148 { \ 149 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ 150 in_section = in_dtors; \ 151 } \ 152} 153 154/* Support the ctors/dtors sections for g++. */ 155 156#define INT_ASM_OP ".word" 157 158/* A C statement (sans semicolon) to output an element in the table of 159 global constructors. */ 160#undef ASM_OUTPUT_CONSTRUCTOR 161#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ 162do { \ 163 ctors_section (); \ 164 fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ 165 assemble_name (STREAM, NAME); \ 166 fprintf (STREAM, "\n"); \ 167} while (0) 168 169/* A C statement (sans semicolon) to output an element in the table of 170 global destructors. */ 171#undef ASM_OUTPUT_DESTRUCTOR 172#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ 173do { \ 174 dtors_section (); \ 175 fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ 176 assemble_name (STREAM, NAME); \ 177 fprintf (STREAM, "\n"); \ 178} while (0) 179 180/* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */ 181#define CTOR_LISTS_DEFINED_EXTERNALLY 182 183#undef DO_GLOBAL_CTORS_BODY 184#undef DO_GLOBAL_DTORS_BODY 185 186/* The ARM development system has atexit and doesn't have _exit, 187 so define this for now. */ 188#define HAVE_ATEXIT 189 190/* The ARM development system defines __main. */ 191#define NAME__MAIN "__gccmain" 192#define SYMBOL__MAIN __gccmain 193