sysv4.h revision 90075
1/* Target definitions for GNU compiler for Intel 80386 running System V.4
2   Copyright (C) 1991, 2001 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#undef TARGET_VERSION
25#define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
26
27/* The svr4 ABI for the i386 says that records and unions are returned
28   in memory.  */
29
30#undef RETURN_IN_MEMORY
31#define RETURN_IN_MEMORY(TYPE) \
32  (TYPE_MODE (TYPE) == BLKmode \
33   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
34
35/* Define which macros to predefine.  __svr4__ is our extension.  */
36/* This used to define X86, but james@bigtex.cactus.org says that
37   is supposed to be defined optionally by user programs--not by default.  */
38#define CPP_PREDEFINES \
39  "-Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
40
41/* Output at beginning of assembler file.  */
42/* The .file command should always begin the output.  */
43
44#undef ASM_FILE_START
45#define ASM_FILE_START(FILE)						\
46  do {									\
47	output_file_directive (FILE, main_input_filename);		\
48	fprintf (FILE, "\t.version\t\"01.01\"\n");			\
49  } while (0)
50
51#undef DBX_REGISTER_NUMBER
52#define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
53
54/* The routine used to output sequences of byte values.  We use a special
55   version of this for most svr4 targets because doing so makes the
56   generated assembly code more compact (and thus faster to assemble)
57   as well as more readable.  Note that if we find subparts of the
58   character sequence which end with NUL (and which are shorter than
59   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
60
61#undef ASM_OUTPUT_ASCII
62#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)				\
63  do									\
64    {									\
65      register const unsigned char *_ascii_bytes =			\
66        (const unsigned char *) (STR);					\
67      register const unsigned char *limit = _ascii_bytes + (LENGTH);	\
68      register unsigned bytes_in_chunk = 0;				\
69      for (; _ascii_bytes < limit; _ascii_bytes++)			\
70        {								\
71	  register const unsigned char *p;				\
72	  if (bytes_in_chunk >= 64)					\
73	    {								\
74	      fputc ('\n', (FILE));					\
75	      bytes_in_chunk = 0;					\
76	    }								\
77	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
78	    continue;							\
79	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
80	    {								\
81	      if (bytes_in_chunk > 0)					\
82		{							\
83		  fputc ('\n', (FILE));					\
84		  bytes_in_chunk = 0;					\
85		}							\
86	      ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);		\
87	      _ascii_bytes = p;						\
88	    }								\
89	  else								\
90	    {								\
91	      if (bytes_in_chunk == 0)					\
92		fprintf ((FILE), "\t.byte\t");				\
93	      else							\
94		fputc (',', (FILE));					\
95	      fprintf ((FILE), "0x%02x", *_ascii_bytes);		\
96	      bytes_in_chunk += 5;					\
97	    }								\
98	}								\
99      if (bytes_in_chunk > 0)						\
100        fprintf ((FILE), "\n");						\
101    }									\
102  while (0)
103
104/* A C statement (sans semicolon) to output to the stdio stream
105   FILE the assembler definition of uninitialized global DECL named
106   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
107   Try to use asm_output_aligned_bss to implement this macro.  */
108
109#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
110  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
111
112/* Handle special EH pointer encodings.  Absolute, pc-relative, and
113   indirect are handled automatically.  */
114#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
115  do {									\
116    if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)		\
117      {									\
118        fputs (ASM_LONG, FILE);						\
119        assemble_name (FILE, XSTR (ADDR, 0));				\
120	fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
121        goto DONE;							\
122      }									\
123  } while (0)
124
125/* Used by crtstuff.c to initialize the base of data-relative relocations.
126   These are GOT relative on x86, so return the pic register.  */
127#ifdef __PIC__
128#define CRT_GET_RFIB_DATA(BASE)			\
129  {						\
130    register void *ebx_ __asm__("ebx");		\
131    BASE = ebx_;				\
132  }
133#else
134#define CRT_GET_RFIB_DATA(BASE)						\
135  __asm__ ("call\t.LPR%=\n"						\
136	   ".LPR%=:\n\t"						\
137	   "popl\t%0\n\t"						\
138	   /* Due to a GAS bug, this cannot use EAX.  That encodes	\
139	      smaller than the traditional EBX, which results in the	\
140	      offset being off by one.  */				\
141	   "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"			\
142	   : "=d"(BASE))
143#endif
144
145#undef CPP_SPEC
146#define CPP_SPEC "%(cpp_cpu)"
147