1 |
13 |
serginhofr |
--- original-gcc/config.sub
|
2 |
|
|
+++ gcc/config.sub
|
3 |
|
|
@@ -340,6 +340,9 @@ case $basic_machine in
|
4 |
|
|
ms1)
|
5 |
|
|
basic_machine=mt-unknown
|
6 |
|
|
;;
|
7 |
|
|
+ riscv)
|
8 |
|
|
+ basic_machine=riscv-ucb
|
9 |
|
|
+ ;;
|
10 |
|
|
|
11 |
|
|
strongarm | thumb | xscale)
|
12 |
|
|
basic_machine=arm-unknown
|
13 |
|
|
--- original-gcc/gcc/config.gcc
|
14 |
|
|
+++ gcc/gcc/config.gcc
|
15 |
|
|
@@ -439,6 +439,10 @@ powerpc*-*-*)
|
16 |
|
|
esac
|
17 |
|
|
extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
|
18 |
|
|
;;
|
19 |
|
|
+riscv*)
|
20 |
|
|
+ cpu_type=riscv
|
21 |
|
|
+ need_64bit_hwint=yes
|
22 |
|
|
+ ;;
|
23 |
|
|
rs6000*-*-*)
|
24 |
|
|
extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
|
25 |
|
|
;;
|
26 |
|
|
@@ -1976,6 +1980,34 @@ microblaze*-*-elf)
|
27 |
|
|
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
|
28 |
|
|
tmake_file="${tmake_file} microblaze/t-microblaze"
|
29 |
|
|
;;
|
30 |
|
|
+riscv32*-*-linux*)
|
31 |
|
|
+ tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h riscv/default-32.h ${tm_file} riscv/linux.h riscv/linux64.h"
|
32 |
|
|
+ tmake_file="${tmake_file} riscv/t-linux64"
|
33 |
|
|
+ gnu_ld=yes
|
34 |
|
|
+ gas=yes
|
35 |
|
|
+ gcc_cv_initfini_array=yes
|
36 |
|
|
+ ;;
|
37 |
|
|
+riscv*-*-linux*)
|
38 |
|
|
+ tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h riscv/linux64.h"
|
39 |
|
|
+ tmake_file="${tmake_file} riscv/t-linux64"
|
40 |
|
|
+ gnu_ld=yes
|
41 |
|
|
+ gas=yes
|
42 |
|
|
+ gcc_cv_initfini_array=yes
|
43 |
|
|
+ ;;
|
44 |
|
|
+riscv32*-*-elf*)
|
45 |
|
|
+ tm_file="elfos.h newlib-stdint.h riscv/default-32.h ${tm_file} riscv/elf.h"
|
46 |
|
|
+ tmake_file="${tmake_file} riscv/t-elf"
|
47 |
|
|
+ gnu_ld=yes
|
48 |
|
|
+ gas=yes
|
49 |
|
|
+ gcc_cv_initfini_array=yes
|
50 |
|
|
+ ;;
|
51 |
|
|
+riscv*-*-elf*)
|
52 |
|
|
+ tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
|
53 |
|
|
+ tmake_file="${tmake_file} riscv/t-elf"
|
54 |
|
|
+ gnu_ld=yes
|
55 |
|
|
+ gas=yes
|
56 |
|
|
+ gcc_cv_initfini_array=yes
|
57 |
|
|
+ ;;
|
58 |
|
|
mips*-*-netbsd*) # NetBSD/mips, either endian.
|
59 |
|
|
target_cpu_default="MASK_ABICALLS"
|
60 |
|
|
tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
|
61 |
|
|
@@ -3860,6 +3892,31 @@ case "${target}" in
|
62 |
|
|
done
|
63 |
|
|
;;
|
64 |
|
|
|
65 |
|
|
+ riscv*-*-*)
|
66 |
|
|
+ supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64"
|
67 |
|
|
+
|
68 |
|
|
+ case ${with_float} in
|
69 |
|
|
+ "" | soft | hard)
|
70 |
|
|
+ # OK
|
71 |
|
|
+ ;;
|
72 |
|
|
+ *)
|
73 |
|
|
+ echo "Unknown floating point type used in --with-float=$with_float" 1>&2
|
74 |
|
|
+ exit 1
|
75 |
|
|
+ ;;
|
76 |
|
|
+ esac
|
77 |
|
|
+
|
78 |
|
|
+ case ${with_abi} in
|
79 |
|
|
+ "" | 32 | 64)
|
80 |
|
|
+ # OK
|
81 |
|
|
+ ;;
|
82 |
|
|
+ *)
|
83 |
|
|
+ echo "Unknown ABI used in --with-abi=$with_abi" 1>&2
|
84 |
|
|
+ exit 1
|
85 |
|
|
+ ;;
|
86 |
|
|
+ esac
|
87 |
|
|
+
|
88 |
|
|
+ ;;
|
89 |
|
|
+
|
90 |
|
|
mips*-*-*)
|
91 |
|
|
supported_defaults="abi arch arch_32 arch_64 float fpu nan fp_32 odd_spreg_32 tune tune_32 tune_64 divide llsc mips-plt synci"
|
92 |
|
|
|
93 |
|
|
--- original-gcc/gcc/configure
|
94 |
|
|
+++ gcc/gcc/configure
|
95 |
|
|
@@ -23717,6 +23717,25 @@ x3: .space 4
|
96 |
|
|
tls_first_minor=14
|
97 |
|
|
tls_as_opt="-a32 --fatal-warnings"
|
98 |
|
|
;;
|
99 |
|
|
+ riscv*-*-*)
|
100 |
|
|
+ conftest_s='
|
101 |
|
|
+ .section .tdata,"awT",@progbits
|
102 |
|
|
+x:
|
103 |
|
|
+ .word 2
|
104 |
|
|
+ .text
|
105 |
|
|
+ la.tls.gd a0,x
|
106 |
|
|
+ la.tls.ie a1,x
|
107 |
|
|
+ lui a0,%tls_ie_pcrel_hi(x)
|
108 |
|
|
+ lw a0,%pcrel_lo(x)(a0)
|
109 |
|
|
+ add a0,a0,tp
|
110 |
|
|
+ lw a0,0(a0)
|
111 |
|
|
+ lui a0,%tprel_hi(x)
|
112 |
|
|
+ add a0,a0,tp,%tprel_add(x)
|
113 |
|
|
+ lw a0,%tprel_lo(x)(a0)'
|
114 |
|
|
+ tls_first_major=2
|
115 |
|
|
+ tls_first_minor=21
|
116 |
|
|
+ tls_as_opt='-m32 --fatal-warnings'
|
117 |
|
|
+ ;;
|
118 |
|
|
s390-*-*)
|
119 |
|
|
conftest_s='
|
120 |
|
|
.section ".tdata","awT",@progbits
|
121 |
|
|
--- original-gcc/gcc/configure.ac
|
122 |
|
|
+++ gcc/gcc/configure.ac
|
123 |
|
|
@@ -3263,6 +3263,25 @@ x3: .space 4
|
124 |
|
|
tls_first_minor=14
|
125 |
|
|
tls_as_opt="-a32 --fatal-warnings"
|
126 |
|
|
;;
|
127 |
|
|
+ riscv*-*-*)
|
128 |
|
|
+ conftest_s='
|
129 |
|
|
+ .section .tdata,"awT",@progbits
|
130 |
|
|
+x:
|
131 |
|
|
+ .word 2
|
132 |
|
|
+ .text
|
133 |
|
|
+ la.tls.gd a0,x
|
134 |
|
|
+ la.tls.ie a1,x
|
135 |
|
|
+ lui a0,%tls_ie_pcrel_hi(x)
|
136 |
|
|
+ lw a0,%pcrel_lo(x)(a0)
|
137 |
|
|
+ add a0,a0,tp
|
138 |
|
|
+ lw a0,0(a0)
|
139 |
|
|
+ lui a0,%tprel_hi(x)
|
140 |
|
|
+ add a0,a0,tp,%tprel_add(x)
|
141 |
|
|
+ lw a0,%tprel_lo(x)(a0)'
|
142 |
|
|
+ tls_first_major=2
|
143 |
|
|
+ tls_first_minor=21
|
144 |
|
|
+ tls_as_opt='-m32 --fatal-warnings'
|
145 |
|
|
+ ;;
|
146 |
|
|
s390-*-*)
|
147 |
|
|
conftest_s='
|
148 |
|
|
.section ".tdata","awT",@progbits
|
149 |
|
|
--- original-gcc/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
|
150 |
|
|
+++ gcc/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
|
151 |
|
|
@@ -6,6 +6,9 @@
|
152 |
|
|
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc)
|
153 |
|
|
/* On PPC division by zero does not trap. */
|
154 |
|
|
# define DO_TEST 0
|
155 |
|
|
+#elif defined (__riscv__)
|
156 |
|
|
+ /* On RISC-V division by zero does not trap. */
|
157 |
|
|
+# define DO_TEST 0
|
158 |
|
|
#elif defined (__SPU__)
|
159 |
|
|
/* On SPU division by zero does not trap. */
|
160 |
|
|
# define DO_TEST 0
|
161 |
|
|
--- original-gcc/gcc/testsuite/gcc.dg/20020312-2.c
|
162 |
|
|
+++ gcc/gcc/testsuite/gcc.dg/20020312-2.c
|
163 |
|
|
@@ -66,6 +66,8 @@ extern void abort (void);
|
164 |
|
|
# else
|
165 |
|
|
# define PIC_REG "30"
|
166 |
|
|
# endif
|
167 |
|
|
+#elif defined(__riscv__)
|
168 |
|
|
+/* No pic register. */
|
169 |
|
|
#elif defined(__RX__)
|
170 |
|
|
/* No pic register. */
|
171 |
|
|
#elif defined(__s390__)
|
172 |
|
|
--- original-gcc/gcc/testsuite/gcc.dg/20040813-1.c
|
173 |
|
|
+++ gcc/gcc/testsuite/gcc.dg/20040813-1.c
|
174 |
|
|
@@ -2,7 +2,7 @@
|
175 |
|
|
/* Contributed by Devang Patel */
|
176 |
|
|
|
177 |
|
|
/* { dg-do compile } */
|
178 |
|
|
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* nvptx-*-* } { "*" } { "" } } */
|
179 |
|
|
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* riscv*-*-* tile*-*-* nios2-*-* *-*-vxworks* nvptx-*-* } { "*" } { "" } } */
|
180 |
|
|
/* { dg-options "-gstabs" } */
|
181 |
|
|
|
182 |
|
|
int
|
183 |
|
|
--- original-gcc/gcc/testsuite/gcc.dg/stack-usage-1.c
|
184 |
|
|
+++ gcc/gcc/testsuite/gcc.dg/stack-usage-1.c
|
185 |
|
|
@@ -61,6 +61,8 @@
|
186 |
|
|
# else
|
187 |
|
|
# define SIZE 240
|
188 |
|
|
# endif
|
189 |
|
|
+#elif defined (__riscv__)
|
190 |
|
|
+# define SIZE 240
|
191 |
|
|
#elif defined (__AVR__)
|
192 |
|
|
# define SIZE 254
|
193 |
|
|
#elif defined (__s390x__)
|
194 |
|
|
--- original-gcc/libatomic/configure.tgt
|
195 |
|
|
+++ gcc/libatomic/configure.tgt
|
196 |
|
|
@@ -33,6 +33,7 @@ case "${target_cpu}" in
|
197 |
|
|
ARCH=alpha
|
198 |
|
|
;;
|
199 |
|
|
rs6000 | powerpc*) ARCH=powerpc ;;
|
200 |
|
|
+ riscv*) ARCH=riscv ;;
|
201 |
|
|
sh*) ARCH=sh ;;
|
202 |
|
|
|
203 |
|
|
arm*)
|
204 |
|
|
--- original-gcc/libgcc/config.host
|
205 |
|
|
+++ gcc/libgcc/config.host
|
206 |
|
|
@@ -167,6 +167,9 @@ powerpc*-*-*)
|
207 |
|
|
;;
|
208 |
|
|
rs6000*-*-*)
|
209 |
|
|
;;
|
210 |
|
|
+riscv*)
|
211 |
|
|
+ cpu_type=riscv
|
212 |
|
|
+ ;;
|
213 |
|
|
sparc64*-*-*)
|
214 |
|
|
cpu_type=sparc
|
215 |
|
|
;;
|
216 |
|
|
@@ -1059,6 +1062,18 @@ powerpcle-*-eabi*)
|
217 |
|
|
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
|
218 |
|
|
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
|
219 |
|
|
;;
|
220 |
|
|
+riscv32*-*-linux*)
|
221 |
|
|
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf riscv/t-elf32"
|
222 |
|
|
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
|
223 |
|
|
+ ;;
|
224 |
|
|
+riscv*-*-linux*)
|
225 |
|
|
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf"
|
226 |
|
|
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
|
227 |
|
|
+ ;;
|
228 |
|
|
+riscv*-*-*)
|
229 |
|
|
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf"
|
230 |
|
|
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
|
231 |
|
|
+ ;;
|
232 |
|
|
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
|
233 |
|
|
md_unwind_header=rs6000/aix-unwind.h
|
234 |
|
|
tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix rs6000/t-ibm-ldouble"
|
235 |
|
|
--- original-gcc/libsanitizer/asan/asan_linux.cc
|
236 |
|
|
+++ gcc/libsanitizer/asan/asan_linux.cc
|
237 |
|
|
@@ -213,6 +213,11 @@ void GetPcSpBp(void *context, uptr *pc,
|
238 |
|
|
*pc = ucontext->uc_mcontext.gregs[31];
|
239 |
|
|
*bp = ucontext->uc_mcontext.gregs[30];
|
240 |
|
|
*sp = ucontext->uc_mcontext.gregs[29];
|
241 |
|
|
+# elif defined(__riscv__)
|
242 |
|
|
+ ucontext_t *ucontext = (ucontext_t*)context;
|
243 |
|
|
+ *pc = ucontext->uc_mcontext.gregs[REG_PC];
|
244 |
|
|
+ *bp = ucontext->uc_mcontext.gregs[REG_S0];
|
245 |
|
|
+ *sp = ucontext->uc_mcontext.gregs[REG_SP];
|
246 |
|
|
#else
|
247 |
|
|
# error "Unsupported arch"
|
248 |
|
|
#endif
|
249 |
|
|
--- original-gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
|
250 |
|
|
+++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
|
251 |
|
|
@@ -61,7 +61,8 @@ namespace __sanitizer {
|
252 |
|
|
} // namespace __sanitizer
|
253 |
|
|
|
254 |
|
|
#if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\
|
255 |
|
|
- && !defined(__mips__) && !defined(__sparc__)
|
256 |
|
|
+ && !defined(__mips__) && !defined(__sparc__)\
|
257 |
|
|
+ && !defined(__riscv__)
|
258 |
|
|
COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
|
259 |
|
|
#endif
|
260 |
|
|
|
261 |
|
|
--- original-gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
|
262 |
|
|
+++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
|
263 |
|
|
@@ -72,6 +72,10 @@ namespace __sanitizer {
|
264 |
|
|
const unsigned struct_kernel_stat_sz = 144;
|
265 |
|
|
#endif
|
266 |
|
|
const unsigned struct_kernel_stat64_sz = 104;
|
267 |
|
|
+#elif defined(__riscv__)
|
268 |
|
|
+ const unsigned struct___old_kernel_stat_sz = 0;
|
269 |
|
|
+ const unsigned struct_kernel_stat_sz = 128;
|
270 |
|
|
+ const unsigned struct_kernel_stat64_sz = 128;
|
271 |
|
|
#elif defined(__sparc__) && defined(__arch64__)
|
272 |
|
|
const unsigned struct___old_kernel_stat_sz = 0;
|
273 |
|
|
const unsigned struct_kernel_stat_sz = 104;
|
274 |
|
|
@@ -511,7 +515,7 @@ namespace __sanitizer {
|
275 |
|
|
typedef long __sanitizer___kernel_off_t;
|
276 |
|
|
#endif
|
277 |
|
|
|
278 |
|
|
-#if defined(__powerpc__) || defined(__mips__)
|
279 |
|
|
+#if defined(__powerpc__) || defined(__mips__) || defined(__riscv__)
|
280 |
|
|
typedef unsigned int __sanitizer___kernel_old_uid_t;
|
281 |
|
|
typedef unsigned int __sanitizer___kernel_old_gid_t;
|
282 |
|
|
#else
|
283 |
|
|
diff -ru gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform.h gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform.h
|
284 |
|
|
--- gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform.h 2015-05-13 19:36:27.061421043 -0700
|
285 |
|
|
+++ gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform.h 2015-05-13 19:44:19.274355577 -0700
|
286 |
|
|
@@ -98,9 +98,9 @@
|
287 |
|
|
|
288 |
|
|
// The AArch64 linux port uses the canonical syscall set as mandated by
|
289 |
|
|
// the upstream linux community for all new ports. Other ports may still
|
290 |
|
|
-// use legacy syscalls.
|
291 |
|
|
+// use legacy syscalls. The RISC-V port also does this.
|
292 |
|
|
#ifndef SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
|
293 |
|
|
-# if defined(__aarch64__) && SANITIZER_LINUX
|
294 |
|
|
+# if (defined(__aarch64__) || defined(__riscv__)) && SANITIZER_LINUX
|
295 |
|
|
# define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 1
|
296 |
|
|
# else
|
297 |
|
|
# define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 0
|
298 |
|
|
diff -ru gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
|
299 |
|
|
--- gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2015-05-13 19:36:27.061421043 -0700
|
300 |
|
|
+++ gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2015-05-13 19:39:13.515487834 -0700
|
301 |
|
|
@@ -73,7 +73,6 @@
|
302 |
|
|
#endif
|
303 |
|
|
const unsigned struct_kernel_stat64_sz = 104;
|
304 |
|
|
#elif defined(__riscv__)
|
305 |
|
|
- const unsigned struct___old_kernel_stat_sz = 0;
|
306 |
|
|
const unsigned struct_kernel_stat_sz = 128;
|
307 |
|
|
const unsigned struct_kernel_stat64_sz = 128;
|
308 |
|
|
#elif defined(__sparc__) && defined(__arch64__)
|
309 |
|
|
@@ -104,7 +103,7 @@
|
310 |
|
|
|
311 |
|
|
#if SANITIZER_LINUX || SANITIZER_FREEBSD
|
312 |
|
|
|
313 |
|
|
-#if defined(__powerpc64__)
|
314 |
|
|
+#if defined(__powerpc64__) || defined(__riscv__)
|
315 |
|
|
const unsigned struct___old_kernel_stat_sz = 0;
|
316 |
|
|
#elif !defined(__sparc__)
|
317 |
|
|
const unsigned struct___old_kernel_stat_sz = 32;
|
318 |
|
|
--- original-gcc/libstdc++-v3/configure
|
319 |
|
|
+++ gcc/libstdc++-v3/configure
|
320 |
|
|
@@ -16641,7 +16641,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
321 |
|
|
# Long term, -std=c++0x could be even better, could manage to explicitly
|
322 |
|
|
# request C99 facilities to the underlying C headers.
|
323 |
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
324 |
|
|
- CXXFLAGS="$CXXFLAGS -std=c++98"
|
325 |
|
|
+ CXXFLAGS="$CXXFLAGS -std=gnu++98"
|
326 |
|
|
ac_save_LIBS="$LIBS"
|
327 |
|
|
ac_save_gcc_no_link="$gcc_no_link"
|
328 |
|
|
|
329 |
|
|
@@ -17263,9 +17263,11 @@ rm -f core conftest.err conftest.$ac_obj
|
330 |
|
|
$as_echo "$glibcxx_cv_c99_wchar" >&6; }
|
331 |
|
|
fi
|
332 |
|
|
|
333 |
|
|
+ # For newlib, don't check complex since missing c99 functions, but
|
334 |
|
|
+ # rest of c99 stuff is there so don't loose it
|
335 |
|
|
# Option parsed, now set things appropriately.
|
336 |
|
|
if test x"$glibcxx_cv_c99_math" = x"no" ||
|
337 |
|
|
- test x"$glibcxx_cv_c99_complex" = x"no" ||
|
338 |
|
|
+ # test x"$glibcxx_cv_c99_complex" = x"no" ||
|
339 |
|
|
test x"$glibcxx_cv_c99_stdio" = x"no" ||
|
340 |
|
|
test x"$glibcxx_cv_c99_stdlib" = x"no" ||
|
341 |
|
|
test x"$glibcxx_cv_c99_wchar" = x"no"; then
|
342 |
|
|
|