xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/riscv/netbsd.h (revision 1debfc3d3fad8af6f31804271c18e67f77b4d718)
1 /* Definitions for RISCV running NetBSD systems using ELF
2    Copyright (C) 2014
3    Free Software Foundation, Inc.
4    Contributed by Matt Thomas <matt@netbsd.org>
5 
6 This file is part of GNU CC.
7 
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12 
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22 
23 #undef DRIVER_SELF_SPECS
24 #define DRIVER_SELF_SPECS ""
25 
26 #undef TARGET_DEFAULT
27 #define TARGET_DEFAULT (MASK_FDIV)
28 
29 #undef TARGET_DEFAULT_CMODEL
30 #define TARGET_DEFAULT_CMODEL	CM_MEDANY
31 
32 #define TARGET_OS_CPP_BUILTINS()				\
33   do {								\
34     NETBSD_OS_CPP_BUILTINS_ELF();				\
35     builtin_define ("__riscv__");				\
36     /* The GNU C++ standard library requires this.  */		\
37     if (c_dialect_cxx ())					\
38       builtin_define ("_GNU_SOURCE");				\
39     if (!TARGET_HARD_FLOAT)					\
40       builtin_define ("_SOFT_FLOAT");				\
41   } while (0)
42 
43 #undef CPP_SPEC
44 #define CPP_SPEC NETBSD_CPP_SPEC
45 
46 #undef LIB_SPEC
47 #define LIB_SPEC NETBSD_LIB_SPEC
48 
49 #define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS
50 
51 #undef STARTFILE_PREFIX_SPEC
52 
53 #define LD_EMUL_SUFFIX \
54   "%{mabi=lp64d:}" \
55   "%{mabi=lp64f:_lp64f}" \
56   "%{mabi=lp64:_lp64}" \
57   "%{mabi=ilp32d:}" \
58   "%{mabi=ilp32f:_ilp32f}" \
59   "%{mabi=ilp32:_ilp32}"
60 
61 #undef LINK_SPEC
62 #define LINK_SPEC \
63   "-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX \
64   "%(netbsd_link_spec)"
65 
66 #undef NETBSD_ENTRY_POINT
67 #define NETBSD_ENTRY_POINT	"_start"
68 
69 /* Override netbsd-stdint.h uintptr_t and inptr_t. */
70 #undef UINTPTR_TYPE
71 #define UINTPTR_TYPE "long unsigned int"
72 
73 #undef INTPTR_TYPE
74 #define INTPTR_TYPE "long int"
75