1 /* Target definitions for GNU compiler for Intel 80386 running System V.4
2 Copyright (C) 1991 Free Software Foundation, Inc.
4 Written by Ron Guilmette (rfg@netcom.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 #include "i386/i386.h" /* Base i386 target machine definitions */
24 #include "i386/att.h" /* Use the i386 AT&T assembler syntax */
25 #include "svr4.h" /* Definitions common to all SVR4 targets */
28 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
30 /* The svr4 ABI for the i386 says that records and unions are returned
33 #undef RETURN_IN_MEMORY
34 #define RETURN_IN_MEMORY(TYPE) \
35 (TYPE_MODE (TYPE) == BLKmode \
36 || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
38 /* Define which macros to predefine. __svr4__ is our extension. */
39 /* This used to define X86, but james@bigtex.cactus.org says that
40 is supposed to be defined optionally by user programs--not by default. */
41 #define CPP_PREDEFINES \
42 "-Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
44 /* This is how to output assembly code to define a `float' constant.
45 We always have to use a .long pseudo-op to do this because the native
46 SVR4 ELF assembler is buggy and it generates incorrect values when we
47 try to use the .float pseudo-op instead. */
49 #undef ASM_OUTPUT_FLOAT
50 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
52 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
53 if (sizeof (int) == sizeof (long)) \
54 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \
56 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \
59 /* This is how to output assembly code to define a `double' constant.
60 We always have to use a pair of .long pseudo-ops to do this because
61 the native SVR4 ELF assembler is buggy and it generates incorrect
62 values when we try to use the .double pseudo-op instead. */
64 #undef ASM_OUTPUT_DOUBLE
65 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
67 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
68 if (sizeof (int) == sizeof (long)) \
70 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
71 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
75 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
76 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
81 #undef ASM_OUTPUT_LONG_DOUBLE
82 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
84 REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
85 if (sizeof (int) == sizeof (long)) \
87 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
88 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
89 fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]); \
93 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
94 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
95 fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]); \
99 /* Output at beginning of assembler file. */
100 /* The .file command should always begin the output. */
102 #undef ASM_FILE_START
103 #define ASM_FILE_START(FILE) \
105 output_file_directive (FILE, main_input_filename); \
106 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
109 #undef DBX_REGISTER_NUMBER
110 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
112 /* The routine used to output sequences of byte values. We use a special
113 version of this for most svr4 targets because doing so makes the
114 generated assembly code more compact (and thus faster to assemble)
115 as well as more readable. Note that if we find subparts of the
116 character sequence which end with NUL (and which are shorter than
117 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
119 #undef ASM_OUTPUT_ASCII
120 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
123 register const unsigned char *_ascii_bytes = \
124 (const unsigned char *) (STR); \
125 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
126 register unsigned bytes_in_chunk = 0; \
127 for (; _ascii_bytes < limit; _ascii_bytes++) \
129 register const unsigned char *p; \
130 if (bytes_in_chunk >= 64) \
132 fputc ('\n', (FILE)); \
133 bytes_in_chunk = 0; \
135 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
137 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
139 if (bytes_in_chunk > 0) \
141 fputc ('\n', (FILE)); \
142 bytes_in_chunk = 0; \
144 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
149 if (bytes_in_chunk == 0) \
150 fprintf ((FILE), "\t.byte\t"); \
152 fputc (',', (FILE)); \
153 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
154 bytes_in_chunk += 5; \
157 if (bytes_in_chunk > 0) \
158 fprintf ((FILE), "\n"); \
162 /* This is how to output an element of a case-vector that is relative.
163 This is only used for PIC code. See comments by the `casesi' insn in
164 i386.md for an explanation of the expression this outputs. */
166 #undef ASM_OUTPUT_ADDR_DIFF_ELT
167 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
168 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
170 /* Indicate that jump tables go in the text section. This is
171 necessary when compiling PIC code. */
173 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
175 /* A C statement (sans semicolon) to output to the stdio stream
176 FILE the assembler definition of uninitialized global DECL named
177 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
178 Try to use asm_output_aligned_bss to implement this macro. */
180 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
181 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)