2008-05-07 Kai Tietz <kai,tietz@onevision.com>
[official-gcc.git] / gcc / config / i386 / sysv4.h
blobe57fd0c5b0aa91029ff165ce99288132630741ec
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)
11 any later version.
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
26 in memory. */
28 #undef TARGET_RETURN_IN_MEMORY
29 #define TARGET_RETURN_IN_MEMORY ix86_i386elf_return_in_memory
31 /* Output at beginning of assembler file. */
32 /* The .file command should always begin the output. */
34 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
35 #undef X86_FILE_START_VERSION_DIRECTIVE
36 #define X86_FILE_START_VERSION_DIRECTIVE true
38 #undef DBX_REGISTER_NUMBER
39 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
41 /* The routine used to output sequences of byte values. We use a special
42 version of this for most svr4 targets because doing so makes the
43 generated assembly code more compact (and thus faster to assemble)
44 as well as more readable. Note that if we find subparts of the
45 character sequence which end with NUL (and which are shorter than
46 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
48 #undef ASM_OUTPUT_ASCII
49 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
50 do \
51 { \
52 const unsigned char *_ascii_bytes = \
53 (const unsigned char *) (STR); \
54 const unsigned char *limit = _ascii_bytes + (LENGTH); \
55 unsigned bytes_in_chunk = 0; \
56 for (; _ascii_bytes < limit; _ascii_bytes++) \
57 { \
58 const unsigned char *p; \
59 if (bytes_in_chunk >= 64) \
60 { \
61 fputc ('\n', (FILE)); \
62 bytes_in_chunk = 0; \
63 } \
64 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
65 continue; \
66 if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \
67 { \
68 if (bytes_in_chunk > 0) \
69 { \
70 fputc ('\n', (FILE)); \
71 bytes_in_chunk = 0; \
72 } \
73 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
74 _ascii_bytes = p; \
75 } \
76 else \
77 { \
78 if (bytes_in_chunk == 0) \
79 fprintf ((FILE), "\t.byte\t"); \
80 else \
81 fputc (',', (FILE)); \
82 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
83 bytes_in_chunk += 5; \
84 } \
85 } \
86 if (bytes_in_chunk > 0) \
87 fprintf ((FILE), "\n"); \
88 } \
89 while (0)
91 /* A C statement (sans semicolon) to output to the stdio stream
92 FILE the assembler definition of uninitialized global DECL named
93 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
94 Try to use asm_output_aligned_bss to implement this macro. */
96 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
97 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
99 /* Handle special EH pointer encodings. Absolute, pc-relative, and
100 indirect are handled automatically. */
101 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
102 do { \
103 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
105 fputs (ASM_LONG, FILE); \
106 assemble_name (FILE, XSTR (ADDR, 0)); \
107 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
108 goto DONE; \
110 } while (0)
112 /* Used by crtstuff.c to initialize the base of data-relative relocations.
113 These are GOT relative on x86, so return the pic register. */
114 #ifdef __PIC__
115 #define CRT_GET_RFIB_DATA(BASE) \
117 register void *ebx_ __asm__("ebx"); \
118 BASE = ebx_; \
120 #else
121 #define CRT_GET_RFIB_DATA(BASE) \
122 __asm__ ("call\t.LPR%=\n" \
123 ".LPR%=:\n\t" \
124 "pop{l}\t%0\n\t" \
125 /* Due to a GAS bug, this cannot use EAX. That encodes \
126 smaller than the traditional EBX, which results in the \
127 offset being off by one. */ \
128 "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
129 "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
130 : "=d"(BASE))
131 #endif