Skip to content

Commit 4b0ff1e

Browse files
committed
devkitA64: add gcc patch for r29
1 parent 0ddec6c commit 4b0ff1e

2 files changed

Lines changed: 381 additions & 1 deletion

File tree

patches/gcc-15.2.0-3.patch

Lines changed: 380 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,380 @@
1+
diff --git a/gcc/config.gcc b/gcc/config.gcc
2+
index 087aaa7be37..8ae1a7bbaf4 100644
3+
--- a/gcc/config.gcc
4+
+++ b/gcc/config.gcc
5+
@@ -1192,7 +1192,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
6+
tmake_file="${tmake_file} aarch64/t-aarch64"
7+
case $target in
8+
aarch64-*-elf*)
9+
+ default_use_cxa_atexit=yes
10+
use_gcc_stdint=wrap
11+
+ tm_file="${tm_file} devkitpro.h"
12+
+ tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
13+
+ extra_options="${extra_options} devkitpro.opt"
14+
+ case ${enable_threads} in
15+
+ "" | yes | posix) thread_file='posix' ;;
16+
+ esac
17+
;;
18+
aarch64-*-fuchsia*)
19+
tm_file="${tm_file} fuchsia.h"
20+
diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h
21+
index 15cf1eb0389..aba0e9bbff9 100644
22+
--- a/gcc/config/aarch64/aarch64-elf-raw.h
23+
+++ b/gcc/config/aarch64/aarch64-elf-raw.h
24+
@@ -22,6 +22,7 @@
25+
#ifndef GCC_AARCH64_ELF_RAW_H
26+
#define GCC_AARCH64_ELF_RAW_H
27+
28+
+#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L %(libgloss) --end-group"
29+
#define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s"
30+
#define ENDFILE_SPEC \
31+
" crtend%O%s crtn%O%s " \
32+
diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
33+
index a6ca5cf016b..90470fd6c44 100644
34+
--- a/gcc/config/aarch64/aarch64-opts.h
35+
+++ b/gcc/config/aarch64/aarch64-opts.h
36+
@@ -91,7 +91,8 @@ enum aarch64_tp_reg {
37+
AARCH64_TPIDR_EL1 = 1,
38+
AARCH64_TPIDR_EL2 = 2,
39+
AARCH64_TPIDR_EL3 = 3,
40+
- AARCH64_TPIDRRO_EL0 = 4
41+
+ AARCH64_TPIDRRO_EL0 = 4,
42+
+ AARCH64_TP_SOFT = 5
43+
};
44+
45+
/* SVE vector register sizes. */
46+
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
47+
index 6d6b6552a71..1595f0951e5 100644
48+
--- a/gcc/config/aarch64/aarch64.cc
49+
+++ b/gcc/config/aarch64/aarch64.cc
50+
@@ -21393,8 +21393,24 @@ aarch64_load_tp (rtx target)
51+
|| !register_operand (target, Pmode))
52+
target = gen_reg_rtx (Pmode);
53+
54+
- /* Can return in any reg. */
55+
- emit_insn (gen_aarch64_load_tp_hard (target));
56+
+ if (TARGET_HARD_TP)
57+
+ {
58+
+ /* Can return in any reg. */
59+
+ emit_insn (gen_aarch64_load_tp_hard (target));
60+
+ }
61+
+ else
62+
+ {
63+
+ /* Always returned in r0. Immediately copy the result into a pseudo,
64+
+ otherwise other uses of r0 (e.g. setting up function arguments) may
65+
+ clobber the value. */
66+
+
67+
+ rtx tmp;
68+
+
69+
+ emit_insn (gen_aarch64_load_tp_soft ());
70+
+
71+
+ tmp = gen_rtx_REG (DImode, R0_REGNUM);
72+
+ emit_move_insn (target, tmp);
73+
+ }
74+
return target;
75+
}
76+
77+
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
78+
index e8bd8c73c12..4fc0d8f4ded 100644
79+
--- a/gcc/config/aarch64/aarch64.h
80+
+++ b/gcc/config/aarch64/aarch64.h
81+
@@ -1436,6 +1436,10 @@ typedef struct
82+
/* Check TLS Descriptors mechanism is selected. */
83+
#define TARGET_TLS_DESC (aarch64_tls_dialect == TLS_DESCRIPTORS)
84+
85+
+/* Check selected thread pointer access sequence to use. */
86+
+#define TARGET_HARD_TP (aarch64_tpidr_reg != AARCH64_TP_SOFT)
87+
+#define TARGET_SOFT_TP (aarch64_tpidr_reg == AARCH64_TP_SOFT)
88+
+
89+
extern enum aarch64_code_model aarch64_cmodel;
90+
91+
/* When using the tiny addressing model conditional and unconditional branches
92+
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
93+
index 79bbf5fafb3..e648866c39f 100644
94+
--- a/gcc/config/aarch64/aarch64.md
95+
+++ b/gcc/config/aarch64/aarch64.md
96+
@@ -7710,11 +7710,22 @@
97+
(define_insn "aarch64_load_tp_hard"
98+
[(set (match_operand:DI 0 "register_operand" "=r")
99+
(unspec:DI [(const_int 0)] UNSPEC_TLS))]
100+
- ""
101+
+ "TARGET_HARD_TP"
102+
"* return aarch64_output_load_tp (operands[0]);"
103+
[(set_attr "type" "mrs")]
104+
)
105+
106+
+(define_insn "aarch64_load_tp_soft"
107+
+ [(set (reg:DI 0) (unspec:DI [(const_int 0)] UNSPEC_TLS))
108+
+ (clobber (reg:DI IP0_REGNUM))
109+
+ (clobber (reg:DI IP1_REGNUM))
110+
+ (clobber (reg:DI LR_REGNUM))
111+
+ (clobber (reg:CC CC_REGNUM))]
112+
+ "TARGET_SOFT_TP"
113+
+ "bl\\t__aarch64_read_tp\\t// aarch64_load_tp_soft"
114+
+ [(set_attr "type" "branch")]
115+
+)
116+
+
117+
;; The TLS ABI specifically requires that the compiler does not schedule
118+
;; instructions in the TLS stubs, in order to enable linker relaxation.
119+
;; Therefore we treat the stubs as an atomic sequence.
120+
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
121+
index f32d56d4ffa..7cf8d3ba3d4 100644
122+
--- a/gcc/config/aarch64/aarch64.opt
123+
+++ b/gcc/config/aarch64/aarch64.opt
124+
@@ -137,6 +137,9 @@ Enum(tp_reg) String(tpidr_el3) Value(AARCH64_TPIDR_EL3)
125+
EnumValue
126+
Enum(tp_reg) String(tpidrro_el0) Value(AARCH64_TPIDRRO_EL0)
127+
128+
+EnumValue
129+
+Enum(tp_reg) String(soft) Value(AARCH64_TP_SOFT)
130+
+
131+
mtp=
132+
Target RejectNegative Joined Enum(tp_reg) Var(aarch64_tpidr_reg) Init(AARCH64_TPIDR_EL0) Save
133+
Specify the thread pointer register.
134+
@@ -338,7 +341,7 @@ TargetVariable
135+
long aarch64_stack_protector_guard_offset = 0
136+
137+
moutline-atomics
138+
-Target Var(aarch64_flag_outline_atomics) Init(2) Save
139+
+Target Var(aarch64_flag_outline_atomics) Save
140+
Generate local calls to out-of-line atomic operations.
141+
142+
-param=aarch64-vect-compare-costs=
143+
diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64
144+
index 59571948479..f50c37d8b3c 100644
145+
--- a/gcc/config/aarch64/t-aarch64
146+
+++ b/gcc/config/aarch64/t-aarch64
147+
@@ -198,8 +198,10 @@ aarch64-ldp-fusion.o: $(srcdir)/config/aarch64/aarch64-ldp-fusion.cc \
148+
$(srcdir)/config/aarch64/aarch64-ldp-fusion.cc
149+
150+
comma=,
151+
-MULTILIB_OPTIONS = $(subst $(comma),/, $(patsubst %, mabi=%, $(subst $(comma),$(comma)mabi=,$(TM_MULTILIB_CONFIG))))
152+
-MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG))
153+
+MULTILIB_OPTIONS = mcmodel=large fPIC
154+
+MULTILIB_DIRNAMES = large pic
155+
+MULTILIB_REQUIRED = mcmodel=large fPIC
156+
+MULTILIB_MATCHES = fPIC=fpic fPIC=fpie fPIC=fPIE
157+
158+
insn-conditions.md: s-check-sve-md
159+
s-check-sve-md: $(srcdir)/config/aarch64/check-sve-md.awk \
160+
diff --git a/gcc/config/devkitpro.h b/gcc/config/devkitpro.h
161+
new file mode 100644
162+
index 00000000000..a25459e4352
163+
--- /dev/null
164+
+++ b/gcc/config/devkitpro.h
165+
@@ -0,0 +1,32 @@
166+
+/* Definitions for devkitPro toolchains.
167+
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
168+
+
169+
+ This file is part of GCC.
170+
+
171+
+ GCC is free software; you can redistribute it and/or modify it
172+
+ under the terms of the GNU General Public License as published
173+
+ by the Free Software Foundation; either version 3, or (at your
174+
+ option) any later version.
175+
+
176+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
177+
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
178+
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
179+
+ License for more details.
180+
+
181+
+ Under Section 7 of GPL version 3, you are granted additional
182+
+ permissions described in the GCC Runtime Library Exception, version
183+
+ 3.1, as published by the Free Software Foundation.
184+
+
185+
+ You should have received a copy of the GNU General Public License and
186+
+ a copy of the GCC Runtime Library Exception along with this program;
187+
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
188+
+ <http://www.gnu.org/licenses/>. */
189+
+
190+
+#undef TARGET_OS_CPP_BUILTINS
191+
+#define TARGET_OS_CPP_BUILTINS() \
192+
+ do { \
193+
+ builtin_define ("__DEVKITA64__"); \
194+
+ builtin_define ("__DEVKITPRO__"); \
195+
+ } while (0)
196+
+
197+
+
198+
diff --git a/gcc/config/devkitpro.opt b/gcc/config/devkitpro.opt
199+
new file mode 100644
200+
index 00000000000..9acbbf9d27c
201+
--- /dev/null
202+
+++ b/gcc/config/devkitpro.opt
203+
@@ -0,0 +1,29 @@
204+
+; Options for devkitPro toolchains.
205+
+
206+
+; Copyright (C) 2011-2018 Free Software Foundation, Inc.
207+
+;
208+
+; This file is part of GCC.
209+
+;
210+
+; GCC is free software; you can redistribute it and/or modify it under
211+
+; the terms of the GNU General Public License as published by the Free
212+
+; Software Foundation; either version 3, or (at your option) any later
213+
+; version.
214+
+;
215+
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
216+
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
217+
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
218+
+; for more details.
219+
+;
220+
+; You should have received a copy of the GNU General Public License
221+
+; along with GCC; see the file COPYING3. If not see
222+
+; <http://www.gnu.org/licenses/>.
223+
+
224+
+; See the GCC internals manual (options.texi) for a description of
225+
+; this file's format.
226+
+
227+
+; Please try to keep this file in ASCII collating order.
228+
+
229+
+pthread
230+
+Driver
231+
+
232+
+; This comment is to ensure we retain the blank line above.
233+
diff --git a/gcc/config/devkitpro.opt.urls b/gcc/config/devkitpro.opt.urls
234+
new file mode 100644
235+
index 00000000000..ab7b466aa71
236+
--- /dev/null
237+
+++ b/gcc/config/devkitpro.opt.urls
238+
@@ -0,0 +1 @@
239+
+; Autogenerated by regenerate-opt-urls.py from gcc/config/devkitpro.opt and generated HTML
240+
diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc
241+
index e083f49f3da..1b81e7e88ce 100644
242+
--- a/gcc/config/i386/host-mingw32.cc
243+
+++ b/gcc/config/i386/host-mingw32.cc
244+
@@ -94,6 +94,10 @@ mingw32_gt_pch_get_address (size_t size, int)
245+
If we allocate at bottom we need to reserve the address as early
246+
as possible and at the same point in each invocation. */
247+
248+
+#if __MINGW64__
249+
+ size = UINT64_C(64 * 1024 * 1024 * 1024);
250+
+#endif
251+
+
252+
res = VirtualAlloc (NULL, size,
253+
MEM_RESERVE | MEM_TOP_DOWN,
254+
PAGE_NOACCESS);
255+
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
256+
index 4fd87f2c4a1..6af06f7b032 100644
257+
--- a/gcc/gcc.cc
258+
+++ b/gcc/gcc.cc
259+
@@ -888,6 +888,11 @@ proper position among the other output files. */
260+
#endif
261+
#endif
262+
263+
+#ifndef LIBGLOSS_SPEC
264+
+# define LIBGLOSS_SPEC "-lsysbase"
265+
+#endif
266+
+
267+
+
268+
/* config.h can define STARTFILE_SPEC to override the default crt0 files. */
269+
#ifndef STARTFILE_SPEC
270+
#define STARTFILE_SPEC \
271+
@@ -1215,6 +1220,7 @@ static const char *link_spec = LINK_SPEC;
272+
static const char *lib_spec = LIB_SPEC;
273+
static const char *link_gomp_spec = "";
274+
static const char *libgcc_spec = LIBGCC_SPEC;
275+
+static const char *libgloss_spec = LIBGLOSS_SPEC;
276+
static const char *endfile_spec = ENDFILE_SPEC;
277+
static const char *startfile_spec = STARTFILE_SPEC;
278+
static const char *linker_name_spec = LINKER_NAME;
279+
@@ -1727,6 +1733,7 @@ static struct spec_list static_specs[] =
280+
INIT_STATIC_SPEC ("lib", &lib_spec),
281+
INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec),
282+
INIT_STATIC_SPEC ("libgcc", &libgcc_spec),
283+
+ INIT_STATIC_SPEC ("libgloss", &libgloss_spec),
284+
INIT_STATIC_SPEC ("startfile", &startfile_spec),
285+
INIT_STATIC_SPEC ("cross_compile", &cross_compile),
286+
INIT_STATIC_SPEC ("version", &compiler_version),
287+
diff --git a/libcc1/configure b/libcc1/configure
288+
index ea689a353c8..98f9d9b21b7 100755
289+
--- a/libcc1/configure
290+
+++ b/libcc1/configure
291+
@@ -5119,7 +5119,7 @@ else
292+
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
293+
# nm: unknown option "B" ignored
294+
case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
295+
- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
296+
+ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
297+
break
298+
;;
299+
*)
300+
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
301+
index b9767cd1eee..362689c9f0b 100644
302+
--- a/libgcc/crtstuff.c
303+
+++ b/libgcc/crtstuff.c
304+
@@ -326,7 +326,7 @@ register_tm_clones (void)
305+
306+
#ifdef OBJECT_FORMAT_ELF
307+
308+
-#if DEFAULT_USE_CXA_ATEXIT
309+
+#if 1 /* DEFAULT_USE_CXA_ATEXIT */
310+
/* Declare the __dso_handle variable. It should have a unique value
311+
in every shared-object; in a main program its value is zero. The
312+
object should in any case be protected. This means the instance
313+
diff --git a/libgcc/gthr.h b/libgcc/gthr.h
314+
index 557417997f4..1269ece007f 100644
315+
--- a/libgcc/gthr.h
316+
+++ b/libgcc/gthr.h
317+
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
318+
/* The pe-coff weak support isn't fully compatible to ELF's weak.
319+
For static libraries it might would work, but as we need to deal
320+
with shared versions too, we disable it for mingw-targets. */
321+
-#ifdef __MINGW32__
322+
+#if defined(__MINGW32__) || defined(__DEVKITA64__)
323+
#undef GTHREAD_USE_WEAK
324+
#define GTHREAD_USE_WEAK 0
325+
#endif
326+
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h b/libsanitizer/sanitizer_common/sanitizer_platform.h
327+
index 57966403c92..c624f31b5d6 100644
328+
--- a/libsanitizer/sanitizer_common/sanitizer_platform.h
329+
+++ b/libsanitizer/sanitizer_common/sanitizer_platform.h
330+
@@ -12,11 +12,13 @@
331+
#ifndef SANITIZER_PLATFORM_H
332+
#define SANITIZER_PLATFORM_H
333+
334+
+#if 0
335+
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
336+
!defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) && \
337+
!(defined(__sun__) && defined(__svr4__))
338+
# error "This operating system is not supported"
339+
#endif
340+
+#endif
341+
342+
// Get __GLIBC__ on a glibc platform. Exclude Android: features.h includes C
343+
// function declarations into a .S file which doesn't compile.
344+
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
345+
index 537774c2668..76da4f35b96 100644
346+
--- a/libstdc++-v3/include/Makefile.am
347+
+++ b/libstdc++-v3/include/Makefile.am
348+
@@ -1436,6 +1436,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias}
349+
-e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
350+
-e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
351+
-e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \
352+
+ -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \
353+
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
354+
< $< > $@
355+
356+
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
357+
index 7b96b2207f8..817de242772 100644
358+
--- a/libstdc++-v3/include/Makefile.in
359+
+++ b/libstdc++-v3/include/Makefile.in
360+
@@ -1910,6 +1910,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias}
361+
-e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
362+
-e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
363+
-e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \
364+
+ -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \
365+
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
366+
< $< > $@
367+
368+
diff --git a/lto-plugin/configure b/lto-plugin/configure
369+
index 28f5dd79cd7..a79f318a4d6 100755
370+
--- a/lto-plugin/configure
371+
+++ b/lto-plugin/configure
372+
@@ -6469,7 +6469,7 @@ else
373+
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
374+
# nm: unknown option "B" ignored
375+
case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
376+
- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
377+
+ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
378+
break
379+
;;
380+
*)

select_toolchain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ case "$VERSION" in
6868
BINUTILS_VER=2.45.1
6969
NEWLIB_VER=4.5.0.20241231
7070
BINUTILS_PKGREL=2
71-
GCC_PKGREL=6
71+
GCC_PKGREL=3
7272
NEWLIB_PKGREL=5
7373
basedir='dka64'
7474
package=devkitA64

0 commit comments

Comments
 (0)