1 /* Definitions of target machine for GNU compiler,
3 Copyright (C) 2000 Free Software Foundation, Inc.
4 Contributed by Philip Blundell <pb@futuretv.com>
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Run-time Target Specification. */
24 #ifndef TARGET_VERSION
25 #define TARGET_VERSION fputs (" (ARM/ELF ConiX)", stderr);
28 /* Default to using APCS-32 and software floating point. */
29 #ifndef TARGET_DEFAULT
30 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
33 /* Now we define the strings used to build the spec file. */
34 #define STARTFILE_SPEC "crtbegin%O%s crt0%O%s"
36 #define ENDFILE_SPEC "crtend%O%s"
38 #define USER_LABEL_PREFIX ""
39 #define LOCAL_LABEL_PREFIX "."
41 #define TEXT_SECTION "\t.text"
44 #define DWARF2_DEBUGGING_INFO
45 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
47 /* Support for Constructors and Destructors. */
48 #define READONLY_DATA_SECTION rdata_section
50 /* A list of other sections which the compiler might be "in" at any
52 #define SUBTARGET_EXTRA_SECTIONS in_rdata,
54 /* A list of extra section function definitions. */
55 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS RDATA_SECTION_FUNCTION
57 #define RDATA_SECTION_ASM_OP "\t.section .rodata"
59 #define RDATA_SECTION_FUNCTION \
63 if (in_section != in_rdata) \
65 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
66 in_section = in_rdata; \
70 #define CTOR_LIST_BEGIN \
71 asm (CTORS_SECTION_ASM_OP); \
72 func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
74 #define CTOR_LIST_END \
75 asm (CTORS_SECTION_ASM_OP); \
76 func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
78 #define DTOR_LIST_BEGIN \
79 asm (DTORS_SECTION_ASM_OP); \
80 func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
82 #define DTOR_LIST_END \
83 asm (DTORS_SECTION_ASM_OP); \
84 func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
86 /* A C statement to output something to the assembler file to switch to section
87 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
88 NULL_TREE. Some target formats do not support arbitrary sections. Do not
89 define this macro in such cases. */
90 #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
93 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
94 fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
95 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
96 fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \
98 fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \
102 /* Don't know how to order these. UNALIGNED_WORD_ASM_OP is in
104 #define UNALIGNED_WORD_ASM_OP "\t.4byte\t"
106 #define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
107 fprintf ((FILE), "%s%s", UNALIGNED_WORD_ASM_OP, ADDR)
109 #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
112 fprintf ((FILE), "%s", UNALIGNED_WORD_ASM_OP); \
113 output_addr_const ((FILE), (RTX)); \
114 fputc ('\n', (FILE)); \
119 /* The ARM development system defines __main. */
120 #define NAME__MAIN "__gccmain"
121 #define SYMBOL__MAIN __gccmain
123 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
124 #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
125 #define UNIQUE_SECTION(DECL,RELOC) \
129 char * name, * string, * prefix; \
131 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
133 if (! DECL_ONE_ONLY (DECL)) \
136 if (TREE_CODE (DECL) == FUNCTION_DECL) \
138 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
139 prefix = ".rodata."; \
143 else if (TREE_CODE (DECL) == FUNCTION_DECL) \
144 prefix = ".gnu.linkonce.t."; \
145 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
146 prefix = ".gnu.linkonce.r."; \
148 prefix = ".gnu.linkonce.d."; \
150 len = strlen (name) + strlen (prefix); \
151 string = alloca (len + 1); \
152 sprintf (string, "%s%s", prefix, name); \
154 DECL_SECTION_NAME (DECL) = build_string (len, string); \
158 #ifndef CPP_APCS_PC_DEFAULT_SPEC
159 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
162 #ifndef SUBTARGET_CPU_DEFAULT
163 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi
166 #define CPP_PREDEFINES \
167 "-D__arm__ -D__CONIX__ -Acpu=arm -Amachine=arm -D__ELF__"
169 /* Now get the routine arm-elf definitions. */