Skip to content

Commit ba04589

Browse files
galaknashif
authored andcommitted
Pull in RISC-V gcc-8.2 patches from https://github.com/riscv/riscv-gcc
Signed-off-by: Kumar Gala <[email protected]>
1 parent 55eba80 commit ba04589

22 files changed

+4228
-0
lines changed

patches/gcc/8.2.0/0001-Backport-of-RISC-V-support-for-libffi.patch

Lines changed: 918 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From 0b345eb3a1ec62baa9d9c82671e0842a194cb8a8 Mon Sep 17 00:00:00 2001
2+
From: wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
3+
Date: Tue, 8 May 2018 21:27:04 +0000
4+
Subject: [PATCH 02/22] [PATCH] RISC-V: Use new linker emulations for glibc
5+
ABI.
6+
7+
gcc/
8+
* config/riscv/linux.h (MUSL_ABI_SUFFIX): Delete unnecessary backslash.
9+
(LD_EMUL_SUFFIX): New.
10+
(LINK_SPEC): Use it.
11+
12+
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260056 138bc75d-0d04-0410-961f-82ee72b054a4
13+
---
14+
gcc/ChangeLog | 6 ++++++
15+
gcc/config/riscv/linux.h | 12 ++++++++++--
16+
2 files changed, 16 insertions(+), 2 deletions(-)
17+
18+
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
19+
index b93dae5dfb0..1083f9ee4e8 100644
20+
--- a/gcc/ChangeLog
21+
+++ b/gcc/ChangeLog
22+
@@ -1,3 +1,9 @@
23+
+2018-05-08 Jim Wilson <[email protected]>
24+
+
25+
+ * config/riscv/linux.h (MUSL_ABI_SUFFIX): Delete unnecessary backslash.
26+
+ (LD_EMUL_SUFFIX): New.
27+
+ (LINK_SPEC): Use it.
28+
+
29+
2018-07-26 Release Manager
30+
31+
* GCC 8.2.0 released.
32+
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
33+
index aa8a28d5d31..85561846dad 100644
34+
--- a/gcc/config/riscv/linux.h
35+
+++ b/gcc/config/riscv/linux.h
36+
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
37+
"%{mabi=ilp32d:}" \
38+
"%{mabi=lp64:-sf}" \
39+
"%{mabi=lp64f:-sp}" \
40+
- "%{mabi=lp64d:}" \
41+
+ "%{mabi=lp64d:}"
42+
43+
#undef MUSL_DYNAMIC_LINKER
44+
#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
45+
@@ -49,8 +49,16 @@ along with GCC; see the file COPYING3. If not see
46+
47+
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
48+
49+
+#define LD_EMUL_SUFFIX \
50+
+ "%{mabi=lp64d:}" \
51+
+ "%{mabi=lp64f:_lp64f}" \
52+
+ "%{mabi=lp64:_lp64}" \
53+
+ "%{mabi=ilp32d:}" \
54+
+ "%{mabi=ilp32f:_ilp32f}" \
55+
+ "%{mabi=ilp32:_ilp32}"
56+
+
57+
#define LINK_SPEC "\
58+
--melf" XLEN_SPEC "lriscv \
59+
+-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
60+
%{mno-relax:--no-relax} \
61+
%{shared} \
62+
%{!shared: \
63+
--
64+
2.20.1
65+
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
From eb64d6b593a51f2cf2a6e8b043b90e555c8f6c62 Mon Sep 17 00:00:00 2001
2+
From: wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
3+
Date: Wed, 9 May 2018 21:17:14 +0000
4+
Subject: [PATCH 03/22] RISC-V: Add with-multilib-list support.
5+
6+
gcc/
7+
PR target/84797
8+
* config.gcc (riscv*-*-*): Handle --with-multilib-list.
9+
* config/riscv/t-withmultilib: New.
10+
* config/riscv/withmultilib.h: New.
11+
* doc/install.texi: Document RISC-V --with-multilib-list support.
12+
13+
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260096 138bc75d-0d04-0410-961f-82ee72b054a4
14+
---
15+
gcc/ChangeLog | 8 +++++
16+
gcc/config.gcc | 52 +++++++++++++++++++++++++++++++++
17+
gcc/config/riscv/t-withmultilib | 6 ++++
18+
gcc/config/riscv/withmultilib.h | 51 ++++++++++++++++++++++++++++++++
19+
gcc/doc/install.texi | 11 +++++--
20+
5 files changed, 126 insertions(+), 2 deletions(-)
21+
create mode 100644 gcc/config/riscv/t-withmultilib
22+
create mode 100644 gcc/config/riscv/withmultilib.h
23+
24+
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
25+
index 1083f9ee4e8..98bd7ce0e07 100644
26+
--- a/gcc/ChangeLog
27+
+++ b/gcc/ChangeLog
28+
@@ -1,3 +1,11 @@
29+
+2018-05-09 Jim Wilson <[email protected]>
30+
+
31+
+ PR target/84797
32+
+ * config.gcc (riscv*-*-*): Handle --with-multilib-list.
33+
+ * config/riscv/t-withmultilib: New.
34+
+ * config/riscv/withmultilib.h: New.
35+
+ * doc/install.texi: Document RISC-V --with-multilib-list support.
36+
+
37+
2018-05-08 Jim Wilson <[email protected]>
38+
39+
* config/riscv/linux.h (MUSL_ABI_SUFFIX): Delete unnecessary backslash.
40+
diff --git a/gcc/config.gcc b/gcc/config.gcc
41+
index 532c33f4c2b..fd5d154e8f6 100644
42+
--- a/gcc/config.gcc
43+
+++ b/gcc/config.gcc
44+
@@ -4131,6 +4131,58 @@ case "${target}" in
45+
exit 1
46+
;;
47+
esac
48+
+
49+
+ # Handle --with-multilib-list.
50+
+ if test "x${with_multilib_list}" != xdefault; then
51+
+ tm_file="${tm_file} riscv/withmultilib.h"
52+
+ tmake_file="${tmake_file} riscv/t-withmultilib"
53+
+
54+
+ case ${with_multilib_list} in
55+
+ ilp32 | ilp32f | ilp32d \
56+
+ | lp64 | lp64f | lp64d )
57+
+ TM_MULTILIB_CONFIG="${with_arch},${with_multilib_list}"
58+
+ ;;
59+
+ *)
60+
+ echo "--with-multilib-list=${with_multilib_list} not supported."
61+
+ exit 1
62+
+ esac
63+
+
64+
+ # Define macros to select the default multilib.
65+
+ case ${with_arch} in
66+
+ rv32gc)
67+
+ tm_defines="${tm_defines} TARGET_MLIB_ARCH=1"
68+
+ ;;
69+
+ rv64gc)
70+
+ tm_defines="${tm_defines} TARGET_MLIB_ARCH=2"
71+
+ ;;
72+
+ *)
73+
+ echo "unsupported --with-arch for --with-multilib-list"
74+
+ exit 1
75+
+ esac
76+
+ case ${with_abi} in
77+
+ ilp32)
78+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=1"
79+
+ ;;
80+
+ ilp32f)
81+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=2"
82+
+ ;;
83+
+ ilp32d)
84+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=3"
85+
+ ;;
86+
+ lp64)
87+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=4"
88+
+ ;;
89+
+ lp64f)
90+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=5"
91+
+ ;;
92+
+ lp64d)
93+
+ tm_defines="${tm_defines} TARGET_MLIB_ABI=6"
94+
+ ;;
95+
+ *)
96+
+ echo "unsupported --with-abi for --with-multilib"
97+
+ exit 1
98+
+ esac
99+
+ fi
100+
;;
101+
102+
mips*-*-*)
103+
diff --git a/gcc/config/riscv/t-withmultilib b/gcc/config/riscv/t-withmultilib
104+
new file mode 100644
105+
index 00000000000..bcd0845b448
106+
--- /dev/null
107+
+++ b/gcc/config/riscv/t-withmultilib
108+
@@ -0,0 +1,6 @@
109+
+comma=,
110+
+MULTILIB_OPTIONS = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma), ,$(TM_MULTILIB_CONFIG)))))
111+
+MULTILIB_DIRNAMES = $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(subst $(comma), ,$(TM_MULTILIB_CONFIG))))
112+
+MULTILIB_OSDIRNAMES = $(subst lib,../lib,$(MULTILIB_DIRNAMES))
113+
+MULTILIB_REQUIRED = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma),/,$(TM_MULTILIB_CONFIG)))))
114+
+MULTILIB_REUSE =
115+
diff --git a/gcc/config/riscv/withmultilib.h b/gcc/config/riscv/withmultilib.h
116+
new file mode 100644
117+
index 00000000000..d703147fa64
118+
--- /dev/null
119+
+++ b/gcc/config/riscv/withmultilib.h
120+
@@ -0,0 +1,51 @@
121+
+/* MULTILIB_DEFAULTS definitions for --with-multilib-list.
122+
+ Copyright (C) 2018 Free Software Foundation, Inc.
123+
+
124+
+ This file is part of GCC.
125+
+
126+
+ GCC is free software; you can redistribute it and/or modify it
127+
+ under the terms of the GNU General Public License as published
128+
+ by the Free Software Foundation; either version 3, or (at your
129+
+ option) any later version.
130+
+
131+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
132+
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
133+
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
134+
+ License for more details.
135+
+
136+
+ Under Section 7 of GPL version 3, you are granted additional
137+
+ permissions described in the GCC Runtime Library Exception, version
138+
+ 3.1, as published by the Free Software Foundation.
139+
+
140+
+ You should have received a copy of the GNU General Public License and
141+
+ a copy of the GCC Runtime Library Exception along with this program;
142+
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
143+
+ <http://www.gnu.org/licenses/>. */
144+
+
145+
+#if TARGET_MLIB_ARCH == 1
146+
+
147+
+# if TARGET_MLIB_ABI == 1
148+
+# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32" }
149+
+# elif TARGET_MLIB_ABI == 2
150+
+# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32f" }
151+
+# elif TARGET_MLIB_ABI == 3
152+
+# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32d" }
153+
+# else
154+
+# error "unsupported TARGET_MLIB_ABI value for rv32gc"
155+
+# endif
156+
+
157+
+#elif TARGET_MLIB_ARCH == 2
158+
+
159+
+# if TARGET_MLIB_ABI == 4
160+
+# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64" }
161+
+# elif TARGET_MLIB_ABI == 5
162+
+# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64f" }
163+
+# elif TARGET_MLIB_ABI == 6
164+
+# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64d" }
165+
+# else
166+
+# error "unsupported TARGET_MLIB_ABI value for rv64gc"
167+
+# endif
168+
+
169+
+#else
170+
+# error "unsupported TARGET_MLIB_ARCH value"
171+
+#endif
172+
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
173+
index ec20fd26685..7c5cdc762d3 100644
174+
--- a/gcc/doc/install.texi
175+
+++ b/gcc/doc/install.texi
176+
@@ -1072,8 +1072,8 @@ sysv, aix.
177+
@itemx --without-multilib-list
178+
Specify what multilibs to build. @var{list} is a comma separated list of
179+
values, possibly consisting of a single value. Currently only implemented
180+
-for arm*-*-*, sh*-*-* and x86-64-*-linux*. The accepted values and meaning
181+
-for each target is given below.
182+
+for arm*-*-*, riscv*-*-*, sh*-*-* and x86-64-*-linux*. The accepted
183+
+values and meaning for each target is given below.
184+
185+
@table @code
186+
@item arm*-*-*
187+
@@ -1128,6 +1128,13 @@ and @code{rmprofile}.
188+
@code{-mfloat-abi=hard}
189+
@end multitable
190+
191+
+@item riscv*-*-*
192+
+@var{list} is a single ABI name. The target architecture must be either
193+
+@code{rv32gc} or @code{rv64gc}. This will build a single multilib for the
194+
+specified architecture and ABI pair. If @code{--with-multilib-list} is not
195+
+given, then a default set of multilibs is selected based on the value of
196+
+@option{--target}. This is usually a large set of multilibs.
197+
+
198+
@item sh*-*-*
199+
@var{list} is a comma separated list of CPU names. These must be of the
200+
form @code{sh*} or @code{m*} (in which case they match the compiler option
201+
--
202+
2.20.1
203+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
From 2d9231f25f3f9cfd03bc4969b95597f8c3e9d3c7 Mon Sep 17 00:00:00 2001
2+
From: wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
3+
Date: Wed, 16 May 2018 18:37:52 +0000
4+
Subject: [PATCH 04/22] RISC-V: Minor pattern name cleanup.
5+
6+
gcc/
7+
* config/riscv/riscv.md (<optab>si3_mask, <optab>si3_mask_1): Prepend
8+
asterisk to name.
9+
(<optab>di3_mask, <optab>di3_mask_1): Likewise.
10+
11+
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260299 138bc75d-0d04-0410-961f-82ee72b054a4
12+
---
13+
gcc/ChangeLog | 6 ++++++
14+
gcc/config/riscv/riscv.md | 8 ++++----
15+
2 files changed, 10 insertions(+), 4 deletions(-)
16+
17+
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
18+
index 98bd7ce0e07..aa2af8043f3 100644
19+
--- a/gcc/ChangeLog
20+
+++ b/gcc/ChangeLog
21+
@@ -1,3 +1,9 @@
22+
+2018-05-16 Jim Wilson <[email protected]>
23+
+
24+
+ * config/riscv/riscv.md (<optab>si3_mask, <optab>si3_mask_1): Prepend
25+
+ asterisk to name.
26+
+ (<optab>di3_mask, <optab>di3_mask_1): Likewise.
27+
+
28+
2018-05-09 Jim Wilson <[email protected]>
29+
30+
PR target/84797
31+
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
32+
index 9d222731a06..56fe516dbcf 100644
33+
--- a/gcc/config/riscv/riscv.md
34+
+++ b/gcc/config/riscv/riscv.md
35+
@@ -1504,7 +1504,7 @@
36+
[(set_attr "type" "shift")
37+
(set_attr "mode" "SI")])
38+
39+
-(define_insn_and_split "<optab>si3_mask"
40+
+(define_insn_and_split "*<optab>si3_mask"
41+
[(set (match_operand:SI 0 "register_operand" "= r")
42+
(any_shift:SI
43+
(match_operand:SI 1 "register_operand" " r")
44+
@@ -1523,7 +1523,7 @@
45+
[(set_attr "type" "shift")
46+
(set_attr "mode" "SI")])
47+
48+
-(define_insn_and_split "<optab>si3_mask_1"
49+
+(define_insn_and_split "*<optab>si3_mask_1"
50+
[(set (match_operand:SI 0 "register_operand" "= r")
51+
(any_shift:SI
52+
(match_operand:SI 1 "register_operand" " r")
53+
@@ -1559,7 +1559,7 @@
54+
[(set_attr "type" "shift")
55+
(set_attr "mode" "DI")])
56+
57+
-(define_insn_and_split "<optab>di3_mask"
58+
+(define_insn_and_split "*<optab>di3_mask"
59+
[(set (match_operand:DI 0 "register_operand" "= r")
60+
(any_shift:DI
61+
(match_operand:DI 1 "register_operand" " r")
62+
@@ -1579,7 +1579,7 @@
63+
[(set_attr "type" "shift")
64+
(set_attr "mode" "DI")])
65+
66+
-(define_insn_and_split "<optab>di3_mask_1"
67+
+(define_insn_and_split "*<optab>di3_mask_1"
68+
[(set (match_operand:DI 0 "register_operand" "= r")
69+
(any_shift:DI
70+
(match_operand:DI 1 "register_operand" " r")
71+
--
72+
2.20.1
73+

0 commit comments

Comments
 (0)