1/* Definitions of target machine for GNU compiler,
2   for PowerPC NetBSD systems.
3   Copyright (C) 2002-2020 Free Software Foundation, Inc.
4   Contributed by Wasabi Systems, Inc.
5
6   This file is part of GCC.
7
8   GCC is free software; you can redistribute it and/or modify it
9   under the terms of the GNU General Public License as published
10   by the Free Software Foundation; either version 3, or (at your
11   option) any later version.
12
13   GCC is distributed in the hope that it will be useful, but WITHOUT
14   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16   License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with GCC; see the file COPYING3.  If not see
20   <http://www.gnu.org/licenses/>.  */
21
22/* Undef gnu-user.h macros we don't want.  */
23#undef CPLUSPLUS_CPP_SPEC
24#undef LINK_GCC_C_SEQUENCE_SPEC
25
26#undef  TARGET_OS_CPP_BUILTINS	/* FIXME: sysv4.h should not define this! */
27#define TARGET_OS_CPP_BUILTINS()		\
28  do						\
29    {						\
30      NETBSD_OS_CPP_BUILTINS_ELF();		\
31      builtin_define ("__powerpc__");		\
32      builtin_assert ("cpu=powerpc");		\
33      builtin_assert ("machine=powerpc");	\
34      if (TARGET_SECURE_PLT)			\
35        builtin_define ("_SECURE_PLT");		\
36      if (TARGET_SOFT_FLOAT)			\
37        builtin_define ("_SOFT_FLOAT");		\
38      if (TARGET_ISEL)				\
39        builtin_define ("__PPC_ISEL__");	\
40    }						\
41  while (0)
42
43/* Override the default from rs6000.h to avoid conflicts with macros
44   defined in NetBSD header files.  */
45
46#undef  RS6000_CPU_CPP_ENDIAN_BUILTINS
47#define RS6000_CPU_CPP_ENDIAN_BUILTINS()	\
48  do						\
49    {						\
50      if (BYTES_BIG_ENDIAN)			\
51	{					\
52	  builtin_define ("__BIG_ENDIAN__");	\
53	  builtin_assert ("machine=bigendian");	\
54	}					\
55      else					\
56	{					\
57	  builtin_define ("__LITTLE_ENDIAN__");	\
58	  builtin_assert ("machine=littleendian"); \
59	}					\
60    }						\
61  while (0)
62
63/* Make GCC agree with <machine/ansi.h>.  */
64
65#undef  SIZE_TYPE
66#define SIZE_TYPE "unsigned int"
67
68#undef  PTRDIFF_TYPE
69#define PTRDIFF_TYPE "int"
70
71/* Redefine some types that where redefined by rs6000 include files.  */
72
73#undef WCHAR_TYPE
74#define WCHAR_TYPE "int"
75
76#undef WCHAR_TYPE_SIZE
77#define WCHAR_TYPE_SIZE 32
78
79#undef WINT_TYPE
80#define WINT_TYPE "int"
81
82#undef INT64_TYPE
83#define INT64_TYPE "long long int"
84
85#undef UINT64_TYPE
86#define UINT64_TYPE "long long unsigned int"
87
88#undef INTMAX_TYPE
89#define INTMAX_TYPE "long long int"
90
91#undef UINTMAX_TYPE
92#define UINTMAX_TYPE "long long unsigned int"
93
94/* Undo the spec mess from sysv4.h, and just define the specs
95   the way NetBSD systems actually expect.  */
96
97#undef  CPP_SPEC
98#define CPP_SPEC NETBSD_CPP_SPEC
99
100#undef  LINK_SPEC
101#define LINK_SPEC \
102  "%{!msdata=none:%{G*}} %{msdata=none:-G0} \
103   %(netbsd_link_spec)"
104
105#define NETBSD_ENTRY_POINT "_start"
106
107#undef  STARTFILE_SPEC
108#define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
109
110#undef  ENDFILE_SPEC
111#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC
112
113#undef  LIB_SPEC
114#define LIB_SPEC NETBSD_LIB_SPEC
115
116#undef  SUBTARGET_EXTRA_SPECS
117#define SUBTARGET_EXTRA_SPECS					\
118  { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },	\
119  NETBSD_SUBTARGET_EXTRA_SPECS
120
121/*
122 * Add NetBSD specific defaults: -mstrict-align
123 */
124#undef TARGET_DEFAULT
125#define TARGET_DEFAULT (MASK_STRICT_ALIGN)
126
127/*
128 * We know we have the right binutils for this (we shouldn't need to do this
129 * but until the cross build does the right thing...)
130 */
131#undef TARGET_SECURE_PLT
132#define TARGET_SECURE_PLT secure_plt
133#undef HAVE_AS_TLS
134#define HAVE_AS_TLS 1
135#define POWERPC_NETBSD
136
137/* Attempt to enable execute permissions on the stack.  */
138//#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
139// XXXMRG use enable-execute-stack-mprotect.c ?
140#ifdef L_trampoline
141#undef TRAMPOLINE_SIZE
142#define TRAMPOLINE_SIZE 48
143#endif
144
145/* Use standard DWARF numbering for DWARF debugging information.  */
146#define RS6000_USE_DWARF_NUMBERING
147
148