xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/riscv/netbsd.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
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 TARGET_USE_GP
24 #define TARGET_USE_GP 0
25 
26 #undef DRIVER_SELF_SPECS
27 #define DRIVER_SELF_SPECS ""
28 
29 #undef TARGET_DEFAULT
30 #define TARGET_DEFAULT (MASK_FDIV)
31 
32 #undef TARGET_DEFAULT_CMODEL
33 #define TARGET_DEFAULT_CMODEL	CM_MEDANY
34 
35 #define TARGET_OS_CPP_BUILTINS()				\
36   do {								\
37     NETBSD_OS_CPP_BUILTINS_ELF();				\
38     /* The GNU C++ standard library requires this.  */		\
39     if (c_dialect_cxx ())					\
40       builtin_define ("_GNU_SOURCE");				\
41     if (!TARGET_HARD_FLOAT_ABI)					\
42       builtin_define ("_SOFT_FLOAT");				\
43   } while (0)
44 
45 #undef CPP_SPEC
46 #define CPP_SPEC NETBSD_CPP_SPEC
47 
48 #undef LIB_SPEC
49 #define LIB_SPEC NETBSD_LIB_SPEC
50 
51 #undef LINK_SPEC
52 #define LINK_SPEC NETBSD_LINK_SPEC_ELF
53 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
54    This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
55    the MIPS target.  */
56 
57 #undef LINK_SPEC
58 #define LINK_SPEC \
59   "%{m64:-m elf64lriscv} \
60    %{m32:-m elf32lriscv} \
61    %(netbsd_link_spec)"
62 
63 #undef NETBSD_ENTRY_POINT
64 #define NETBSD_ENTRY_POINT	"_start"
65 
66 #define SIG_ATOMIC_TYPE   "int"
67 
68 #define INT8_TYPE "signed char"
69 #define INT16_TYPE "short int"
70 #define INT32_TYPE "int"
71 #define INT64_TYPE "long long int"
72 #define UINT8_TYPE "unsigned char"
73 #define UINT16_TYPE "short unsigned int"
74 #define UINT32_TYPE "unsigned int"
75 #define UINT64_TYPE "long long unsigned int"
76 
77 #define INT_LEAST8_TYPE "signed char"
78 #define INT_LEAST16_TYPE "short int"
79 #define INT_LEAST32_TYPE "int"
80 #define INT_LEAST64_TYPE "long long int"
81 #define UINT_LEAST8_TYPE "unsigned char"
82 #define UINT_LEAST16_TYPE "short unsigned int"
83 #define UINT_LEAST32_TYPE "unsigned int"
84 #define UINT_LEAST64_TYPE "long long unsigned int"
85 
86 #define INT_FAST8_TYPE "signed char"
87 #define INT_FAST16_TYPE "short int"
88 #define INT_FAST32_TYPE "int"
89 #define INT_FAST64_TYPE "long long int"
90 #define UINT_FAST8_TYPE "unsigned char"
91 #define UINT_FAST16_TYPE "short unsigned int"
92 #define UINT_FAST32_TYPE "unsigned int"
93 #define UINT_FAST64_TYPE "long long unsigned int"
94 
95 #undef PTRDIFF_TYPE
96 #define PTRDIFF_TYPE "long int"
97 
98 #undef SIZE_TYPE
99 #define SIZE_TYPE "long unsigned int"
100 
101 #define INTPTR_TYPE PTRDIFF_TYPE
102 #define UINTPTR_TYPE SIZE_TYPE
103 
104 #undef INTMAX_TYPE
105 #define INTMAX_TYPE "long long int"
106 
107 #undef UINTMAX_TYPE
108 #define UINTMAX_TYPE "long long unsigned int"
109