1/* Definitions for AMD x86_64 running Haiku with ELF format.
2   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
3   Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22
23#undef ASM_COMMENT_START
24#define ASM_COMMENT_START " #"
25
26/* The SVR4 ABI for the i386 says that records and unions are returned
27 * in memory. For 64-bit compilation this definition is ignored, however
28 * it is necessary for correct 32-bit code generation.
29 */
30#undef DEFAULT_PCC_STRUCT_RETURN
31#define DEFAULT_PCC_STRUCT_RETURN 1
32
33#undef DBX_REGISTER_NUMBER
34#define DBX_REGISTER_NUMBER(n) \
35  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
36
37#define TARGET_OS_CPP_BUILTINS()					\
38  do									\
39    {									\
40      builtin_define ("__HAIKU__");					\
41      if (!TARGET_64BIT)						\
42        {								\
43          builtin_define ("__INTEL__");					\
44          builtin_define ("__X86__");					\
45        }								\
46      builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
47      builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
48      builtin_define ("__STDC_ISO_10646__=201103L");			\
49      builtin_assert ("system=haiku");					\
50    }									\
51  while (0)
52
53/* Provide a LINK_SPEC appropriate for Haiku.  Here we provide support
54   for the special GCC options -static and -shared, which allow us to
55   link things in one of these three modes by applying the appropriate
56   combinations of options at link-time.  */
57
58#if TARGET_64BIT_DEFAULT
59#define SPEC_32 "m32"
60#define SPEC_64 "!m32"
61#else
62#define SPEC_32 "!m64"
63#define SPEC_64 "m64"
64#endif
65
66#undef	LINK_SPEC
67#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64_haiku} %{" SPEC_32 ":-m elf_i386_haiku} \
68	%{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
69
70/* A C statement (sans semicolon) to output to the stdio stream
71   FILE the assembler definition of uninitialized global DECL named
72   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
73   Try to use x86_output_aligned_bss to implement this macro.  */
74
75#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
76  x86_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
77
78/* This is used to align code labels according to Intel recommendations.  */
79
80#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
81#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
82  do {									\
83    if ((LOG) != 0) {							\
84      if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
85      else {								\
86        fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
87        /* Make sure that we have at least 8 byte alignment if > 8 byte	\
88           alignment is preferred.  */					\
89        if ((LOG) > 3							\
90            && (1 << (LOG)) > ((MAX_SKIP) + 1)				\
91            && (MAX_SKIP) >= 7)						\
92          fputs ("\t.p2align 3\n", (FILE));				\
93      }									\
94    }									\
95  } while (0)
96#undef  ASM_OUTPUT_MAX_SKIP_PAD
97#define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP)			\
98  if ((LOG) != 0)							\
99    {									\
100      if ((MAX_SKIP) == 0)						\
101        fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
102      else								\
103        fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
104    }
105#endif
106
107
108/* Output assembler code to FILE to call the profiler.  */
109#define NO_PROFILE_COUNTERS 1
110
111#undef ASM_SPEC
112#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
113 %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64}"
114
115#undef  ASM_OUTPUT_ALIGNED_COMMON
116#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
117  x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);
118
119
120/* i386 System V Release 4 uses DWARF debugging info.
121   x86-64 ABI specifies DWARF2.  */
122
123#define DWARF2_DEBUGGING_INFO 1
124#define DWARF2_UNWIND_INFO 1
125
126#undef PREFERRED_DEBUGGING_TYPE
127#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
128
129#undef TARGET_ASM_SELECT_SECTION
130#define TARGET_ASM_SELECT_SECTION  x86_64_elf_select_section
131
132#undef TARGET_ASM_UNIQUE_SECTION
133#define TARGET_ASM_UNIQUE_SECTION  x86_64_elf_unique_section
134
135#define USE_X86_64_FRAME_POINTER 1
136