/* Definitions for Intel x86 running RDOS
   Copyright (C) 2005

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.  */

#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (i386 RDOS)");

/* RDOS uses .exe suffix */
#define TARGET_EXECUTABLE_SUFFIX ".exe"

/* The SVR4 ABI for the i386 says that records and unions are returned
   in memory.  */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 1

/* We arrange for the whole %gs segment to map the tls area.  */
#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS

#undef ASM_COMMENT_START
#define ASM_COMMENT_START " #"

/* Output assembler code to FILE to increment profiler label # LABELNO
   for profiling a function entry.  */

#undef MCOUNT_NAME
#define MCOUNT_NAME "mcount"

#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
 
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
  
#undef WCHAR_TYPE
#define WCHAR_TYPE "short unsigned int"
   
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16

#define TARGET_DECLSPEC 1

#define TARGET_OS_CPP_BUILTINS()					\
  do									\
    {									\
	builtin_define ("__RDOS__");					\
	builtin_define ("__INTEL__");					\
	builtin_define ("_X86_");					\
	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
	builtin_assert ("system=rdos");					\
	if (flag_pic)							\
	  {								\
	    builtin_define ("__PIC__");					\
	    builtin_define ("__pic__");					\
	  }								\
    }									\
  while (0)

#undef CPP_SPEC
#define CPP_SPEC "-D_REENTRANT"

#undef CC1_SPEC
#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
    
/* Provide a LINK_SPEC appropriate for RDOS. */

#undef	LINK_SPEC
#define LINK_SPEC "-m elf_i386"

/* Provide start and end file specs appropriate to glibc.  */

#undef STARTFILE_SPEC
#define STARTFILE_SPEC "crt0.o%s crtbegin.o%s"

#undef  ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s"

/* A C statement to output to the stdio stream FILE an assembler
   command to advance the location counter to a multiple of 1<<LOG
   bytes if it is within MAX_SKIP bytes.

   This is used to align code labels according to Intel recommendations.  */

#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
  if ((LOG)!=0) \
    if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP))
#endif

#undef MATH_LIBRARY
#define MATH_LIBRARY ""

/* RDOS headers are C++-aware (and often use C++).  */
#define NO_IMPLICIT_EXTERN_C
