sysv4.h revision 117395
1/* Target definitions for GNU compiler for Intel 80386 running System V.4
2   Copyright (C) 1991, 2001, 2002 Free Software Foundation, Inc.
3
4   Written by Ron Guilmette (rfg@netcom.com).
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GNU CC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU CC; see the file COPYING.  If not, write to
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA.  */
22
23
24#define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
25
26/* The svr4 ABI for the i386 says that records and unions are returned
27   in memory.  */
28
29#undef RETURN_IN_MEMORY
30#define RETURN_IN_MEMORY(TYPE) \
31  (TYPE_MODE (TYPE) == BLKmode \
32   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
33
34/* Output at beginning of assembler file.  */
35/* The .file command should always begin the output.  */
36
37#undef ASM_FILE_START
38#define ASM_FILE_START(FILE)						\
39  do {									\
40	output_file_directive (FILE, main_input_filename);		\
41	fprintf (FILE, "\t.version\t\"01.01\"\n");			\
42  } while (0)
43
44#undef DBX_REGISTER_NUMBER
45#define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
46
47/* The routine used to output sequences of byte values.  We use a special
48   version of this for most svr4 targets because doing so makes the
49   generated assembly code more compact (and thus faster to assemble)
50   as well as more readable.  Note that if we find subparts of the
51   character sequence which end with NUL (and which are shorter than
52   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
53
54#undef ASM_OUTPUT_ASCII
55#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)				\
56  do									\
57    {									\
58      register const unsigned char *_ascii_bytes =			\
59        (const unsigned char *) (STR);					\
60      register const unsigned char *limit = _ascii_bytes + (LENGTH);	\
61      register unsigned bytes_in_chunk = 0;				\
62      for (; _ascii_bytes < limit; _ascii_bytes++)			\
63        {								\
64	  register const unsigned char *p;				\
65	  if (bytes_in_chunk >= 64)					\
66	    {								\
67	      fputc ('\n', (FILE));					\
68	      bytes_in_chunk = 0;					\
69	    }								\
70	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
71	    continue;							\
72	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
73	    {								\
74	      if (bytes_in_chunk > 0)					\
75		{							\
76		  fputc ('\n', (FILE));					\
77		  bytes_in_chunk = 0;					\
78		}							\
79	      ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);		\
80	      _ascii_bytes = p;						\
81	    }								\
82	  else								\
83	    {								\
84	      if (bytes_in_chunk == 0)					\
85		fprintf ((FILE), "\t.byte\t");				\
86	      else							\
87		fputc (',', (FILE));					\
88	      fprintf ((FILE), "0x%02x", *_ascii_bytes);		\
89	      bytes_in_chunk += 5;					\
90	    }								\
91	}								\
92      if (bytes_in_chunk > 0)						\
93        fprintf ((FILE), "\n");						\
94    }									\
95  while (0)
96
97/* A C statement (sans semicolon) to output to the stdio stream
98   FILE the assembler definition of uninitialized global DECL named
99   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
100   Try to use asm_output_aligned_bss to implement this macro.  */
101
102#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
103  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
104
105/* Handle special EH pointer encodings.  Absolute, pc-relative, and
106   indirect are handled automatically.  */
107#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
108  do {									\
109    if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)		\
110      {									\
111        fputs (ASM_LONG, FILE);						\
112        assemble_name (FILE, XSTR (ADDR, 0));				\
113	fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
114        goto DONE;							\
115      }									\
116  } while (0)
117
118/* Used by crtstuff.c to initialize the base of data-relative relocations.
119   These are GOT relative on x86, so return the pic register.  */
120#ifdef __PIC__
121#define CRT_GET_RFIB_DATA(BASE)			\
122  {						\
123    register void *ebx_ __asm__("ebx");		\
124    BASE = ebx_;				\
125  }
126#else
127#define CRT_GET_RFIB_DATA(BASE)						\
128  __asm__ ("call\t.LPR%=\n"						\
129	   ".LPR%=:\n\t"						\
130	   "popl\t%0\n\t"						\
131	   /* Due to a GAS bug, this cannot use EAX.  That encodes	\
132	      smaller than the traditional EBX, which results in the	\
133	      offset being off by one.  */				\
134	   "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"			\
135	   : "=d"(BASE))
136#endif
137