1132718Skan/* Target definitions for GCC for Intel 80386 using ELF
2117395Skan   Copyright (C) 1988, 1991, 1995, 2000, 2001, 2002
3117395Skan   Free Software Foundation, Inc.
490075Sobrien
590075Sobrien   Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com).
690075Sobrien
7132718SkanThis file is part of GCC.
890075Sobrien
9132718SkanGCC is free software; you can redistribute it and/or modify
1090075Sobrienit under the terms of the GNU General Public License as published by
1190075Sobrienthe Free Software Foundation; either version 2, or (at your option)
1290075Sobrienany later version.
1390075Sobrien
14132718SkanGCC is distributed in the hope that it will be useful,
1590075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1690075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1790075SobrienGNU General Public License for more details.
1890075Sobrien
1990075SobrienYou should have received a copy of the GNU General Public License
20132718Skanalong with GCC; see the file COPYING.  If not, write to
21169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
22169689SkanBoston, MA 02110-1301, USA.  */
2390075Sobrien
2490075Sobrien/* Use stabs instead of DWARF debug format.  */
2590075Sobrien#undef  PREFERRED_DEBUGGING_TYPE
2690075Sobrien#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
2790075Sobrien
2890075Sobrien#define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
2990075Sobrien
3090075Sobrien/* By default, target has a 80387, uses IEEE compatible arithmetic,
3190075Sobrien   and returns float values in the 387.  */
3290075Sobrien
3390075Sobrien#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
3490075Sobrien
3590075Sobrien/* The ELF ABI for the i386 says that records and unions are returned
3690075Sobrien   in memory.  */
3790075Sobrien
3890075Sobrien#undef RETURN_IN_MEMORY
3990075Sobrien#define RETURN_IN_MEMORY(TYPE) \
4090075Sobrien  (TYPE_MODE (TYPE) == BLKmode \
4190075Sobrien   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
4290075Sobrien
4390075Sobrien#undef CPP_SPEC
44117395Skan#define CPP_SPEC ""
4590075Sobrien
4690075Sobrien#define ENDFILE_SPEC "crtend.o%s"
4790075Sobrien
4890075Sobrien#define STARTFILE_SPEC "%{!shared: \
4990075Sobrien			 %{!symbolic: \
5090075Sobrien			  %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
5190075Sobrien			crtbegin.o%s"
5290075Sobrien
5390075Sobrien#undef DBX_REGISTER_NUMBER
5490075Sobrien#define DBX_REGISTER_NUMBER(n) \
5590075Sobrien  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
5690075Sobrien
5790075Sobrien/* The routine used to output sequences of byte values.  We use a special
5890075Sobrien   version of this for most svr4 targets because doing so makes the
5990075Sobrien   generated assembly code more compact (and thus faster to assemble)
6090075Sobrien   as well as more readable.  Note that if we find subparts of the
6190075Sobrien   character sequence which end with NUL (and which are shorter than
6290075Sobrien   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
6390075Sobrien
6490075Sobrien#undef ASM_OUTPUT_ASCII
6590075Sobrien#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)				\
6690075Sobrien  do									\
6790075Sobrien    {									\
68132718Skan      const unsigned char *_ascii_bytes =				\
6990075Sobrien        (const unsigned char *) (STR);					\
70132718Skan      const unsigned char *limit = _ascii_bytes + (LENGTH);		\
71132718Skan      unsigned bytes_in_chunk = 0;					\
7290075Sobrien      for (; _ascii_bytes < limit; _ascii_bytes++)			\
7390075Sobrien        {								\
74132718Skan	  const unsigned char *p;					\
7590075Sobrien	  if (bytes_in_chunk >= 64)					\
7690075Sobrien	    {								\
7790075Sobrien	      fputc ('\n', (FILE));					\
7890075Sobrien	      bytes_in_chunk = 0;					\
7990075Sobrien	    }								\
8090075Sobrien	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
8190075Sobrien	    continue;							\
8290075Sobrien	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
8390075Sobrien	    {								\
8490075Sobrien	      if (bytes_in_chunk > 0)					\
8590075Sobrien		{							\
8690075Sobrien		  fputc ('\n', (FILE));					\
8790075Sobrien		  bytes_in_chunk = 0;					\
8890075Sobrien		}							\
8990075Sobrien	      ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);		\
9090075Sobrien	      _ascii_bytes = p;						\
9190075Sobrien	    }								\
9290075Sobrien	  else								\
9390075Sobrien	    {								\
9490075Sobrien	      if (bytes_in_chunk == 0)					\
9590075Sobrien		fprintf ((FILE), "\t.byte\t");				\
9690075Sobrien	      else							\
9790075Sobrien		fputc (',', (FILE));					\
9890075Sobrien	      fprintf ((FILE), "0x%02x", *_ascii_bytes);		\
9990075Sobrien	      bytes_in_chunk += 5;					\
10090075Sobrien	    }								\
10190075Sobrien	}								\
10290075Sobrien      if (bytes_in_chunk > 0)						\
10390075Sobrien        fprintf ((FILE), "\n");						\
10490075Sobrien    }									\
10590075Sobrien  while (0)
10690075Sobrien
10790075Sobrien#define LOCAL_LABEL_PREFIX	"."
10890075Sobrien
10990075Sobrien/* Switch into a generic section.  */
11090075Sobrien#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
11190075Sobrien
11290075Sobrien/* If defined, a C expression whose value is a string containing the
11390075Sobrien   assembler operation to identify the following data as
11490075Sobrien   uninitialized global data.  If not defined, and neither
11590075Sobrien   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
11690075Sobrien   uninitialized global data will be output in the data section if
11790075Sobrien   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
11890075Sobrien   used.  */
11990075Sobrien#undef BSS_SECTION_ASM_OP
12090075Sobrien#define BSS_SECTION_ASM_OP "\t.section\t.bss"
12190075Sobrien
12290075Sobrien/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
12390075Sobrien   separate, explicit argument.  If you define this macro, it is used
12490075Sobrien   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
12590075Sobrien   handling the required alignment of the variable.  The alignment is
12690075Sobrien   specified as the number of bits.
12790075Sobrien
12890075Sobrien   Try to use function `asm_output_aligned_bss' defined in file
12990075Sobrien   `varasm.c' when defining this macro.  */
13090075Sobrien#undef ASM_OUTPUT_ALIGNED_BSS
13190075Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
13290075Sobrien  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
133