1/* Definitions of target machine for GCC,
2   for x86-64/ELF NetBSD systems.
3   Copyright (C) 2002-2020 Free Software Foundation, Inc.
4   Contributed by Wasabi Systems, Inc.
5
6This file is part of GCC.
7
8GCC 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 3, or (at your option)
11any later version.
12
13GCC 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 GCC; see the file COPYING3.  If not see
20<http://www.gnu.org/licenses/>.  */
21
22#define TARGET_OS_CPP_BUILTINS()		\
23  do						\
24    {						\
25      NETBSD_OS_CPP_BUILTINS_ELF();		\
26    }						\
27  while (0)
28
29
30/* Provide a LINK_SPEC appropriate for a NetBSD/x86-64 ELF target.  */
31
32#undef LINK_SPEC
33#define LINK_SPEC \
34  "%{m32:-m elf_i386} \
35   %{m64:-m elf_x86_64} \
36   %(netbsd_link_spec)"
37
38#define NETBSD_ENTRY_POINT "_start"
39
40
41/* Provide a CPP_SPEC appropriate for NetBSD.  */
42
43#undef CPP_SPEC
44#define CPP_SPEC "%(netbsd_cpp_spec)"
45
46
47/* Provide C11_SPEC/CC1PLUS_SPEC appropriate for NetBSD/x86-64.  */
48#define NETBSD_CC1_CPU_SPEC " %(cc1_cpu) "
49
50#undef CC1_SPEC
51#define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC
52
53#undef CC1PLUS_SPEC
54#define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC
55
56
57/* Output assembler code to FILE to call the profiler.  */
58
59#undef FUNCTION_PROFILER
60#define FUNCTION_PROFILER(FILE, LABELNO)				\
61{									\
62  if (TARGET_64BIT && flag_pic)						\
63    fprintf (FILE, "\tcall __mcount@PLT\n");				\
64  else if (flag_pic)							\
65    fprintf (FILE, "\tcall __mcount@PLT\n");				\
66  else									\
67    fprintf (FILE, "\tcall __mcount\n");				\
68}
69
70/* Preserve i386 psABI  */
71#undef PREFERRED_STACK_BOUNDARY_DEFAULT
72#define PREFERRED_STACK_BOUNDARY_DEFAULT \
73  ((TARGET_64BIT || TARGET_SSE) ? 128 : 32)
74
75#define HAVE_ENABLE_EXECUTE_STACK
76
77/* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000.  */
78#undef X86_32_ASAN_BIT_OFFSET
79#define X86_32_ASAN_BIT_OFFSET 30
80