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 /* The ARM development system defines __main. */
103 #define NAME__MAIN "__gccmain"
104 #define SYMBOL__MAIN __gccmain
106 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
107 #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
108 #define UNIQUE_SECTION(DECL,RELOC) \
112 char * name, * string, * prefix; \
114 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
116 if (! DECL_ONE_ONLY (DECL)) \
119 if (TREE_CODE (DECL) == FUNCTION_DECL) \
121 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
122 prefix = ".rodata."; \
126 else if (TREE_CODE (DECL) == FUNCTION_DECL) \
127 prefix = ".gnu.linkonce.t."; \
128 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
129 prefix = ".gnu.linkonce.r."; \
131 prefix = ".gnu.linkonce.d."; \
133 len = strlen (name) + strlen (prefix); \
134 string = alloca (len + 1); \
135 sprintf (string, "%s%s", prefix, name); \
137 DECL_SECTION_NAME (DECL) = build_string (len, string); \
141 #ifndef CPP_APCS_PC_DEFAULT_SPEC
142 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
145 #ifndef SUBTARGET_CPU_DEFAULT
146 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi
149 #define CPP_PREDEFINES \
150 "-D__arm__ -D__CONIX__ -Acpu=arm -Amachine=arm -D__ELF__"
152 /* Now get the routine arm-elf definitions. */