diff --git a/build-devkit.sh b/build-devkit.sh index 493eb6c..5b74412 100755 --- a/build-devkit.sh +++ b/build-devkit.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #--------------------------------------------------------------------------------- # devkitARM release 67.2 -# devkitPPC release 49.2 +# devkitPPC release 50 # devkitA64 release 29.2 #--------------------------------------------------------------------------------- diff --git a/patches/binutils-2.46-1.patch b/patches/binutils-2.46-1.patch new file mode 100644 index 0000000..33b95c4 --- /dev/null +++ b/patches/binutils-2.46-1.patch @@ -0,0 +1,539 @@ +diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h +index dbf53756200..087ea660042 100644 +--- a/bfd/elf-bfd.h ++++ b/bfd/elf-bfd.h +@@ -2070,6 +2070,14 @@ struct output_elf_obj_tdata + asection *sec; + } package_metadata; + ++ /* Data for .nx-module-name. */ ++ struct ++ { ++ bool (*after_write_object_contents) (bfd *); ++ const char *name; ++ asection *sec; ++ } nx_module_name; ++ + /* Records the result of `get_program_header_size'. */ + bfd_size_type program_header_size; + +diff --git a/bfd/elf.c b/bfd/elf.c +index 1177c3c3016..0cfd60b9426 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -7288,6 +7288,14 @@ _bfd_elf_write_object_contents (bfd *abfd) + if (!bed->s->write_shdrs_and_ehdr (abfd)) + return false; + ++ /* Write out the NX module name. */ ++ if (t->o->nx_module_name.after_write_object_contents != NULL) ++ { ++ failed = !(*t->o->nx_module_name.after_write_object_contents) (abfd); ++ if (failed) ++ return false; ++ } ++ + /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */ + if (t->o->build_id.after_write_object_contents != NULL + && !(*t->o->build_id.after_write_object_contents) (abfd)) +diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c +index 1ba7dd393e6..04f837e2140 100644 +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -2444,6 +2444,12 @@ enum elf_aarch64_stub_type + aarch64_stub_erratum_843419_veneer, + }; + ++/* Is an undefined weak symbol resolved to 0 ? */ ++#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \ ++ ((EH)->root.root.type == bfd_link_hash_undefweak \ ++ && bfd_link_executable (INFO) \ ++ && !(INFO)->dynamic_undefined_weak) ++ + struct elf_aarch64_stub_hash_entry + { + /* Base hash table entry structure. */ +@@ -7054,11 +7060,13 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; ++ struct elf_aarch64_link_hash_entry *eh; + bfd_vma relocation; + bfd_reloc_status_type r; + arelent bfd_reloc; + char sym_type; + bool unresolved_reloc = false; ++ bool resolved_to_zero = false; + char *error_message = NULL; + + r_symndx = ELFNN_R_SYM (rel->r_info); +@@ -7199,6 +7207,10 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, + h, &unresolved_reloc, + save_addend, &addend, sym); + ++ eh = (struct elf_aarch64_link_hash_entry *) h; ++ resolved_to_zero = (eh != NULL ++ && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh)); ++ + switch (elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type)) + { + case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: +@@ -7222,7 +7234,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, + need_relocs = + (!bfd_link_executable (info) || indx != 0) && + (h == NULL +- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) + || h->root.type != bfd_link_hash_undefweak); + + BFD_ASSERT (globals->root.srelgot != NULL); +@@ -7317,7 +7329,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, + need_relocs = + (!bfd_link_executable (info) || indx != 0) && + (h == NULL +- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) + || h->root.type != bfd_link_hash_undefweak); + + BFD_ASSERT (globals->root.srelgot != NULL); +@@ -7366,7 +7378,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, + bfd_vma off = symbol_tlsdesc_got_offset (input_bfd, h, r_symndx); + + need_relocs = (h == NULL +- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) + || h->root.type != bfd_link_hash_undefweak); + + BFD_ASSERT (globals->root.srelgot != NULL); +@@ -7692,6 +7704,23 @@ need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh) + return false; + } + ++/* Remove undefined weak symbol from the dynamic symbol table if it ++ is resolved to 0. */ ++ ++static bool ++elfNN_aarch64_elf_fixup_symbol (struct bfd_link_info *info, ++ struct elf_link_hash_entry *h) ++{ ++ if (h->dynindx != -1 ++ && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, elf_aarch64_hash_entry (h))) ++ { ++ h->dynindx = -1; ++ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, ++ h->dynstr_index); ++ } ++ return true; ++} ++ + /* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to +@@ -8797,6 +8826,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + struct elf_aarch64_link_hash_table *htab; + struct elf_aarch64_link_hash_entry *eh; + struct elf_dyn_relocs *p; ++ bool resolved_to_zero; + + /* An example of a bfd_link_hash_indirect symbol is versioned + symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect) +@@ -8816,6 +8846,10 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + info = (struct bfd_link_info *) inf; + htab = elf_aarch64_hash_table (info); + ++ eh = (struct elf_aarch64_link_hash_entry *) h; ++ eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1; ++ resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); ++ + /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it + here if it is defined and referenced in a non-shared object. */ + if (h->type == STT_GNU_IFUNC +@@ -8825,7 +8859,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ +- if (h->dynindx == -1 && !h->forced_local ++ if (h->dynindx == -1 && !h->forced_local && !resolved_to_zero + && h->root.type == bfd_link_hash_undefweak) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) +@@ -8859,6 +8893,11 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + of relaxing into these from the large model PLT entries. */ + s->size += htab->plt_entry_size; + ++ /* There should be no PLT relocations against resolved undefined ++ weak symbols in the executable. */ ++ if (!resolved_to_zero) ++ { ++ + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->root.sgotplt->size += GOT_ENTRY_SIZE; +@@ -8887,6 +8926,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + htab->variant_pcs = 1; + + } ++ } + else + { + h->plt.offset = (bfd_vma) - 1; +@@ -8899,9 +8939,6 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + h->needs_plt = 0; + } + +- eh = (struct elf_aarch64_link_hash_entry *) h; +- eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1; +- + if (h->got.refcount > 0) + { + bool dyn; +@@ -8913,7 +8950,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ +- if (dyn && h->dynindx == -1 && !h->forced_local ++ if (dyn && h->dynindx == -1 && !h->forced_local && !resolved_to_zero + && h->root.type == bfd_link_hash_undefweak) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) +@@ -8927,7 +8964,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + { + h->got.offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE; +- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) + || h->root.type != bfd_link_hash_undefweak) + && (bfd_link_pic (info) + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) +@@ -8963,7 +9000,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + } + + indx = h && h->dynindx != -1 ? h->dynindx : 0; +- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) + || h->root.type != bfd_link_hash_undefweak) + && (!bfd_link_executable (info) + || indx != 0 +@@ -9045,7 +9082,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + visibility. */ + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) + { +- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT ++ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || resolved_to_zero + || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) + h->dyn_relocs = NULL; + +@@ -9065,7 +9102,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + symbols which turn out to need copy relocs or are not + dynamic. */ + +- if (!h->non_got_ref ++ if (!(h->non_got_ref ++ || (h->root.type == bfd_link_hash_undefweak ++ && !resolved_to_zero)) + && ((h->def_dynamic + && !h->def_regular) + || (htab->root.dynamic_sections_created +@@ -9076,6 +9115,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local ++ && !resolved_to_zero + && h->root.type == bfd_link_hash_undefweak + && !bfd_elf_link_record_dynamic_symbol (info, h)) + return false; +@@ -10046,8 +10086,17 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, + Elf_Internal_Sym *sym) + { + struct elf_aarch64_link_hash_table *htab; ++ struct elf_aarch64_link_hash_entry *eh; ++ bool local_undefweak; + htab = elf_aarch64_hash_table (info); + ++ eh = (struct elf_aarch64_link_hash_entry *) h; ++ ++ /* We keep PLT/GOT entries without dynamic PLT/GOT relocations for ++ resolved undefined weak symbols in executable so that their ++ references have value 0 at run-time. */ ++ local_undefweak = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); ++ + if (h->plt.offset != (bfd_vma) - 1) + { + asection *plt, *gotplt, *relplt; +@@ -10082,7 +10131,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, + abort (); + + elfNN_aarch64_create_small_pltn_entry (h, htab, output_bfd, info); +- if (!h->def_regular) ++ if (!local_undefweak && !h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. */ +@@ -10104,7 +10153,8 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, + && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL + /* Undefined weak symbol in static PIE resolves to 0 without + any dynamic relocations. */ +- && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) ++ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h) ++ && !local_undefweak) + { + Elf_Internal_Rela rela; + bfd_byte *loc; +@@ -10811,6 +10861,9 @@ static const struct elf_size_info elfNN_aarch64_size_info = + #define elf_backend_init_index_section \ + _bfd_elf_init_2_index_sections + ++#define elf_backend_fixup_symbol \ ++ elfNN_aarch64_elf_fixup_symbol ++ + #define elf_backend_finish_dynamic_sections \ + elfNN_aarch64_finish_dynamic_sections + +diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh +index aa051c76a7a..073d3a47b65 100644 +--- a/ld/emulparams/aarch64elf.sh ++++ b/ld/emulparams/aarch64elf.sh +@@ -1,4 +1,5 @@ + source_sh ${srcdir}/emulparams/dt-relr.sh ++source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh + + ARCH=aarch64 + MACHINE= +diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh +index 0565b7a066c..64821b1fc31 100644 +--- a/ld/emulparams/aarch64elf32.sh ++++ b/ld/emulparams/aarch64elf32.sh +@@ -1,4 +1,5 @@ + source_sh ${srcdir}/emulparams/dt-relr.sh ++source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh + + ARCH="aarch64:ilp32" + MACHINE= +diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh +index da892988f5d..6b8efb9bbdb 100644 +--- a/ld/emulparams/elf32ppccommon.sh ++++ b/ld/emulparams/elf32ppccommon.sh +@@ -23,7 +23,7 @@ else + unset SBSS_START_SYMBOLS + unset SBSS_END_SYMBOLS + fi +-OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};" ++OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};" + OTHER_RELRO_SECTIONS=" + .fixup ${RELOCATING-0} : { *(.fixup) } + .got1 ${RELOCATING-0} : { *(.got1) } +diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em +index 5ddbed99724..2891f84ebdb 100644 +--- a/ld/emultempl/aarch64elf.em ++++ b/ld/emultempl/aarch64elf.em +@@ -490,7 +490,7 @@ PARSE_AND_LIST_LONGOPTS=' + { "discard-sframe", no_argument, NULL, OPTION_DISCARD_SFRAME}, + ' + +-PARSE_AND_LIST_OPTIONS=' ++PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}' + fprintf (file, _(" --no-enum-size-warning Don'\''t warn about objects with incompatible\n" + " enum sizes\n")); + fprintf (file, _(" --no-wchar-size-warning Don'\''t warn about objects with incompatible\n" +diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em +index 37bdfff051c..14f4bd6e8c6 100644 +--- a/ld/emultempl/elf.em ++++ b/ld/emultempl/elf.em +@@ -814,6 +814,7 @@ EOF + fi + fragment <o->nx_module_name.name; ++ asec = t->o->nx_module_name.sec; ++ if (bfd_is_abs_section (asec->output_section)) ++ { ++ einfo (_("%P: warning: .nx-module-name section discarded," ++ " --build-id ignored\n")); ++ return true; ++ } ++ i_shdr = &elf_section_data (asec->output_section)->this_hdr; ++ ++ if (i_shdr->contents == NULL) ++ { ++ if (asec->contents == NULL) ++ asec->contents = (unsigned char *) xmalloc (asec->size); ++ contents = asec->contents; ++ } ++ else ++ contents = i_shdr->contents + asec->output_offset; ++ ++ size = asec->size; ++ bfd_h_put_32 (abfd, 0, &contents[0]); ++ bfd_h_put_32 (abfd, size - 9, &contents[4]); ++ memcpy (&contents[8], name, size - 9); ++ contents[size - 1] = 0; /* ensure null termination for AMS */ ++ ++ position = i_shdr->sh_offset + asec->output_offset; ++ ++ return (bfd_seek (abfd, position, SEEK_SET) == 0 ++ && bfd_write (contents, size, abfd) == size); ++} + ++/* Make .nx-module-name section, and set up elf_tdata->nx_module_name. */ ++ ++static bool ++setup_nx_module_name (bfd *ibfd, bfd *obfd) ++{ ++ asection *s; ++ bfd_size_type size; ++ flagword flags; ++ ++ if (ldelf_emit_nx_module_name[0] == '\0') ++ { ++ /* Extract the basename of the output bfd and use it as the module name. */ ++ char *dot_pos; ++ free ((char *) ldelf_emit_nx_module_name); ++ ldelf_emit_nx_module_name = (char *) lbasename (bfd_get_filename (obfd)); ++ ldelf_emit_nx_module_name = xstrdup (ldelf_emit_nx_module_name); ++ dot_pos = strrchr (ldelf_emit_nx_module_name, '.'); ++ if (dot_pos != NULL) ++ { ++ /* Remove extension. */ ++ *dot_pos = 0; ++ } ++ } ++ ++ size = 8 + strlen(ldelf_emit_nx_module_name) + 1; /* extra null terminator for AMS */ ++ flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY ++ | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA); ++ s = bfd_make_section_with_flags (ibfd, ".nx-module-name", flags); ++ if (s != NULL && bfd_set_section_alignment (s, 4)) ++ { ++ struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd); ++ t->o->nx_module_name.after_write_object_contents = &write_nx_module_name; ++ t->o->nx_module_name.name = ldelf_emit_nx_module_name; ++ t->o->nx_module_name.sec = s; ++ elf_section_type (s) = SHT_PROGBITS; ++ s->size = size; ++ return true; ++ } ++ ++ einfo (_("%P: warning: cannot create .nx-module-name section," ++ " --nx-module-name ignored\n")); ++ return false; ++} ++ ++/* This is called before calling plugin 'all symbols read' hook. */ + void + ldelf_before_plugin_all_symbols_read (int use_libpath, int native, + int is_linux, int is_freebsd, +@@ -1291,6 +1379,24 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, + } + } + ++ if (ldelf_emit_nx_module_name != NULL) ++ { ++ /* Find an ELF input. */ ++ for (abfd = link_info.input_bfds; ++ abfd != (bfd *) NULL; abfd = abfd->link.next) ++ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour ++ && bfd_count_sections (abfd) != 0 ++ && !((lang_input_statement_type *) abfd->usrdata)->flags.just_syms) ++ break; ++ ++ /* If there are no ELF input files do not try to create a .nx-module-name section. */ ++ if (abfd == NULL || !setup_nx_module_name (abfd, link_info.output_bfd)) ++ { ++ free ((char *) ldelf_emit_nx_module_name); ++ ldelf_emit_nx_module_name = NULL; ++ } ++ } ++ + get_elf_backend_data (link_info.output_bfd)->setup_object_attributes (&link_info); + get_elf_backend_data (link_info.output_bfd)->setup_gnu_properties (&link_info); + +diff --git a/ld/ldelf.h b/ld/ldelf.h +index 2bb2a3fb774..cd4385c056b 100644 +--- a/ld/ldelf.h ++++ b/ld/ldelf.h +@@ -20,6 +20,7 @@ + + extern const char *ldelf_emit_note_gnu_build_id; + extern const char *ldelf_emit_note_fdo_package_metadata; ++extern const char *ldelf_emit_nx_module_name; + + extern void ldelf_finish (void); + extern void ldelf_after_parse (void); +diff --git a/ld/ldlex.h b/ld/ldlex.h +index 85e06b6fcc4..27243a47459 100644 +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -186,6 +186,7 @@ enum option_values + /* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */ + OPTION_BUILD_ID, + OPTION_EXCLUDE_LIBS, ++ OPTION_NX_MODULE_NAME, + /* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em + and emultempl/pep.em. */ + OPTION_BASE_FILE, +diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c +index dfc6734e027..0b61a0612f6 100644 +--- a/opcodes/ppc-opc.c ++++ b/opcodes/ppc-opc.c +@@ -5123,7 +5123,7 @@ const unsigned int num_powerpc_operands = ARRAY_SIZE (powerpc_operands); + #define MFDEC2 (PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE \ + | PPC_OPCODE_TITAN) + #define BOOKE PPC_OPCODE_BOOKE +-#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_PPCPS | PPC_OPCODE_EFS ++#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_EFS + #define PPCE300 PPC_OPCODE_E300 + #define PPCSPE PPC_OPCODE_SPE + #define PPCSPE2 PPC_OPCODE_SPE2 diff --git a/patches/gcc-16.1.0-1.patch b/patches/gcc-16.1.0-1.patch new file mode 100644 index 0000000..c07255e --- /dev/null +++ b/patches/gcc-16.1.0-1.patch @@ -0,0 +1,1090 @@ +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 8fe99616f82..51edd190338 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -546,7 +546,7 @@ powerpc*-*-*) + extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o" + extra_objs="${extra_objs} rs6000-call.o rs6000-pcrel-opt.o" + extra_objs="${extra_objs} rs6000-builtins.o rs6000-builtin.o" +- extra_headers="ppc-asm.h altivec.h htmintrin.h htmxlintrin.h" ++ extra_headers="ppc-asm.h htmintrin.h htmxlintrin.h" + extra_headers="${extra_headers} bmi2intrin.h bmiintrin.h" + extra_headers="${extra_headers} xmmintrin.h mm_malloc.h emmintrin.h" + extra_headers="${extra_headers} mmintrin.h x86intrin.h" +@@ -1242,7 +1242,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) + tmake_file="${tmake_file} aarch64/t-aarch64" + case $target in + aarch64-*-elf*) ++ default_use_cxa_atexit=yes + use_gcc_stdint=wrap ++ tm_file="${tm_file} aarch64/devkita64.h" ++ tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" ++ extra_options="${extra_options} devkitpro.opt" ++ case ${enable_threads} in ++ "" | yes | posix) thread_file='posix' ;; ++ esac + ;; + aarch64-*-fuchsia*) + tm_file="${tm_file} fuchsia.h" +@@ -1561,6 +1568,11 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) + tm_file="$tm_file newlib-stdint.h" + tmake_file="${tmake_file} arm/t-bpabi" + use_gcc_stdint=wrap ++ tm_file="${tm_file} arm/devkitarm.h" ++ extra_options="${extra_options} devkitpro.opt" ++ case ${enable_threads} in ++ "" | yes | posix) thread_file='posix' ;; ++ esac + ;; + arm*-*-fuchsia*) + tm_file="${tm_file} fuchsia.h arm/fuchsia-elf.h glibc-stdint.h" +@@ -3121,9 +3133,12 @@ powerpc-*-eabialtivec*) + ;; + powerpc-*-eabi*) + tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h" +- extra_options="${extra_options} rs6000/sysv4.opt" ++ extra_options="${extra_options} rs6000/sysv4.opt devkitpro.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap ++ case ${enable_threads} in ++ "" | yes | posix) thread_file='posix' ;; ++ esac + ;; + powerpc-*-rtems*) + tm_file="rs6000/biarch64.h ${tm_file} elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/rtems.h rtems.h" +diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h +index d808225799b..a32e17a739f 100644 +--- a/gcc/config/aarch64/aarch64-elf-raw.h ++++ b/gcc/config/aarch64/aarch64-elf-raw.h +@@ -22,6 +22,7 @@ + #ifndef GCC_AARCH64_ELF_RAW_H + #define GCC_AARCH64_ELF_RAW_H + ++#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L %(libgloss) --end-group" + #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" + #define ENDFILE_SPEC \ + " crtend%O%s crtn%O%s " \ +diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h +index 45527809549..9b2c8891999 100644 +--- a/gcc/config/aarch64/aarch64-opts.h ++++ b/gcc/config/aarch64/aarch64-opts.h +@@ -91,7 +91,8 @@ enum aarch64_tp_reg { + AARCH64_TPIDR_EL1 = 1, + AARCH64_TPIDR_EL2 = 2, + AARCH64_TPIDR_EL3 = 3, +- AARCH64_TPIDRRO_EL0 = 4 ++ AARCH64_TPIDRRO_EL0 = 4, ++ AARCH64_TP_SOFT = 5 + }; + + /* SVE vector register sizes. */ +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 62194b96450..e72f56e28fd 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -22348,8 +22348,24 @@ aarch64_load_tp (rtx target) + || !register_operand (target, Pmode)) + target = gen_reg_rtx (Pmode); + +- /* Can return in any reg. */ +- emit_insn (gen_aarch64_load_tp_hard (target)); ++ if (TARGET_HARD_TP) ++ { ++ /* Can return in any reg. */ ++ emit_insn (gen_aarch64_load_tp_hard (target)); ++ } ++ else ++ { ++ /* Always returned in r0. Immediately copy the result into a pseudo, ++ otherwise other uses of r0 (e.g. setting up function arguments) may ++ clobber the value. */ ++ ++ rtx tmp; ++ ++ emit_insn (gen_aarch64_load_tp_soft ()); ++ ++ tmp = gen_rtx_REG (DImode, R0_REGNUM); ++ emit_move_insn (target, tmp); ++ } + return target; + } + +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index d61705d78f6..dbc9da36922 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -1498,6 +1498,10 @@ typedef struct + /* Check TLS Descriptors mechanism is selected. */ + #define TARGET_TLS_DESC (aarch64_tls_dialect == TLS_DESCRIPTORS) + ++/* Check selected thread pointer access sequence to use. */ ++#define TARGET_HARD_TP (aarch64_tpidr_reg != AARCH64_TP_SOFT) ++#define TARGET_SOFT_TP (aarch64_tpidr_reg == AARCH64_TP_SOFT) ++ + extern enum aarch64_code_model aarch64_cmodel; + + /* When using the tiny addressing model conditional and unconditional branches +diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md +index 0ef01e889a6..a06f3dc1ee1 100644 +--- a/gcc/config/aarch64/aarch64.md ++++ b/gcc/config/aarch64/aarch64.md +@@ -7995,11 +7995,22 @@ + (define_insn "aarch64_load_tp_hard" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(const_int 0)] UNSPEC_TLS))] +- "" ++ "TARGET_HARD_TP" + "* return aarch64_output_load_tp (operands[0]);" + [(set_attr "type" "mrs")] + ) + ++(define_insn "aarch64_load_tp_soft" ++ [(set (reg:DI 0) (unspec:DI [(const_int 0)] UNSPEC_TLS)) ++ (clobber (reg:DI IP0_REGNUM)) ++ (clobber (reg:DI IP1_REGNUM)) ++ (clobber (reg:DI LR_REGNUM)) ++ (clobber (reg:CC CC_REGNUM))] ++ "TARGET_SOFT_TP" ++ "bl\\t__aarch64_read_tp\\t// aarch64_load_tp_soft" ++ [(set_attr "type" "branch")] ++) ++ + ;; The TLS ABI specifically requires that the compiler does not schedule + ;; instructions in the TLS stubs, in order to enable linker relaxation. + ;; Therefore we treat the stubs as an atomic sequence. +diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt +index 64004f21332..2e17633d04c 100644 +--- a/gcc/config/aarch64/aarch64.opt ++++ b/gcc/config/aarch64/aarch64.opt +@@ -147,6 +147,9 @@ Enum(tp_reg) String(tpidr_el3) Value(AARCH64_TPIDR_EL3) + EnumValue + Enum(tp_reg) String(tpidrro_el0) Value(AARCH64_TPIDRRO_EL0) + ++EnumValue ++Enum(tp_reg) String(soft) Value(AARCH64_TP_SOFT) ++ + mtp= + Target RejectNegative Joined Enum(tp_reg) Var(aarch64_tpidr_reg) Init(AARCH64_TPIDR_EL0) Save + Specify the thread pointer register. +@@ -367,7 +370,7 @@ TargetVariable + long aarch64_stack_protector_guard_offset = 0 + + moutline-atomics +-Target Var(aarch64_flag_outline_atomics) Init(2) Save ++Target Var(aarch64_flag_outline_atomics) Save + Generate local calls to out-of-line atomic operations. + + -param=aarch64-vect-compare-costs= +diff --git a/gcc/config/aarch64/devkita64.h b/gcc/config/aarch64/devkita64.h +new file mode 100644 +index 00000000000..5c0b53b9810 +--- /dev/null ++++ b/gcc/config/aarch64/devkita64.h +@@ -0,0 +1,32 @@ ++/* Definitions for devkitPro toolchains. ++ Copyright (C) 2016-2018 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ . */ ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do { \ ++ builtin_define ("__DEVKITPRO__"); \ ++ builtin_define ("__DEVKITA64__"); \ ++ } while (0) ++ ++ +diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 +index ed622058f82..ab937f15c5a 100644 +--- a/gcc/config/aarch64/t-aarch64 ++++ b/gcc/config/aarch64/t-aarch64 +@@ -244,8 +244,10 @@ aarch64-narrow-gp-writes.o: $(srcdir)/config/aarch64/aarch64-narrow-gp-writes.cc + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/aarch64/aarch64-narrow-gp-writes.cc + comma=, +-MULTILIB_OPTIONS = $(subst $(comma),/, $(patsubst %, mabi=%, $(subst $(comma),$(comma)mabi=,$(TM_MULTILIB_CONFIG)))) +-MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG)) ++MULTILIB_OPTIONS = mcmodel=large fPIC ++MULTILIB_DIRNAMES = large pic ++MULTILIB_REQUIRED = mcmodel=large fPIC ++MULTILIB_MATCHES = fPIC=fpic fPIC=fpie fPIC=fPIE + + insn-conditions.md: s-check-sve-md + s-check-sve-md: $(srcdir)/config/aarch64/check-sve-md.awk \ +diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in +index db674b85af1..587fc96b77c 100644 +--- a/gcc/config/arm/arm-cpus.in ++++ b/gcc/config/arm/arm-cpus.in +@@ -410,7 +410,7 @@ begin arch armv6k + tune for mpcore + tune flags CO_PROC + base 6K +- isa ARMv6k ++ isa ARMv6k VFPv2 FP_DBL + option fp add VFPv2 FP_DBL + optalias vfpv2 fp + option nofp remove ALL_FP +diff --git a/gcc/config/arm/devkitarm.h b/gcc/config/arm/devkitarm.h +new file mode 100644 +index 00000000000..7f408d6d81d +--- /dev/null ++++ b/gcc/config/arm/devkitarm.h +@@ -0,0 +1,33 @@ ++/* Definitions for devkitPro toolchains. ++ Copyright (C) 2016-2018 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ . */ ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do { \ ++ builtin_define ("__DEVKITPRO__"); \ ++ builtin_define ("__DEVKITARM__"); \ ++ TARGET_BPABI_CPP_BUILTINS(); \ ++ } while (0) ++ ++ +diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf +index 2aba20d8152..2f70e1d6523 100644 +--- a/gcc/config/arm/t-arm-elf ++++ b/gcc/config/arm/t-arm-elf +@@ -16,120 +16,22 @@ + # along with GCC; see the file COPYING3. If not see + # . + +-# Build a very basic set of libraries that should cater for most cases. +- +-# Single-precision floating-point is NOT supported; we don't build a +-# suitable library for that. Use the rm-profile config in that case. +- +-# PART 1 - Useful groups of options +- +-dp_fpus := vfp vfpv2 vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 \ +- neon neon-vfpv3 neon-fp16 vfpv4 neon-vfpv4 vfpv4-d16 \ +- fpv5-d16 fp-armv8 neon-fp-armv8 crypto-neon-fp-armv8 \ +- vfp3 +- +-sp_fpus := vfpv3xd vfpv3xd-fp16 fpv4-sp-d16 fpv5-sp-d16 +- +-v7a_fps := vfpv3 vfpv3-fp16 vfpv4 simd neon-fp16 neon-vfpv4 +-v7ve_fps := vfpv3-d16 vfpv3 vfpv3-d16-fp16 vfpv3-fp16 vfpv4 neon \ +- neon-fp16 simd +- +-# Not all these permutations exist for all architecture variants, but +-# it seems to work ok. +-v8_fps := simd fp16 crypto fp16+crypto dotprod fp16fml +- +-v9_fps := simd fp16 crypto fp16+crypto dotprod fp16fml +- +-# We don't do anything special with these. Pre-v4t probably doesn't work. +-all_early_nofp := armv4 armv4t armv5t +- +-all_early_arch := armv5tej armv6 armv6j armv6k armv6z armv6kz \ +- armv6zk armv6t2 iwmmxt iwmmxt2 +- +-all_v7_a_r := armv7-a armv7ve armv7-r +- +-all_v8_archs := armv8-a armv8-a+crc armv8.1-a armv8.2-a armv8.3-a armv8.4-a \ +- armv8.5-a armv8.6-a +- +-all_v9_archs := armv9-a +- +-# No floating point variants, require thumb1 softfp +-all_nofp_t := armv6-m armv6s-m armv8-m.base +- +-all_nofp_t2 := armv7-m +- +-all_sp_only := armv7e-m armv8-m.main +- +-MULTILIB_OPTIONS = +-MULTILIB_DIRNAMES = ++MULTILIB_OPTIONS = mthumb mbig-endian march=armv6k march=armv6s-m mfloat-abi=hard mfloat-abi=soft ++MULTILIB_DIRNAMES = thumb be armv6k v6-m fpu nofp + MULTILIB_EXCEPTIONS = + MULTILIB_MATCHES = +-MULTILIB_REUSE = +- +-# PART 2 - multilib build rules +- +-MULTILIB_OPTIONS += marm/mthumb +-MULTILIB_DIRNAMES += arm thumb +- +-MULTILIB_OPTIONS += mfpu=auto +-MULTILIB_DIRNAMES += autofp +- +-MULTILIB_OPTIONS += march=armv5te+fp/march=armv7+fp +-MULTILIB_DIRNAMES += v5te v7 +- +-MULTILIB_OPTIONS += mfloat-abi=hard +-MULTILIB_DIRNAMES += fpu +- +-# Build a total of 4 library variants (base options plus the following): +-MULTILIB_REQUIRED += mthumb +-MULTILIB_REQUIRED += marm/mfpu=auto/march=armv5te+fp/mfloat-abi=hard +-MULTILIB_REQUIRED += mthumb/mfpu=auto/march=armv7+fp/mfloat-abi=hard +- +-# PART 3 - Match rules +- +-# Map all supported FPUs onto mfpu=auto +-MULTILIB_MATCHES += $(foreach FPU, $(dp_fpus), \ +- mfpu?auto=mfpu?$(FPU)) +- +-MULTILIB_MATCHES += march?armv5te+fp=march?armv5te +- +-MULTILIB_MATCHES += $(foreach ARCH, $(all_early_arch), \ +- march?armv5te+fp=march?$(ARCH) \ +- march?armv5te+fp=march?$(ARCH)+fp) +- +-MULTILIB_MATCHES += march?armv7+fp=march?armv7 +- +-MULTILIB_MATCHES += $(foreach FPARCH, $(v7a_fps), \ +- march?armv7+fp=march?armv7-a+$(FPARCH)) +- +-MULTILIB_MATCHES += $(foreach FPARCH, $(v7ve_fps), \ +- march?armv7+fp=march?armv7ve+$(FPARCH)) +- +-MULTILIB_MATCHES += $(foreach ARCH, $(all_v7_a_r), \ +- march?armv7+fp=march?$(ARCH) \ +- march?armv7+fp=march?$(ARCH)+fp) + +-MULTILIB_MATCHES += $(foreach ARCH, $(all_v8_archs), \ +- march?armv7+fp=march?$(ARCH) \ +- $(foreach FPARCH, $(v8_fps), \ +- march?armv7+fp=march?$(ARCH)+$(FPARCH))) ++MULTILIB_REQUIRED = mthumb mbig-endian mthumb/mbig-endian march=armv6k/mfloat-abi=hard mthumb/march=armv6s-m/mfloat-abi=soft + +-MULTILIB_MATCHES += $(foreach ARCH, $(all_v9_archs), \ +- march?armv7+fp=march?$(ARCH) \ +- $(foreach FPARCH, $(v9_fps), \ +- march?armv7+fp=march?$(ARCH)+$(FPARCH))) + +-MULTILIB_MATCHES += $(foreach ARCH, armv7e-m armv8-m.mainline, \ +- march?armv7+fp=march?$(ARCH)+fp.dp) ++MULTILIB_MATCHES += march?armv6k=mtune?mpcore ++MULTILIB_MATCHES += march?armv6k=mcpu?mpcore + +-# PART 4 - Reuse rules ++MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0 ++MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m0 ++MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0plus ++MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m0plus ++MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m1 ++MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m1 + +-MULTILIB_REUSE += mthumb=mthumb/mfpu.auto +-MULTILIB_REUSE += mthumb=mthumb/mfpu.auto/march.armv5te+fp +-MULTILIB_REUSE += mthumb=mthumb/march.armv5te+fp +-MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=marm/march.armv5te+fp/mfloat-abi.hard +-MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=march.armv5te+fp/mfloat-abi.hard +-MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=mfpu.auto/march.armv5te+fp/mfloat-abi.hard +-MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mthumb/march.armv7+fp/mfloat-abi.hard +-MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mfpu.auto/march.armv7+fp/mfloat-abi.hard +-MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=march.armv7+fp/mfloat-abi.hard ++MULTILIB_REUSE = mthumb/march.armv6s-m/mfloat-abi.soft=mthumb/march.armv6s-m +diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h +index 959b6c3e6e3..a894510eff5 100644 +--- a/gcc/config/arm/unknown-elf.h ++++ b/gcc/config/arm/unknown-elf.h +@@ -29,7 +29,7 @@ + #endif + + /* Now we define the strings used to build the spec file. */ +-#define UNKNOWN_ELF_STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" ++#define UNKNOWN_ELF_STARTFILE_SPEC " crti%O%s crtbegin%O%s" + + #undef STARTFILE_SPEC + #define STARTFILE_SPEC \ +@@ -93,4 +93,4 @@ + udivmoddi4, which will depend on the exception unwind routines, + which will depend on abort, which is defined in libc. */ + #undef LINK_GCC_C_SEQUENCE_SPEC +-#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} --end-group" ++#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} %(libgloss) --end-group" +diff --git a/gcc/config/devkitpro.opt b/gcc/config/devkitpro.opt +new file mode 100644 +index 00000000000..9acbbf9d27c +--- /dev/null ++++ b/gcc/config/devkitpro.opt +@@ -0,0 +1,29 @@ ++; Options for devkitPro toolchains. ++ ++; Copyright (C) 2011-2018 Free Software Foundation, Inc. ++; ++; This file is part of GCC. ++; ++; GCC is free software; you can redistribute it and/or modify it under ++; the terms of the GNU General Public License as published by the Free ++; Software Foundation; either version 3, or (at your option) any later ++; version. ++; ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++; for more details. ++; ++; You should have received a copy of the GNU General Public License ++; along with GCC; see the file COPYING3. If not see ++; . ++ ++; See the GCC internals manual (options.texi) for a description of ++; this file's format. ++ ++; Please try to keep this file in ASCII collating order. ++ ++pthread ++Driver ++ ++; This comment is to ensure we retain the blank line above. +diff --git a/gcc/config/devkitpro.opt.urls b/gcc/config/devkitpro.opt.urls +new file mode 100644 +index 00000000000..ab7b466aa71 +--- /dev/null ++++ b/gcc/config/devkitpro.opt.urls +@@ -0,0 +1 @@ ++; Autogenerated by regenerate-opt-urls.py from gcc/config/devkitpro.opt and generated HTML +diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc +index d284e42c9ab..ab3f683e29b 100644 +--- a/gcc/config/i386/host-mingw32.cc ++++ b/gcc/config/i386/host-mingw32.cc +@@ -94,6 +94,10 @@ mingw32_gt_pch_get_address (size_t size, int) + If we allocate at bottom we need to reserve the address as early + as possible and at the same point in each invocation. */ + ++#if __MINGW64__ ++ size = UINT64_C(64 * 1024 * 1024 * 1024); ++#endif ++ + res = VirtualAlloc (NULL, size, + MEM_RESERVE | MEM_TOP_DOWN, + PAGE_NOACCESS); +diff --git a/gcc/config/rs6000/eabi.h b/gcc/config/rs6000/eabi.h +index cde3333d0b7..56df3588f63 100644 +--- a/gcc/config/rs6000/eabi.h ++++ b/gcc/config/rs6000/eabi.h +@@ -36,6 +36,8 @@ + builtin_assert ("system=embedded"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ ++ builtin_define ("__DEVKITPPC__"); \ ++ builtin_define ("__DEVKITPRO__"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ + } \ + while (0) +diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h +index 2b90694cef1..278f2cf1420 100644 +--- a/gcc/config/rs6000/rs6000.h ++++ b/gcc/config/rs6000/rs6000.h +@@ -193,6 +193,7 @@ ASM_OPT_ANY + /* -mcpu=native handling only makes sense with compiler running on + an PowerPC chip. If changing this condition, also change + the condition in driver-rs6000.cc. */ ++#if 0 + #if defined(__powerpc__) || defined(__POWERPC__) || defined(_AIX) + /* In driver-rs6000.cc. */ + extern const char *host_detect_local_cpu (int argc, const char **argv); +@@ -204,6 +205,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); + #else + #define ASM_CPU_NATIVE_SPEC "%(asm_default)" + #endif ++#endif ++#define ASM_CPU_NATIVE_SPEC "%(asm_default)" + + #ifndef CC1_CPU_SPEC + #ifdef HAVE_LOCAL_CPU_DETECT +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index 2187fe366b7..7b1d1a08cff 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -581,7 +581,11 @@ GNU_USER_TARGET_CC1_SPEC + + /* Default starting address if specified. */ + #define LINK_START_SPEC "\ +-%{mads : %(link_start_ads) ; \ ++%{mgcn|mogc : %(link_start_ogc) ; \ ++ mvgc : %(link_start_vgc) ; \ ++ mgcbios : %(link_start_gcb) ; \ ++ mrvl : %(link_start_rvl) ; \ ++ mads : %(link_start_ads) ; \ + myellowknife : %(link_start_yellowknife) ; \ + mmvme : %(link_start_mvme) ; \ + msim : %(link_start_sim) ; \ +@@ -612,7 +616,8 @@ GNU_USER_TARGET_CC1_SPEC + + /* Any specific OS flags. */ + #define LINK_OS_SPEC "\ +-%{mads : %(link_os_ads) ; \ ++%{mgcn|mogc|mvgc|mgcbios|mrvl : %(link_os_ogc) ; \ ++ mads : %(link_os_ads) ; \ + myellowknife : %(link_os_yellowknife) ; \ + mmvme : %(link_os_mvme) ; \ + msim : %(link_os_sim) ; \ +@@ -627,7 +632,10 @@ GNU_USER_TARGET_CC1_SPEC + /* Override rs6000.h definition. */ + #undef CPP_SPEC + #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \ +-%{mads : %(cpp_os_ads) ; \ ++%{mgcn : %(cpp_os_gcn) ; \ ++ mogc|mvgc|mgcbios : %(cpp_os_ogc) ; \ ++ mrvl : %(cpp_os_rvl) ; \ ++ mads : %(cpp_os_ads) ; \ + myellowknife : %(cpp_os_yellowknife) ; \ + mmvme : %(cpp_os_mvme) ; \ + msim : %(cpp_os_sim) ; \ +@@ -641,7 +649,10 @@ GNU_USER_TARGET_CC1_SPEC + + #undef STARTFILE_SPEC + #define STARTFILE_SPEC "\ +-%{mads : %(startfile_ads) ; \ ++%{mgcn : %(startfile_gcn) ; \ ++ mogc|mvgc|mgcbios : %(startfile_ogc) ; \ ++ mrvl : %(startfile_ogc) ; \ ++ mads : %(startfile_ads) ; \ + myellowknife : %(startfile_yellowknife) ; \ + mmvme : %(startfile_mvme) ; \ + msim : %(startfile_sim) ; \ +@@ -655,7 +666,8 @@ GNU_USER_TARGET_CC1_SPEC + + #undef LIB_SPEC + #define LIB_SPEC "\ +-%{mads : %(lib_ads) ; \ ++%{mgcn|mogc|mvgc|mgcbios|mrvl : %(lib_ogc) ; \ ++ mads : %(lib_ads) ; \ + myellowknife : %(lib_yellowknife) ; \ + mmvme : %(lib_mvme) ; \ + msim : %(lib_sim) ; \ +@@ -665,11 +677,12 @@ GNU_USER_TARGET_CC1_SPEC + mcall-openbsd: %(lib_openbsd) ; \ + : %(lib_default) }" + +-#define LIB_DEFAULT_SPEC "-lc" ++#define LIB_DEFAULT_SPEC "--start-group -lsysbase -lc --end-group" + + #undef ENDFILE_SPEC + #define ENDFILE_SPEC "\ +-%{mads : %(endfile_ads) ; \ ++%{mgcn|mogc|mvgc|mgcbios|mrvl : %(endfile_ogc) ; \ ++ mads : %(endfile_ads) ; \ + myellowknife : %(endfile_yellowknife) ; \ + mmvme : %(endfile_mvme) ; \ + msim : %(endfile_sim) ; \ +@@ -685,16 +698,27 @@ GNU_USER_TARGET_CC1_SPEC + + /* Motorola ADS support. */ + #define LIB_ADS_SPEC "--start-group -lads -lc --end-group" ++#define LIB_OGC_SPEC "--start-group -lsysbase -lc --end-group" + + #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" ++#define STARTFILE_OGC_SPEC "ecrti.o%s crtbegin.o%s crtmain.o%s" + + #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s" ++#define ENDFILE_OGC_SPEC "crtend.o%s ecrtn.o%s" + + #define LINK_START_ADS_SPEC "-T ads.ld%s" ++#define LINK_START_OGC_SPEC "-T ogc.ld%s" ++#define LINK_START_RVL_SPEC "-T rvl.ld%s" ++#define LINK_START_VGC_SPEC "-T vgcogc.ld%s" ++#define LINK_START_GCB_SPEC "-T gcbogc.ld%s" + + #define LINK_OS_ADS_SPEC "" ++#define LINK_OS_OGC_SPEC "--gc-sections" + + #define CPP_OS_ADS_SPEC "" ++#define CPP_OS_GCN_SPEC "-D__gamecube__ -ffunction-sections -fdata-sections" ++#define CPP_OS_OGC_SPEC "-D__gamecube__ -DHW_DOL -ffunction-sections -fdata-sections" ++#define CPP_OS_RVL_SPEC "-D__wii__ -DHW_RVL -ffunction-sections -fdata-sections" + + /* Motorola Yellowknife support. */ + #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group" +@@ -843,6 +867,7 @@ ncrtn.o%s" + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \ ++ { "lib_ogc", LIB_OGC_SPEC }, \ + { "lib_ads", LIB_ADS_SPEC }, \ + { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \ + { "lib_mvme", LIB_MVME_SPEC }, \ +@@ -852,6 +877,7 @@ ncrtn.o%s" + { "lib_netbsd", LIB_NETBSD_SPEC }, \ + { "lib_openbsd", LIB_OPENBSD_SPEC }, \ + { "lib_default", LIB_DEFAULT_SPEC }, \ ++ { "startfile_ogc", STARTFILE_OGC_SPEC }, \ + { "startfile_ads", STARTFILE_ADS_SPEC }, \ + { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \ + { "startfile_mvme", STARTFILE_MVME_SPEC }, \ +@@ -861,6 +887,7 @@ ncrtn.o%s" + { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ + { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \ + { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ ++ { "endfile_ogc", ENDFILE_OGC_SPEC }, \ + { "endfile_ads", ENDFILE_ADS_SPEC }, \ + { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \ + { "endfile_mvme", ENDFILE_MVME_SPEC }, \ +@@ -872,7 +899,11 @@ ncrtn.o%s" + { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ + { "link_shlib", LINK_SHLIB_SPEC }, \ + { "link_start", LINK_START_SPEC }, \ ++ { "link_start_vgc", LINK_START_VGC_SPEC }, \ ++ { "link_start_gcb", LINK_START_GCB_SPEC }, \ ++ { "link_start_rvl", LINK_START_RVL_SPEC }, \ + { "link_start_ads", LINK_START_ADS_SPEC }, \ ++ { "link_start_ogc", LINK_START_OGC_SPEC }, \ + { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \ + { "link_start_mvme", LINK_START_MVME_SPEC }, \ + { "link_start_sim", LINK_START_SIM_SPEC }, \ +@@ -882,6 +913,7 @@ ncrtn.o%s" + { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \ + { "link_start_default", LINK_START_DEFAULT_SPEC }, \ + { "link_os", LINK_OS_SPEC }, \ ++ { "link_os_ogc", LINK_OS_OGC_SPEC }, \ + { "link_os_ads", LINK_OS_ADS_SPEC }, \ + { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \ + { "link_os_mvme", LINK_OS_MVME_SPEC }, \ +@@ -893,6 +925,9 @@ ncrtn.o%s" + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ + { "link_secure_plt", LINK_SECURE_PLT_SPEC }, \ ++ { "cpp_os_gcn", CPP_OS_GCN_SPEC }, \ ++ { "cpp_os_ogc", CPP_OS_OGC_SPEC }, \ ++ { "cpp_os_rvl", CPP_OS_RVL_SPEC }, \ + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ +diff --git a/gcc/config/rs6000/sysv4.opt b/gcc/config/rs6000/sysv4.opt +index 66b0de0ae43..85152e122da 100644 +--- a/gcc/config/rs6000/sysv4.opt ++++ b/gcc/config/rs6000/sysv4.opt +@@ -124,6 +124,26 @@ mads + Target RejectNegative + Link with libads.a, libc.a and crt0.o. + ++mgcn ++Target RejectNegative ++Link with libsysbase.a and libc.a, use ogc linker script ++ ++mogc ++Target RejectNegative ++Link with libsysbase.a and libc.a, use ogc linker script ++ ++mgcbios ++Target RejectNegative ++Link with libsysbase.a and libc.a, use gcbogc linker script ++ ++mvgc ++Target RejectNegative ++Link with libsysbase.a and libc.a, use gcbogc linker script ++ ++mrvl ++Target RejectNegative ++Link with libsysbase.a and libc.a, use rvl linker script ++ + myellowknife + Target RejectNegative + Link with libyk.a, libc.a and crt0.o. +diff --git a/gcc/devkitpro.opt b/gcc/devkitpro.opt +new file mode 100644 +index 00000000000..92731fee3ba +--- /dev/null ++++ b/gcc/devkitpro.opt +@@ -0,0 +1,30 @@ ++; Options for devkitPro toolchains. ++ ++; Copyright (C) 2011-2018 Free Software Foundation, Inc. ++; ++; This file is part of GCC. ++; ++; GCC is free software; you can redistribute it and/or modify it under ++; the terms of the GNU General Public License as published by the Free ++; Software Foundation; either version 3, or (at your option) any later ++; version. ++; ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++; for more details. ++; ++; You should have received a copy of the GNU General Public License ++; along with GCC; see the file COPYING3. If not see ++; . ++ ++; See the GCC internals manual (options.texi) for a description of ++; this file's format. ++ ++; Please try to keep this file in ASCII collating order. ++ ++pthread ++Driver ++ ++; This comment is to ensure we retain the blank line above. ++ +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index 43b0158ee02..2103719ae82 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -903,6 +903,11 @@ proper position among the other output files. */ + #endif + #endif + ++#ifndef LIBGLOSS_SPEC ++# define LIBGLOSS_SPEC "-lsysbase" ++#endif ++ ++ + /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ + #ifndef STARTFILE_SPEC + #define STARTFILE_SPEC \ +@@ -1241,6 +1246,7 @@ static const char *link_spec = LINK_SPEC LIBC_LINK_SPEC; + static const char *lib_spec = LIB_SPEC; + static const char *link_gomp_spec = ""; + static const char *libgcc_spec = LIBGCC_SPEC; ++static const char *libgloss_spec = LIBGLOSS_SPEC; + static const char *endfile_spec = ENDFILE_SPEC; + static const char *startfile_spec = STARTFILE_SPEC; + static const char *linker_name_spec = LINKER_NAME; +@@ -1758,6 +1764,7 @@ static struct spec_list static_specs[] = + INIT_STATIC_SPEC ("lib", &lib_spec), + INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec), + INIT_STATIC_SPEC ("libgcc", &libgcc_spec), ++ INIT_STATIC_SPEC ("libgloss", &libgloss_spec), + INIT_STATIC_SPEC ("startfile", &startfile_spec), + INIT_STATIC_SPEC ("cross_compile", &cross_compile), + INIT_STATIC_SPEC ("version", &compiler_version), +diff --git a/libcc1/configure b/libcc1/configure +index e010d1b67e5..420b41b5a3b 100755 +--- a/libcc1/configure ++++ b/libcc1/configure +@@ -5120,7 +5120,7 @@ else + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in +- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" ++ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) +diff --git a/libgcc/config/arm/t-bpabi b/libgcc/config/arm/t-bpabi +index dddddc7c444..c2502597953 100644 +--- a/libgcc/config/arm/t-bpabi ++++ b/libgcc/config/arm/t-bpabi +@@ -17,4 +17,4 @@ SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver + # On ARM, specifying -fnon-call-exceptions will needlessly pull in + # the unwinder in simple programs which use 64-bit division. Omitting + # the option is safe. +-LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions ++LIB2_DIVMOD_EXCEPTION_FLAGS := -fno-exceptions +diff --git a/libgcc/config/rs6000/crtrestvr.S b/libgcc/config/rs6000/crtrestvr.S +index e7b03f8a08b..c57bd054ff2 100644 +--- a/libgcc/config/rs6000/crtrestvr.S ++++ b/libgcc/config/rs6000/crtrestvr.S +@@ -24,7 +24,7 @@ + + /* On PowerPC64 Linux, these functions are provided by the linker. */ + #ifndef __powerpc64__ +- ++#if 0 + #undef __ALTIVEC__ + #define __ALTIVEC__ 1 + #include "ppc-asm.h" +@@ -86,3 +86,4 @@ FUNC_END(_restvr_20) + CFI_ENDPROC + + #endif ++#endif +diff --git a/libgcc/config/rs6000/crtsavevr.S b/libgcc/config/rs6000/crtsavevr.S +index a8db1d1ee8e..7e2257f1ef2 100644 +--- a/libgcc/config/rs6000/crtsavevr.S ++++ b/libgcc/config/rs6000/crtsavevr.S +@@ -24,7 +24,7 @@ + + /* On PowerPC64 Linux, these functions are provided by the linker. */ + #ifndef __powerpc64__ +- ++#if 0 + #undef __ALTIVEC__ + #define __ALTIVEC__ 1 + #include "ppc-asm.h" +@@ -86,3 +86,4 @@ FUNC_END(_savevr_20) + CFI_ENDPROC + + #endif ++#endif +diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c +index 44820cb27c1..a8689e388f8 100644 +--- a/libgcc/crtstuff.c ++++ b/libgcc/crtstuff.c +@@ -326,7 +326,7 @@ register_tm_clones (void) + + #ifdef OBJECT_FORMAT_ELF + +-#if DEFAULT_USE_CXA_ATEXIT ++#if 1 /* DEFAULT_USE_CXA_ATEXIT */ + /* Declare the __dso_handle variable. It should have a unique value + in every shared-object; in a main program its value is zero. The + object should in any case be protected. This means the instance +diff --git a/libgcc/gthr.h b/libgcc/gthr.h +index 8cd29834228..473ea9b64a7 100644 +--- a/libgcc/gthr.h ++++ b/libgcc/gthr.h +@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + /* The pe-coff weak support isn't fully compatible to ELF's weak. + For static libraries it might would work, but as we need to deal + with shared versions too, we disable it for mingw-targets. */ +-#ifdef __MINGW32__ ++#if defined (__MINGW32__) || defined (__DEVKITPRO__) + #undef GTHREAD_USE_WEAK + #define GTHREAD_USE_WEAK 0 + #endif +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 6713e4504b1..e01cd713aac 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -5083,7 +5083,7 @@ else + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +@@ -5129,7 +5129,7 @@ else + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +@@ -5153,7 +5153,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +@@ -5198,7 +5198,7 @@ else + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +@@ -5222,7 +5222,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +@@ -28775,6 +28775,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + $as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h + ++ $as_echo "#define HAVE_ALIGNED_ALLOC 1" >>confdefs.h ++ + + case "${target}" in + *-rtems*) +@@ -54145,7 +54147,7 @@ $as_echo "$glibcxx_cv_libbacktrace_atomics" >&6; } + CXXFLAGS='-O0 -S' + + cat > conftest.$ac_ext << EOF +-#line 54148 "configure" ++#line 54150 "configure" + #include + int main() + { +diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac +index f81dccdeef7..4f4b7b5f475 100644 +--- a/libstdc++-v3/configure.ac ++++ b/libstdc++-v3/configure.ac +@@ -387,6 +387,7 @@ dnl # rather than hardcoding that information. + fi + + AC_DEFINE(HAVE_MEMALIGN) ++ AC_DEFINE(HAVE_ALIGNED_ALLOC) + + case "${target}" in + *-rtems*) +diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am +index e9e46139da2..8cc48b55c6b 100644 +--- a/libstdc++-v3/include/Makefile.am ++++ b/libstdc++-v3/include/Makefile.am +@@ -1466,6 +1466,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} + -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ + -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ + -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ ++ -e 's/_GLIBCXX___DEVKITPRO__/__DEVKITPRO__/g' \ + -e 's,^#include "\(.*\)",#include ,g' \ + < $< > $@ + +diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in +index f3d2f58dbe4..64a4fecfb87 100644 +--- a/libstdc++-v3/include/Makefile.in ++++ b/libstdc++-v3/include/Makefile.in +@@ -1943,6 +1943,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} + -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ + -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ + -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ ++ -e 's/_GLIBCXX___DEVKITPRO__/__DEVKITPRO__/g' \ + -e 's,^#include "\(.*\)",#include ,g' \ + < $< > $@ + +diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream +index c4e222b8fef..9d6b3ff1373 100644 +--- a/libstdc++-v3/include/std/fstream ++++ b/libstdc++-v3/include/std/fstream +@@ -53,7 +53,7 @@ + + // This can be overridden by the target's os_defines.h + #ifndef _GLIBCXX_BUFSIZ +-# define _GLIBCXX_BUFSIZ BUFSIZ ++# define _GLIBCXX_BUFSIZ (BUFSIZ+1) + #endif + + namespace std _GLIBCXX_VISIBILITY(default) +diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc +index aab2aec7f66..374acbd121b 100644 +--- a/libstdc++-v3/libsupc++/eh_alloc.cc ++++ b/libstdc++-v3/libsupc++/eh_alloc.cc +@@ -143,6 +143,7 @@ namespace + { + public: + pool() noexcept; ++ ~pool(); + + _GLIBCXX_NODISCARD void *allocate (std::size_t) noexcept; + void free (void *) noexcept; +@@ -248,6 +249,15 @@ namespace + first_free_entry->next = NULL; + } + ++ pool::~pool() ++ { ++ if (arena) ++ { ++ ::free(arena); ++ arena = 0; ++ } ++ } ++ + void *pool::allocate (std::size_t size) noexcept + { + __scoped_lock sentry(emergency_mutex); +diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc +index 454962c7521..579e19f7d02 100644 +--- a/libstdc++-v3/src/c++17/fs_ops.cc ++++ b/libstdc++-v3/src/c++17/fs_ops.cc +@@ -1153,6 +1153,7 @@ fs::permissions(const path& p, perms prms, perm_options opts, + } + + int err = 0; ++#ifndef __DEVKITPPC__ + #if _GLIBCXX_USE_FCHMODAT + const int flag = (nofollow && is_symlink(st)) ? AT_SYMLINK_NOFOLLOW : 0; + if (::fchmodat(AT_FDCWD, p.c_str(), static_cast(prms), flag)) +@@ -1162,6 +1163,7 @@ fs::permissions(const path& p, perms prms, perm_options opts, + ec = std::__unsupported(); + else if (posix::chmod(p.c_str(), static_cast(prms))) + err = errno; ++#endif + #endif + + if (err) +diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h +index 304d5896d02..0ab7bd3b26c 100644 +--- a/libstdc++-v3/src/filesystem/ops-common.h ++++ b/libstdc++-v3/src/filesystem/ops-common.h +@@ -560,6 +560,7 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM + return false; + } + ++#ifndef __DEVKITPPC__ + #if defined _GLIBCXX_USE_FCHMOD && ! defined _GLIBCXX_FILESYSTEM_IS_WINDOWS + if (::fchmod(out.fd, from_st->st_mode)) + #elif defined _GLIBCXX_USE_FCHMODAT && ! defined _GLIBCXX_FILESYSTEM_IS_WINDOWS +@@ -573,6 +574,7 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM + ec.assign(errno, std::generic_category()); + return false; + } ++#endif + + bool has_copied = false; + +diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc +index 80f83c049c7..5699c75e655 100644 +--- a/libstdc++-v3/src/filesystem/ops.cc ++++ b/libstdc++-v3/src/filesystem/ops.cc +@@ -987,6 +987,7 @@ fs::permissions(const path& p, perms prms, error_code& ec) noexcept + } + + int err = 0; ++#ifndef __DEVKITPPC__ + #if _GLIBCXX_USE_FCHMODAT + const int flag = (nofollow && is_symlink(st)) ? AT_SYMLINK_NOFOLLOW : 0; + if (::fchmodat(AT_FDCWD, p.c_str(), static_cast(prms), flag)) +@@ -996,6 +997,7 @@ fs::permissions(const path& p, perms prms, error_code& ec) noexcept + ec = std::__unsupported(); + else if (posix::chmod(p.c_str(), static_cast(prms))) + err = errno; ++#endif + #endif + + if (err) +diff --git a/lto-plugin/configure b/lto-plugin/configure +index 2e37612e60b..e4fc628143f 100755 +--- a/lto-plugin/configure ++++ b/lto-plugin/configure +@@ -6470,7 +6470,7 @@ else + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in +- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" ++ $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) diff --git a/select_toolchain.sh b/select_toolchain.sh index 4716f0a..4ce3788 100755 --- a/select_toolchain.sh +++ b/select_toolchain.sh @@ -29,6 +29,7 @@ do done case "$VERSION" in +# devkitARM "1" ) BINUTILS_VER=2.45.1 GCC_VER=15.2.0 @@ -45,13 +46,14 @@ case "$VERSION" in _rules_ver=${DKARM_RULES_VER} _crtls_ver=${DKARM_CRTLS_VER} ;; +# devkitPPC "2" ) - BINUTILS_VER=2.45.1 - GCC_VER=15.2.0 + BINUTILS_VER=2.46.0 + GCC_VER=16.1.0 MN_BINUTILS_VER=2.24 NEWLIB_VER=4.6.0.20260123 - BINUTILS_PKGREL=2 - GCC_PKGREL=7 + BINUTILS_PKGREL=1 + GCC_PKGREL=1 NEWLIB_PKGREL=4 basedir='dkppc' package=devkitPPC @@ -63,6 +65,7 @@ case "$VERSION" in _rules_ver=${DKPPC_RULES_VER} _crtls_ver=${DKPPC_CRTLS_VER} ;; +# devkitA64 "3" ) GCC_VER=15.2.0 BINUTILS_VER=2.45.1