1 /* Target definitions for GNU compiler for Intel 80860 running System V.4
2 Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
3 Contributed by Ron Guilmette (rfg@monkeys.com).
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
25 /* Provide a set of pre-definitions and pre-assertions appropriate for
26 the i860 running svr4. Note that the symbol `__svr4__' MUST BE
27 DEFINED! It is needed so that the va_list struct in va-i860.h
28 will get correctly defined for the svr4 (ABI compliant) case rather
29 than for the previous (svr3, svr2, ...) case. It also needs to be
30 defined so that the correct (svr4) version of __builtin_saveregs
31 will be selected when we are building gnulib2.c.
32 __svr4__ is our extension. */
34 #define CPP_PREDEFINES \
35 "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem=unix -Asystem=svr4 -Acpu=i860 -Amachine=i860"
37 /* For the benefit of i860_va_arg, flag it this way too. */
39 #define I860_SVR4_VA_LIST 1
41 /* The prefix to be used in assembler output for all names of registers.
42 This string gets prepended to all i860 register names (svr4 only). */
44 #define I860_REG_PREFIX "%"
46 #define ASM_COMMENT_START "#"
48 #undef TYPE_OPERAND_FMT
49 #define TYPE_OPERAND_FMT "\"%s\""
51 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
53 /* The following macro definition overrides the one in i860.h
54 because the svr4 i860 assembler requires a different syntax
55 for getting parts of constant/relocatable values. */
57 #undef PRINT_OPERAND_PART
58 #define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
59 do { fprintf (FILE, "["); \
61 fprintf (FILE, "]@%s", PART_CODE); \
64 /* If the host and target formats match, output the floats as hex. */
65 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
66 #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
68 /* This is how to output an assembler line defining a `double' constant.
69 Note that the native i860/svr4 ELF assembler can't properly handle
70 infinity. It generates an incorrect (non-infinity) value when given
71 `.double 99e9999' and it doesn't grok `inf' at all. It also mishandles
74 #undef ASM_OUTPUT_DOUBLE
75 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
77 if (REAL_VALUE_ISINF (VALUE) \
78 || REAL_VALUE_ISNAN (VALUE) \
79 || REAL_VALUE_MINUS_ZERO (VALUE)) \
82 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
83 fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]); \
86 fprintf (FILE, "\t.double %.20e\n", VALUE); \
89 /* This is how to output an assembler line defining a `float' constant.
90 Note that the native i860/svr4 ELF assembler can't properly handle
91 infinity. It actually generates an assembly time error when given
92 `.float 99e9999' and it doesn't grok `inf' at all. It also mishandles
95 #undef ASM_OUTPUT_FLOAT
96 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
98 if (REAL_VALUE_ISINF (VALUE) \
99 || REAL_VALUE_ISNAN (VALUE) \
100 || REAL_VALUE_MINUS_ZERO (VALUE)) \
103 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
104 fprintf (FILE, "\t.word 0x%lx\n", t); \
107 fprintf (FILE, "\t.float %.12e\n", VALUE); \
110 #endif /* word order matches */
111 #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
113 #undef ASM_FILE_START
114 #define ASM_FILE_START(FILE) \
115 do { output_file_directive (FILE, main_input_filename); \
116 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
119 /* Output the special word the svr4 SDB wants to see just before
120 the first word of each function's prologue code. */
122 extern char *current_function_original_name;
124 /* This special macro is used to output a magic word just before the
125 first word of each function. On some versions of UNIX running on
126 the i860, this word can be any word that looks like a NOP, however
127 under svr4, this neds to be an `shr r0,r0,r0' instruction in which
128 the normally unused low-order bits contain the length of the function
129 prologue code (in bytes). This is needed to make the svr4 SDB debugger
132 #undef ASM_OUTPUT_FUNCTION_PREFIX
133 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
134 do { ASM_OUTPUT_ALIGN (FILE, 2); \
135 fprintf ((FILE), "\t.long\t.ep."); \
136 assemble_name (FILE, FNNAME); \
137 fprintf (FILE, "-"); \
138 assemble_name (FILE, FNNAME); \
139 fprintf (FILE, "+0xc8000000\n"); \
140 current_function_original_name = (FNNAME); \
143 /* Output the special label that must go just after each function's
144 prologue code to support svr4 SDB. */
146 #define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE) \
147 do { fprintf (FILE, ".ep."); \
148 assemble_name (FILE, current_function_original_name); \
149 fprintf (FILE, ":\n"); \
152 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
154 Note that we want to give these sections the SHF_WRITE attribute
155 because these sections will actually contain data (i.e. tables of
156 addresses of functions in the current root executable or shared library
157 file) and, in the case of a shared library, the relocatable addresses
158 will have to be properly resolved/relocated (and then written into) by
159 the dynamic linker when it actually attaches the given shared library
160 to the executing process. (Note that on SVR4, you may wish to use the
161 `-z text' option to the ELF linker, when building a shared library, as
162 an additional check that you are doing everything right. But if you do
163 use the `-z text' option when building a shared library, you will get
164 errors unless the .ctors and .dtors sections are marked as writable
165 via the SHF_WRITE attribute.) */
167 #undef CTORS_SECTION_ASM_OP
168 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
169 #undef DTORS_SECTION_ASM_OP
170 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
172 /* Add definitions to support the .tdesc section as specified in the svr4
175 #define TDESC_SECTION_ASM_OP "\t.section\t.tdesc"
177 #undef EXTRA_SECTIONS
178 #define EXTRA_SECTIONS in_const, in_tdesc
180 #undef EXTRA_SECTION_FUNCTIONS
181 #define EXTRA_SECTION_FUNCTIONS \
182 CONST_SECTION_FUNCTION \
183 TDESC_SECTION_FUNCTION
185 #define TDESC_SECTION_FUNCTION \
189 if (in_section != in_tdesc) \
191 fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
192 in_section = in_tdesc; \