|
| 1 | +diff --git a/gcc/config.gcc b/gcc/config.gcc |
| 2 | +index 95c91ee02be..4711542eee5 100644 |
| 3 | +--- a/gcc/config.gcc |
| 4 | ++++ b/gcc/config.gcc |
| 5 | +@@ -1195,7 +1195,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 5396da9b2d6..87235d680ad 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 a05c0d3ded1..5551807e4c6 100644 |
| 34 | +--- a/gcc/config/aarch64/aarch64-opts.h |
| 35 | ++++ b/gcc/config/aarch64/aarch64-opts.h |
| 36 | +@@ -80,7 +80,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 1beec94629d..90a9ec580f8 100644 |
| 48 | +--- a/gcc/config/aarch64/aarch64.cc |
| 49 | ++++ b/gcc/config/aarch64/aarch64.cc |
| 50 | +@@ -21060,8 +21060,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 4fa1dfc7906..43a01fe3d56 100644 |
| 79 | +--- a/gcc/config/aarch64/aarch64.h |
| 80 | ++++ b/gcc/config/aarch64/aarch64.h |
| 81 | +@@ -1377,6 +1377,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 dbde066f747..3e3198bf52f 100644 |
| 94 | +--- a/gcc/config/aarch64/aarch64.md |
| 95 | ++++ b/gcc/config/aarch64/aarch64.md |
| 96 | +@@ -7436,11 +7436,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 6356c419399..a6907ed0a0b 100644 |
| 122 | +--- a/gcc/config/aarch64/aarch64.opt |
| 123 | ++++ b/gcc/config/aarch64/aarch64.opt |
| 124 | +@@ -128,6 +128,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 | +@@ -329,7 +332,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 78713558e7d..76c0914d8ce 100644 |
| 145 | +--- a/gcc/config/aarch64/t-aarch64 |
| 146 | ++++ b/gcc/config/aarch64/t-aarch64 |
| 147 | +@@ -208,8 +208,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 42563982e42..923dc198a7e 100644 |
| 242 | +--- a/gcc/config/i386/host-mingw32.cc |
| 243 | ++++ b/gcc/config/i386/host-mingw32.cc |
| 244 | +@@ -93,7 +93,10 @@ mingw32_gt_pch_get_address (size_t size, int) |
| 245 | + for NT system dlls is in 0x70000000 to 0x78000000 range. |
| 246 | + If we allocate at bottom we need to reserve the address as early |
| 247 | + as possible and at the same point in each invocation. */ |
| 248 | +- |
| 249 | ++ |
| 250 | ++#if __MINGW64__ |
| 251 | ++ size = UINT64_C(64 * 1024 * 1024 * 1024); |
| 252 | ++#endif |
| 253 | + res = VirtualAlloc (NULL, size, |
| 254 | + MEM_RESERVE | MEM_TOP_DOWN, |
| 255 | + PAGE_NOACCESS); |
| 256 | +diff --git a/gcc/gcc.cc b/gcc/gcc.cc |
| 257 | +index 728332b8153..47fc03eb8c8 100644 |
| 258 | +--- a/gcc/gcc.cc |
| 259 | ++++ b/gcc/gcc.cc |
| 260 | +@@ -881,6 +881,11 @@ proper position among the other output files. */ |
| 261 | + #endif |
| 262 | + #endif |
| 263 | + |
| 264 | ++#ifndef LIBGLOSS_SPEC |
| 265 | ++# define LIBGLOSS_SPEC "-lsysbase" |
| 266 | ++#endif |
| 267 | ++ |
| 268 | ++ |
| 269 | + /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ |
| 270 | + #ifndef STARTFILE_SPEC |
| 271 | + #define STARTFILE_SPEC \ |
| 272 | +@@ -1208,6 +1213,7 @@ static const char *link_spec = LINK_SPEC; |
| 273 | + static const char *lib_spec = LIB_SPEC; |
| 274 | + static const char *link_gomp_spec = ""; |
| 275 | + static const char *libgcc_spec = LIBGCC_SPEC; |
| 276 | ++static const char *libgloss_spec = LIBGLOSS_SPEC; |
| 277 | + static const char *endfile_spec = ENDFILE_SPEC; |
| 278 | + static const char *startfile_spec = STARTFILE_SPEC; |
| 279 | + static const char *linker_name_spec = LINKER_NAME; |
| 280 | +@@ -1720,6 +1726,7 @@ static struct spec_list static_specs[] = |
| 281 | + INIT_STATIC_SPEC ("lib", &lib_spec), |
| 282 | + INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec), |
| 283 | + INIT_STATIC_SPEC ("libgcc", &libgcc_spec), |
| 284 | ++ INIT_STATIC_SPEC ("libgloss", &libgloss_spec), |
| 285 | + INIT_STATIC_SPEC ("startfile", &startfile_spec), |
| 286 | + INIT_STATIC_SPEC ("cross_compile", &cross_compile), |
| 287 | + INIT_STATIC_SPEC ("version", &compiler_version), |
| 288 | +diff --git a/libcc1/configure b/libcc1/configure |
| 289 | +index ea689a353c8..98f9d9b21b7 100755 |
| 290 | +--- a/libcc1/configure |
| 291 | ++++ b/libcc1/configure |
| 292 | +@@ -5119,7 +5119,7 @@ else |
| 293 | + # Adding the `sed 1q' prevents false positives on HP-UX, which says: |
| 294 | + # nm: unknown option "B" ignored |
| 295 | + case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in |
| 296 | +- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" |
| 297 | ++ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" |
| 298 | + break |
| 299 | + ;; |
| 300 | + *) |
| 301 | +diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c |
| 302 | +index 38d3859a73c..f97358d9787 100644 |
| 303 | +--- a/libgcc/crtstuff.c |
| 304 | ++++ b/libgcc/crtstuff.c |
| 305 | +@@ -326,7 +326,7 @@ register_tm_clones (void) |
| 306 | + |
| 307 | + #ifdef OBJECT_FORMAT_ELF |
| 308 | + |
| 309 | +-#if DEFAULT_USE_CXA_ATEXIT |
| 310 | ++#if 1 /* DEFAULT_USE_CXA_ATEXIT */ |
| 311 | + /* Declare the __dso_handle variable. It should have a unique value |
| 312 | + in every shared-object; in a main program its value is zero. The |
| 313 | + object should in any case be protected. This means the instance |
| 314 | +diff --git a/libgcc/gthr.h b/libgcc/gthr.h |
| 315 | +index 33c2d8ff630..2a0a9c1e87e 100644 |
| 316 | +--- a/libgcc/gthr.h |
| 317 | ++++ b/libgcc/gthr.h |
| 318 | +@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 319 | + /* The pe-coff weak support isn't fully compatible to ELF's weak. |
| 320 | + For static libraries it might would work, but as we need to deal |
| 321 | + with shared versions too, we disable it for mingw-targets. */ |
| 322 | +-#ifdef __MINGW32__ |
| 323 | ++#if defined(__MINGW32__) || defined(__DEVKITA64__) |
| 324 | + #undef GTHREAD_USE_WEAK |
| 325 | + #define GTHREAD_USE_WEAK 0 |
| 326 | + #endif |
| 327 | +diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am |
| 328 | +index 422a0f4bd0a..ee09ada9170 100644 |
| 329 | +--- a/libstdc++-v3/include/Makefile.am |
| 330 | ++++ b/libstdc++-v3/include/Makefile.am |
| 331 | +@@ -1429,6 +1429,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} |
| 332 | + -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ |
| 333 | + -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ |
| 334 | + -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ |
| 335 | ++ -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \ |
| 336 | + -e 's,^#include "\(.*\)",#include <bits/\1>,g' \ |
| 337 | + < $< > $@ |
| 338 | + |
| 339 | +diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in |
| 340 | +index 9fd4ab4848c..beea48941a3 100644 |
| 341 | +--- a/libstdc++-v3/include/Makefile.in |
| 342 | ++++ b/libstdc++-v3/include/Makefile.in |
| 343 | +@@ -1903,6 +1903,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} |
| 344 | + -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ |
| 345 | + -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ |
| 346 | + -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ |
| 347 | ++ -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \ |
| 348 | + -e 's,^#include "\(.*\)",#include <bits/\1>,g' \ |
| 349 | + < $< > $@ |
| 350 | + |
| 351 | +diff --git a/lto-plugin/configure b/lto-plugin/configure |
| 352 | +index 28f5dd79cd7..a79f318a4d6 100755 |
| 353 | +--- a/lto-plugin/configure |
| 354 | ++++ b/lto-plugin/configure |
| 355 | +@@ -6469,7 +6469,7 @@ else |
| 356 | + # Adding the `sed 1q' prevents false positives on HP-UX, which says: |
| 357 | + # nm: unknown option "B" ignored |
| 358 | + case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in |
| 359 | +- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" |
| 360 | ++ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" |
| 361 | + break |
| 362 | + ;; |
| 363 | + *) |
0 commit comments