1 /* Target definitions for GCC for Intel 80386 running System V.4
2 Copyright (C) 1991, 2001, 2002, 2007 Free Software Foundation, Inc.
4 Written by Ron Guilmette (rfg@netcom.com).
6 This file is part of GCC.
8 GCC 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 3, or (at your option)
13 GCC 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 GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
23 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
25 /* The svr4 ABI for the i386 says that records and unions are returned
28 #define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
29 (TYPE_MODE (TYPE) == BLKmode \
30 || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8));
32 /* Output at beginning of assembler file. */
33 /* The .file command should always begin the output. */
35 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
36 #undef X86_FILE_START_VERSION_DIRECTIVE
37 #define X86_FILE_START_VERSION_DIRECTIVE true
39 #undef DBX_REGISTER_NUMBER
40 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
42 /* The routine used to output sequences of byte values. We use a special
43 version of this for most svr4 targets because doing so makes the
44 generated assembly code more compact (and thus faster to assemble)
45 as well as more readable. Note that if we find subparts of the
46 character sequence which end with NUL (and which are shorter than
47 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
49 #undef ASM_OUTPUT_ASCII
50 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
53 const unsigned char *_ascii_bytes = \
54 (const unsigned char *) (STR); \
55 const unsigned char *limit = _ascii_bytes + (LENGTH); \
56 unsigned bytes_in_chunk = 0; \
57 for (; _ascii_bytes < limit; _ascii_bytes++) \
59 const unsigned char *p; \
60 if (bytes_in_chunk >= 64) \
62 fputc ('\n', (FILE)); \
65 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
67 if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \
69 if (bytes_in_chunk > 0) \
71 fputc ('\n', (FILE)); \
74 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
79 if (bytes_in_chunk == 0) \
80 fprintf ((FILE), "\t.byte\t"); \
82 fputc (',', (FILE)); \
83 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
84 bytes_in_chunk += 5; \
87 if (bytes_in_chunk > 0) \
88 fprintf ((FILE), "\n"); \
92 /* A C statement (sans semicolon) to output to the stdio stream
93 FILE the assembler definition of uninitialized global DECL named
94 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
95 Try to use asm_output_aligned_bss to implement this macro. */
97 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
98 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
100 /* Handle special EH pointer encodings. Absolute, pc-relative, and
101 indirect are handled automatically. */
102 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
104 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
106 fputs (ASM_LONG, FILE); \
107 assemble_name (FILE, XSTR (ADDR, 0)); \
108 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
113 /* Used by crtstuff.c to initialize the base of data-relative relocations.
114 These are GOT relative on x86, so return the pic register. */
116 #define CRT_GET_RFIB_DATA(BASE) \
118 register void *ebx_ __asm__("ebx"); \
122 #define CRT_GET_RFIB_DATA(BASE) \
123 __asm__ ("call\t.LPR%=\n" \
126 /* Due to a GAS bug, this cannot use EAX. That encodes \
127 smaller than the traditional EBX, which results in the \
128 offset being off by one. */ \
129 "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
130 "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \