sysv4.h revision 117395
155714Skris/* Target definitions for GNU compiler for Intel 80386 running System V.4
255714Skris   Copyright (C) 1991, 2001, 2002 Free Software Foundation, Inc.
355714Skris
455714Skris   Written by Ron Guilmette (rfg@netcom.com).
555714Skris
655714SkrisThis file is part of GNU CC.
755714Skris
855714SkrisGNU CC is free software; you can redistribute it and/or modify
955714Skrisit under the terms of the GNU General Public License as published by
1055714Skristhe Free Software Foundation; either version 2, or (at your option)
1155714Skrisany later version.
1255714Skris
1355714SkrisGNU CC is distributed in the hope that it will be useful,
1455714Skrisbut WITHOUT ANY WARRANTY; without even the implied warranty of
1555714SkrisMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1655714SkrisGNU General Public License for more details.
1755714Skris
1855714SkrisYou should have received a copy of the GNU General Public License
1955714Skrisalong with GNU CC; see the file COPYING.  If not, write to
2055714Skristhe Free Software Foundation, 59 Temple Place - Suite 330,
2155714SkrisBoston, MA 02111-1307, USA.  */
2255714Skris
2355714Skris
2455714Skris#define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
2555714Skris
2655714Skris/* The svr4 ABI for the i386 says that records and unions are returned
2755714Skris   in memory.  */
2855714Skris
2955714Skris#undef RETURN_IN_MEMORY
3055714Skris#define RETURN_IN_MEMORY(TYPE) \
3155714Skris  (TYPE_MODE (TYPE) == BLKmode \
3255714Skris   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
3355714Skris
3455714Skris/* Output at beginning of assembler file.  */
3555714Skris/* The .file command should always begin the output.  */
3655714Skris
3755714Skris#undef ASM_FILE_START
3855714Skris#define ASM_FILE_START(FILE)						\
3955714Skris  do {									\
4055714Skris	output_file_directive (FILE, main_input_filename);		\
4155714Skris	fprintf (FILE, "\t.version\t\"01.01\"\n");			\
4255714Skris  } while (0)
4355714Skris
4455714Skris#undef DBX_REGISTER_NUMBER
4555714Skris#define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
4655714Skris
4755714Skris/* The routine used to output sequences of byte values.  We use a special
4855714Skris   version of this for most svr4 targets because doing so makes the
4955714Skris   generated assembly code more compact (and thus faster to assemble)
5055714Skris   as well as more readable.  Note that if we find subparts of the
5155714Skris   character sequence which end with NUL (and which are shorter than
5255714Skris   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
5355714Skris
5455714Skris#undef ASM_OUTPUT_ASCII
5555714Skris#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)				\
5655714Skris  do									\
5755714Skris    {									\
5855714Skris      register const unsigned char *_ascii_bytes =			\
5955714Skris        (const unsigned char *) (STR);					\
6055714Skris      register const unsigned char *limit = _ascii_bytes + (LENGTH);	\
6155714Skris      register unsigned bytes_in_chunk = 0;				\
6255714Skris      for (; _ascii_bytes < limit; _ascii_bytes++)			\
6355714Skris        {								\
6455714Skris	  register const unsigned char *p;				\
6555714Skris	  if (bytes_in_chunk >= 64)					\
6655714Skris	    {								\
6755714Skris	      fputc ('\n', (FILE));					\
6855714Skris	      bytes_in_chunk = 0;					\
6955714Skris	    }								\
7055714Skris	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
7155714Skris	    continue;							\
7255714Skris	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
7355714Skris	    {								\
7455714Skris	      if (bytes_in_chunk > 0)					\
7555714Skris		{							\
7655714Skris		  fputc ('\n', (FILE));					\
7755714Skris		  bytes_in_chunk = 0;					\
7855714Skris		}							\
7955714Skris	      ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);		\
8055714Skris	      _ascii_bytes = p;						\
8155714Skris	    }								\
8255714Skris	  else								\
8355714Skris	    {								\
8455714Skris	      if (bytes_in_chunk == 0)					\
8555714Skris		fprintf ((FILE), "\t.byte\t");				\
8655714Skris	      else							\
8755714Skris		fputc (',', (FILE));					\
8855714Skris	      fprintf ((FILE), "0x%02x", *_ascii_bytes);		\
8955714Skris	      bytes_in_chunk += 5;					\
9055714Skris	    }								\
9155714Skris	}								\
9255714Skris      if (bytes_in_chunk > 0)						\
9355714Skris        fprintf ((FILE), "\n");						\
9455714Skris    }									\
9555714Skris  while (0)
9655714Skris
9755714Skris/* A C statement (sans semicolon) to output to the stdio stream
9855714Skris   FILE the assembler definition of uninitialized global DECL named
9955714Skris   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
10055714Skris   Try to use asm_output_aligned_bss to implement this macro.  */
10155714Skris
10255714Skris#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
10355714Skris  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
10455714Skris
10555714Skris/* Handle special EH pointer encodings.  Absolute, pc-relative, and
10655714Skris   indirect are handled automatically.  */
10755714Skris#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
10855714Skris  do {									\
10955714Skris    if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)		\
11055714Skris      {									\
11155714Skris        fputs (ASM_LONG, FILE);						\
11255714Skris        assemble_name (FILE, XSTR (ADDR, 0));				\
11355714Skris	fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
11455714Skris        goto DONE;							\
11555714Skris      }									\
11655714Skris  } while (0)
11755714Skris
11855714Skris/* Used by crtstuff.c to initialize the base of data-relative relocations.
11955714Skris   These are GOT relative on x86, so return the pic register.  */
12055714Skris#ifdef __PIC__
12155714Skris#define CRT_GET_RFIB_DATA(BASE)			\
12255714Skris  {						\
12355714Skris    register void *ebx_ __asm__("ebx");		\
12455714Skris    BASE = ebx_;				\
12555714Skris  }
12655714Skris#else
12755714Skris#define CRT_GET_RFIB_DATA(BASE)						\
12855714Skris  __asm__ ("call\t.LPR%=\n"						\
12955714Skris	   ".LPR%=:\n\t"						\
13055714Skris	   "popl\t%0\n\t"						\
13155714Skris	   /* Due to a GAS bug, this cannot use EAX.  That encodes	\
13255714Skris	      smaller than the traditional EBX, which results in the	\
13355714Skris	      offset being off by one.  */				\
13455714Skris	   "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"			\
13555714Skris	   : "=d"(BASE))
13655714Skris#endif
13755714Skris