1 /* Target definitions for GNU compiler for Intel 80860 running System V.4
2 Copyright (C) 1991, 1996 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 /* The prefix to be used in assembler output for all names of registers.
38 This string gets prepended to all i860 register names (svr4 only). */
40 #define I860_REG_PREFIX "%"
42 #define ASM_COMMENT_START "#"
44 #undef TYPE_OPERAND_FMT
45 #define TYPE_OPERAND_FMT "\"%s\""
47 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
49 /* The following macro definition overrides the one in i860.h
50 because the svr4 i860 assembler requires a different syntax
51 for getting parts of constant/relocatable values. */
53 #undef PRINT_OPERAND_PART
54 #define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
55 do { fprintf (FILE, "["); \
57 fprintf (FILE, "]@%s", PART_CODE); \
60 /* If the host and target formats match, output the floats as hex. */
61 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
62 #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
64 /* This is how to output an assembler line defining a `double' constant.
65 Note that the native i860/svr4 ELF assembler can't properly handle
66 infinity. It generates an incorrect (non-infinity) value when given
67 `.double 99e9999' and it doesn't grok `inf' at all. It also mishandles
70 #undef ASM_OUTPUT_DOUBLE
71 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
73 if (REAL_VALUE_ISINF (VALUE) \
74 || REAL_VALUE_ISNAN (VALUE) \
75 || REAL_VALUE_MINUS_ZERO (VALUE)) \
78 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
79 fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]); \
82 fprintf (FILE, "\t.double %.20e\n", VALUE); \
85 /* This is how to output an assembler line defining a `float' constant.
86 Note that the native i860/svr4 ELF assembler can't properly handle
87 infinity. It actually generates an assembly time error when given
88 `.float 99e9999' and it doesn't grok `inf' at all. It also mishandles
91 #undef ASM_OUTPUT_FLOAT
92 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
94 if (REAL_VALUE_ISINF (VALUE) \
95 || REAL_VALUE_ISNAN (VALUE) \
96 || REAL_VALUE_MINUS_ZERO (VALUE)) \
99 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
100 fprintf (FILE, "\t.word 0x%lx\n", t); \
103 fprintf (FILE, "\t.float %.12e\n", VALUE); \
106 #endif /* word order matches */
107 #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
109 #undef ASM_FILE_START
110 #define ASM_FILE_START(FILE) \
111 do { output_file_directive (FILE, main_input_filename); \
112 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
115 /* Output the special word the svr4 SDB wants to see just before
116 the first word of each function's prologue code. */
118 extern char *current_function_original_name;
120 /* This special macro is used to output a magic word just before the
121 first word of each function. On some versions of UNIX running on
122 the i860, this word can be any word that looks like a NOP, however
123 under svr4, this neds to be an `shr r0,r0,r0' instruction in which
124 the normally unused low-order bits contain the length of the function
125 prologue code (in bytes). This is needed to make the svr4 SDB debugger
128 #undef ASM_OUTPUT_FUNCTION_PREFIX
129 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
130 do { ASM_OUTPUT_ALIGN (FILE, 2); \
131 fprintf ((FILE), "\t.long\t.ep."); \
132 assemble_name (FILE, FNNAME); \
133 fprintf (FILE, "-"); \
134 assemble_name (FILE, FNNAME); \
135 fprintf (FILE, "+0xc8000000\n"); \
136 current_function_original_name = (FNNAME); \
139 /* Output the special label that must go just after each function's
140 prologue code to support svr4 SDB. */
142 #define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE) \
143 do { fprintf (FILE, ".ep."); \
144 assemble_name (FILE, current_function_original_name); \
145 fprintf (FILE, ":\n"); \
148 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
150 Note that we want to give these sections the SHF_WRITE attribute
151 because these sections will actually contain data (i.e. tables of
152 addresses of functions in the current root executable or shared library
153 file) and, in the case of a shared library, the relocatable addresses
154 will have to be properly resolved/relocated (and then written into) by
155 the dynamic linker when it actually attaches the given shared library
156 to the executing process. (Note that on SVR4, you may wish to use the
157 `-z text' option to the ELF linker, when building a shared library, as
158 an additional check that you are doing everything right. But if you do
159 use the `-z text' option when building a shared library, you will get
160 errors unless the .ctors and .dtors sections are marked as writable
161 via the SHF_WRITE attribute.) */
163 #undef CTORS_SECTION_ASM_OP
164 #define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
165 #undef DTORS_SECTION_ASM_OP
166 #define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
168 /* Add definitions to support the .tdesc section as specified in the svr4
171 #define TDESC_SECTION_ASM_OP ".section\t.tdesc"
173 #undef EXTRA_SECTIONS
174 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_tdesc
176 #undef EXTRA_SECTION_FUNCTIONS
177 #define EXTRA_SECTION_FUNCTIONS \
178 CONST_SECTION_FUNCTION \
179 CTORS_SECTION_FUNCTION \
180 DTORS_SECTION_FUNCTION \
181 TDESC_SECTION_FUNCTION
183 #define TDESC_SECTION_FUNCTION \
187 if (in_section != in_tdesc) \
189 fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
190 in_section = in_tdesc; \