diff -Nru /Users/io/Downloads/gcc-14.3.0/config/dfp.m4 dist/config/dfp.m4 --- /Users/io/Downloads/gcc-14.3.0/config/dfp.m4 2025-05-23 13:02:03 +++ dist/config/dfp.m4 2025-11-14 01:50:21 @@ -38,7 +38,7 @@ ], [ case $1 in - aarch64* | \ + aarch64*-*-linux* | \ powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ diff -Nru /Users/io/Downloads/gcc-14.3.0/config/tls.m4 dist/config/tls.m4 --- /Users/io/Downloads/gcc-14.3.0/config/tls.m4 2025-05-23 13:02:03 +++ dist/config/tls.m4 2025-11-14 01:50:21 @@ -104,7 +104,7 @@ gcc_cv_have_cc_tls, [ AC_COMPILE_IFELSE([AC_LANG_SOURCE([__thread int a; int b; int main() { return a = b; }])], [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])] - )]) + ) if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then AC_DEFINE(HAVE_CC_TLS, 1, [Define to 1 if the target assembler supports thread-local storage.]) diff -Nru /Users/io/Downloads/gcc-14.3.0/config.sub dist/config.sub --- /Users/io/Downloads/gcc-14.3.0/config.sub 2025-05-23 13:02:03 +++ dist/config.sub 2025-11-14 01:50:21 @@ -1211,6 +1211,7 @@ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64eb | mips64el \ + | mipsn64 | mipsn64eb | mipsn64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ diff -Nru /Users/io/Downloads/gcc-14.3.0/configure dist/configure --- /Users/io/Downloads/gcc-14.3.0/configure 2025-05-23 13:03:15 +++ dist/configure 2025-11-14 01:50:21 @@ -2369,15 +2369,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done @@ -8737,7 +8737,12 @@ if test $target_elf = yes; then : # ELF platforms build the lto-plugin always. - build_lto_plugin=yes + case $target in + m68010-*) + build_lto_plugin=no;; + *) + build_lto_plugin=yes;; + esac else if test x"$default_enable_lto" = x"yes" ; then diff -Nru /Users/io/Downloads/gcc-14.3.0/configure.ac dist/configure.ac --- /Users/io/Downloads/gcc-14.3.0/configure.ac 2025-05-23 13:02:03 +++ dist/configure.ac 2025-11-14 01:50:21 @@ -1914,7 +1914,12 @@ enable_lto=yes; default_enable_lto=yes) ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always. - build_lto_plugin=yes + case $target in + m68010-*) + build_lto_plugin=no;; + *) + build_lto_plugin=yes;; + esac ],[if test x"$default_enable_lto" = x"yes" ; then case $target in *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;; diff -Nru /Users/io/Downloads/gcc-14.3.0/fixincludes/configure dist/fixincludes/configure --- /Users/io/Downloads/gcc-14.3.0/fixincludes/configure 2025-05-23 13:02:03 +++ dist/fixincludes/configure 2025-11-14 01:50:21 @@ -2180,15 +2180,15 @@ for ac_dir in .. "$srcdir"/..; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/Makefile.in dist/gcc/Makefile.in --- /Users/io/Downloads/gcc-14.3.0/gcc/Makefile.in 2025-05-23 13:02:03 +++ dist/gcc/Makefile.in 2025-11-14 01:50:21 @@ -744,6 +744,9 @@ exeext = @host_exeext@ build_exeext = @build_exeext@ +# NetBSD mknative-gcc addition +ENABLE_SHARED = @enable_shared@ + # Directory in which to put man pages. mandir = @mandir@ man1dir = $(mandir)/man1 @@ -814,6 +817,7 @@ # Control whether header files are installed. INSTALL_HEADERS=install-headers install-mkheaders +INSTALL_HEADERS=install-headers # Control whether Info documentation is built and installed. BUILD_INFO = @BUILD_INFO@ @@ -1643,6 +1649,7 @@ reginfo.o \ regrename.o \ regstat.o \ + regsub.o \ reload.o \ reload1.o \ reorg.o \ @@ -2274,7 +2281,7 @@ checksum-options: echo "$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS)" > checksum-options.tmp \ - && $(srcdir)/../move-if-change checksum-options.tmp checksum-options + && $(SHELL) $(srcdir)/../move-if-change checksum-options.tmp checksum-options # # Build libgcc.a. @@ -2282,7 +2289,7 @@ libgcc-support: libgcc.mvars stmp-int-hdrs $(TCONFIG_H) \ $(MACHMODE_H) version.h -libgcc.mvars: config.status Makefile specs xgcc$(exeext) +libgcc.mvars: config.status Makefile : > tmp-libgcc.mvars echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars @@ -2303,6 +2310,7 @@ s-mlib: $(srcdir)/genmultilib Makefile if test @enable_multilib@ = yes \ || test -n "$(MULTILIB_OSDIRNAMES)"; then \ + CONFIG_SHELL="$(SHELL)" \ $(SHELL) $(srcdir)/genmultilib \ "$(MULTILIB_OPTIONS)" \ "$(MULTILIB_DIRNAMES)" \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c/Make-lang.in dist/gcc/c/Make-lang.in --- /Users/io/Downloads/gcc-14.3.0/gcc/c/Make-lang.in 2025-05-23 13:02:04 +++ dist/gcc/c/Make-lang.in 2025-11-14 01:50:21 @@ -79,7 +79,7 @@ else \ build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \ checksum-options > cc1-checksum.cc.tmp && \ - $(srcdir)/../move-if-change cc1-checksum.cc.tmp cc1-checksum.cc; \ + $(SHELL) $(srcdir)/../move-if-change cc1-checksum.cc.tmp cc1-checksum.cc; \ fi cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-cppbuiltin.cc dist/gcc/c-family/c-cppbuiltin.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-cppbuiltin.cc 2025-05-23 13:02:04 +++ dist/gcc/c-family/c-cppbuiltin.cc 2025-11-14 01:50:21 @@ -519,22 +519,35 @@ builtin_define_type_max ("__UINT_LEAST64_MAX__", uint_least64_type_node); builtin_define_constants ("__UINT64_C", uint_least64_type_node); } +/* + * NetBSD/sparc64 long ago defined signed and unsigned fast{8,16,32} to be + * different to the common sparc64 definitions, and they are not the same + * size for the same bitsize. GCC 7 introduced checks that they are the + * same size below that trigger here. + * + * NETBSD_TOOLS/NETBSD_NATIVE is wrong for this, but it will do for now. + */ +#if defined(NETBSD_TOOLS) || defined(NETBSD_NATIVE) +#define builtin_define_type_width_nb(a,b,c) builtin_define_type_width(a,b,NULL_TREE) +#else +#define builtin_define_type_width_nb(a,b,c) builtin_define_type_width(a,b,c) +#endif if (int_fast8_type_node) { builtin_define_type_max ("__INT_FAST8_MAX__", int_fast8_type_node); - builtin_define_type_width ("__INT_FAST8_WIDTH__", int_fast8_type_node, + builtin_define_type_width_nb ("__INT_FAST8_WIDTH__", int_fast8_type_node, uint_fast8_type_node); } if (int_fast16_type_node) { builtin_define_type_max ("__INT_FAST16_MAX__", int_fast16_type_node); - builtin_define_type_width ("__INT_FAST16_WIDTH__", int_fast16_type_node, + builtin_define_type_width_nb ("__INT_FAST16_WIDTH__", int_fast16_type_node, uint_fast16_type_node); } if (int_fast32_type_node) { builtin_define_type_max ("__INT_FAST32_MAX__", int_fast32_type_node); - builtin_define_type_width ("__INT_FAST32_WIDTH__", int_fast32_type_node, + builtin_define_type_width_nb ("__INT_FAST32_WIDTH__", int_fast32_type_node, uint_fast32_type_node); } if (int_fast64_type_node) @@ -543,6 +556,7 @@ builtin_define_type_width ("__INT_FAST64_WIDTH__", int_fast64_type_node, uint_fast64_type_node); } +#undef builtin_define_type_width_nb if (uint_fast8_type_node) builtin_define_type_max ("__UINT_FAST8_MAX__", uint_fast8_type_node); if (uint_fast16_type_node) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-format.cc dist/gcc/c-family/c-format.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-format.cc 2025-05-23 13:02:04 +++ dist/gcc/c-family/c-format.cc 2025-11-14 01:50:21 @@ -938,43 +938,43 @@ printf_flag_specs, printf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', 0, - &integer_type_node, &integer_type_node + &integer_type_node, &integer_type_node, format_type_error }, { "asm_fprintf", asm_fprintf_length_specs, asm_fprintf_char_table, " +#0-", NULL, asm_fprintf_flag_specs, asm_fprintf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL, gcc_diag_flag_specs, gcc_diag_flag_pairs, - FMT_FLAG_ARG_CONVERT, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+#", NULL, gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs, - FMT_FLAG_ARG_CONVERT, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+#", NULL, gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs, - FMT_FLAG_ARG_CONVERT, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_cxxdiag", gcc_cxxdiag_length_specs, gcc_cxxdiag_char_table, "q+#", NULL, gcc_cxxdiag_flag_specs, gcc_cxxdiag_flag_pairs, - FMT_FLAG_ARG_CONVERT, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_gfc", gcc_gfc_length_specs, gcc_gfc_char_table, "q+#", NULL, gcc_gfc_flag_specs, gcc_gfc_flag_pairs, - FMT_FLAG_ARG_CONVERT, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 0, 0, 0, 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gcc_dump_printf", gcc_dump_printf_length_specs, gcc_dump_printf_char_table, "q+#", NULL, @@ -986,24 +986,30 @@ { "NSString", NULL, NULL, NULL, NULL, NULL, NULL, FMT_FLAG_ARG_CONVERT|FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL, 0, 0, 0, 0, 0, 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_scanf", scanf_length_specs, scan_char_table, "*'I", NULL, scanf_flag_specs, scanf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, 'w', 0, 0, '*', 'L', 'm', - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_strftime", NULL, time_char_table, "_-0^#", "EO", strftime_flag_specs, strftime_flag_pairs, - FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0, 0, - NULL, NULL + FMT_FLAG_FANCY_PERCENT_OK|FMT_FLAG_M_OK, 'w', 0, 0, 0, 0, 0, + NULL, NULL, format_type_error }, { "gnu_strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL, strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, - NULL, NULL - } + NULL, NULL, format_type_error + }, + { "gnu_syslog", printf_length_specs, print_char_table, " +#0-'I", NULL, + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_M_OK, + 'w', 0, 'p', 0, 'L', 0, + &integer_type_node, &integer_type_node, printf_format_type + }, }; /* This layer of indirection allows GCC to reassign format_types with @@ -1231,6 +1237,7 @@ params = tree_cons (NULL_TREE, argarray[i], params); check_format_info (&info, params, arglocs); } + const format_kind_info *fi = &format_types[info.format_type]; /* Attempt to detect whether the current function might benefit from the format attribute if the called function is decorated @@ -1239,8 +1246,7 @@ if (warn_suggest_attribute_format && current_function_decl != NULL_TREE && info.first_arg_num == 0 - && (format_types[info.format_type].flags - & (int) FMT_FLAG_ARG_CONVERT) + && (fi->flags & (int) FMT_FLAG_ARG_CONVERT) /* c_strlen will fail for a function parameter but succeed for a literal or constant array. */ && !c_strlen (argarray[info.format_num - 1], 1)) @@ -1249,11 +1255,17 @@ for (c = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)); c; c = TREE_CHAIN (c)) - if (is_attribute_p ("format", get_attribute_name (c)) - && (decode_format_type (IDENTIFIER_POINTER - (TREE_VALUE (TREE_VALUE (c)))) - == info.format_type)) - break; + { + if (!is_attribute_p ("format", TREE_PURPOSE (c))) + continue; + int format_type = decode_format_type ( + IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (c)))); + if (format_type == format_type_error) + continue; + if (format_type == info.format_type || + format_type == fi->parent_format_type) + break; + } if (c == NULL_TREE) { /* Check if the current function has a parameter to which @@ -3935,6 +3947,14 @@ "conversion lacks type at end of format"); continue; } + + if (format_char == 'm' && !(fki->flags & FMT_FLAG_M_OK)) + { + warning (OPT_Wformat_, + "%%m is only allowed in syslog(3) like functions"); + continue; + } + format_chars++; const format_char_info * const fci @@ -5137,6 +5157,7 @@ static const target_ovr_attr gnu_target_overrides_format_attributes[] = { { "gnu_printf", "printf" }, + { "gnu_syslog", "syslog" }, { "gnu_scanf", "scanf" }, { "gnu_strftime", "strftime" }, { "gnu_strfmon", "strfmon" }, diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-format.h dist/gcc/c-family/c-format.h --- /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-format.h 2025-05-23 13:02:04 +++ dist/gcc/c-family/c-format.h 2025-11-14 01:50:21 @@ -85,11 +85,13 @@ FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128, /* The format arg is an opaque object that will be parsed by an external facility. */ - FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256 + FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256, /* Not included here: details of whether width or precision may occur (controlled by width_char and precision_char); details of whether '*' can be used for these (width_type and precision_type); details of whether length modifiers can occur (length_char_specs). */ + FMT_FLAG_M_OK = 512 + /* %m is only allowed in syslog */ }; /* Structure describing a length modifier supported in format checking, and @@ -273,6 +275,8 @@ /* Pointer to type of argument expected if '*' is used for a precision, or NULL if '*' not used for precisions. */ tree *precision_type; + /* A format type that is a subset of our format */ + int parent_format_type; }; #define T_I &integer_type_node diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-opts.cc dist/gcc/c-family/c-opts.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c-opts.cc 2025-05-23 13:02:04 +++ dist/gcc/c-family/c-opts.cc 2025-11-14 01:50:21 @@ -322,6 +322,10 @@ cpp_opts->discard_comments_in_macro_exp = 0; break; + case OPT_cxx_isystem: + add_path (xstrdup (arg), INC_SYSTEM, 1, true); + break; + case OPT_D: defer_opt (code, arg); break; @@ -604,6 +608,10 @@ case OPT_iquote: add_path (xstrdup (arg), INC_QUOTE, 0, true); + break; + + case OPT_iremap: + add_cpp_remap_path (arg); break; case OPT_isysroot: diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c.opt dist/gcc/c-family/c.opt --- /Users/io/Downloads/gcc-14.3.0/gcc/c-family/c.opt 2025-05-23 13:02:04 +++ dist/gcc/c-family/c.opt 2025-11-14 01:50:21 @@ -1566,6 +1566,12 @@ C ObjC C++ ObjC++ A synonym for -std=c89 (for C) or -std=c++98 (for C++). +; This should really just be C++/ObjC++ but we (NetBSD) use it when +; calling C and ObjC compilers as well. +cxx-isystem +C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) +-cxx-isystem Add to the start of the C++ system include path + d C ObjC C++ ObjC++ Joined ; Documented in common.opt. FIXME - what about -dI, -dD, -dN and -dD? @@ -2396,6 +2402,10 @@ iquote C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) -iquote Add to the end of the quote include path. + +iremap +C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) +-iremap Convert to if it occurs as prefix in __FILE__. iwithprefix C ObjC C++ ObjC++ Joined Separate diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/cfgexpand.cc dist/gcc/cfgexpand.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/cfgexpand.cc 2025-05-23 13:02:04 +++ dist/gcc/cfgexpand.cc 2025-11-14 01:50:21 @@ -1943,7 +1943,9 @@ else len = tree_to_uhwi (TYPE_SIZE_UNIT (type)); - if (len < max) + if (len == 0) + ret = SPCT_HAS_ARRAY; + else if (len < max) ret = SPCT_HAS_SMALL_CHAR_ARRAY | SPCT_HAS_ARRAY; else ret = SPCT_HAS_LARGE_CHAR_ARRAY | SPCT_HAS_ARRAY; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/common/config/arm/arm-common.cc dist/gcc/common/config/arm/arm-common.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/common/config/arm/arm-common.cc 2025-05-23 13:02:04 +++ dist/gcc/common/config/arm/arm-common.cc 2025-11-14 01:50:21 @@ -55,6 +55,9 @@ return UI_SJLJ; #endif + if (ARM_DWARF_UNWIND_TABLES) + return UI_DWARF2; + /* If not using ARM EABI unwind tables... */ if (ARM_UNWIND_INFO) { diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/common.opt dist/gcc/common.opt --- /Users/io/Downloads/gcc-14.3.0/gcc/common.opt 2025-05-23 13:02:04 +++ dist/gcc/common.opt 2025-11-14 01:50:21 @@ -1307,6 +1307,10 @@ Common Joined RejectNegative Var(common_deferred_options) Defer -ffile-prefix-map== Map one directory name to another in compilation result. +fdebug-regex-map= +Common Joined RejectNegative Var(common_deferred_options) Defer +Map one directory name to another in debug information using regular expression matching. + fdebug-types-section Common Var(flag_debug_types_section) Init(0) Output .debug_types section when using DWARF v4 debuginfo. @@ -1325,6 +1329,8 @@ Common Var(flag_delete_dead_exceptions) Init(0) Optimization Delete dead instructions that may throw exceptions. +;; netbsd GCC 5 disabled this, GCC 6 has it default to -1 +;; figure out what -1 means fdelete-null-pointer-checks Common Var(flag_delete_null_pointer_checks) Init(-1) Optimization Delete useless null pointer checks. diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-builtins.cc dist/gcc/config/aarch64/aarch64-builtins.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-builtins.cc 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/aarch64-builtins.cc 2025-11-14 01:50:21 @@ -1836,7 +1836,7 @@ } /* Initialize the memory tagging extension (MTE) builtins. */ -static GTY(()) struct GTY(()) +static GTY(()) struct aarch64_mte { tree ftype; enum insn_code icode; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-netbsd.h dist/gcc/config/aarch64/aarch64-netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/aarch64-netbsd.h 2025-11-14 01:50:21 @@ -1,5 +1,7 @@ /* Definitions for AArch64 running NetBSD Copyright (C) 2016-2024 Free Software Foundation, Inc. + Contributed by Matthew Green (mrg@eterna23.net) and Christos Zoulas + (christos@NetBSD.org.) This file is part of GCC. @@ -19,6 +21,10 @@ #ifndef GCC_AARCH64_NETBSD_H #define GCC_AARCH64_NETBSD_H + +/* NetBSD malloc(3) does 64, not 128 bits. */ +#undef MALLOC_ABI_ALIGNMENT +#define MALLOC_ABI_ALIGNMENT 64 #define TARGET_LINKER_BIG_EMULATION "aarch64nbsdb" #define TARGET_LINKER_LITTLE_EMULATION "aarch64nbsd" diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-sve.md dist/gcc/config/aarch64/aarch64-sve.md --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64-sve.md 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/aarch64-sve.md 2025-11-14 01:50:21 @@ -10989,16 +10989,12 @@ (define_insn "@aarch64_sve_set_neonq_" [(set (match_operand:SVE_FULL 0 "register_operand" "=w") - (unspec:SVE_FULL - [(match_operand:SVE_FULL 1 "register_operand" "w") - (match_operand: 2 "register_operand" "w") - (match_operand: 3 "register_operand" "Upl")] - UNSPEC_SET_NEONQ))] + (unspec:SVE_FULL + [(match_operand:SVE_FULL 1 "register_operand" "w") + (match_operand: 2 "register_operand" "w") + (match_operand: 3 "register_operand" "Upl")] + UNSPEC_SET_NEONQ))] "TARGET_SVE && BYTES_BIG_ENDIAN" - { - operands[2] = lowpart_subreg (mode, operands[2], - GET_MODE (operands[2])); - return "sel\t%0., %3, %2., %1."; - } + "sel\t%0., %3, %Z2., %1." ) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64.cc dist/gcc/config/aarch64/aarch64.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64.cc 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/aarch64.cc 2025-11-14 01:50:21 @@ -24019,6 +24019,13 @@ emit_insn (rec_seq); } + /* The two halves should (by induction) be individually endian-correct. + However, in the memory layout provided by VALS, the nth element of + HALVES[0] comes immediately before the nth element HALVES[1]. + This means that, on big-endian targets, the nth element of HALVES[0] + is more significant than the nth element HALVES[1]. */ + if (BYTES_BIG_ENDIAN) + std::swap (halves[0], halves[1]); rtvec v = gen_rtvec (2, halves[0], halves[1]); rtx_insn *zip1_insn = emit_set_insn (target, gen_rtx_UNSPEC (mode, v, UNSPEC_ZIP1)); diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64.h dist/gcc/config/aarch64/aarch64.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/aarch64.h 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/aarch64.h 2025-11-14 01:50:21 @@ -1410,7 +1410,8 @@ /* Extra specs when building a native AArch64-hosted compiler. Option rewriting rules based on host system. */ -#if defined(__aarch64__) +#if defined(__aarch64__) && \ + (defined(__linux__) || defined(__NetBSD__)) extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT # define EXTRA_SPEC_FUNCTIONS \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/arm_neon.h dist/gcc/config/aarch64/arm_neon.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/arm_neon.h 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/arm_neon.h 2025-11-14 01:50:21 @@ -29,6 +29,7 @@ #pragma GCC push_options #pragma GCC target ("+nothing+simd") +#pragma GCC diagnostic push #pragma GCC aarch64 "arm_neon.h" @@ -6897,7 +6898,7 @@ __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vabsd_s64 (int64_t __a) { - return __a < 0 ? - (uint64_t) __a : __a; + return __a < 0 ? (int64_t) (- (uint64_t) __a) : __a; } /* vadd */ @@ -14847,7 +14848,7 @@ vld2_lane_u8 (const uint8_t * __ptr, uint8x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x4x2_t @@ -14855,7 +14856,7 @@ vld2_lane_u16 (const uint16_t * __ptr, uint16x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x2x2_t @@ -14863,7 +14864,7 @@ vld2_lane_u32 (const uint32_t * __ptr, uint32x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x1x2_t @@ -14871,7 +14872,7 @@ vld2_lane_u64 (const uint64_t * __ptr, uint64x1x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanedi_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x8x2_t @@ -14879,7 +14880,7 @@ vld2_lane_s8 (const int8_t * __ptr, int8x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x4x2_t @@ -14887,7 +14888,7 @@ vld2_lane_s16 (const int16_t * __ptr, int16x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x2x2_t @@ -14895,7 +14896,7 @@ vld2_lane_s32 (const int32_t * __ptr, int32x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x1x2_t @@ -14903,7 +14904,7 @@ vld2_lane_s64 (const int64_t * __ptr, int64x1x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanedi ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x4x2_t @@ -14911,7 +14912,7 @@ vld2_lane_f16 (const float16_t * __ptr, float16x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x2x2_t @@ -14919,7 +14920,7 @@ vld2_lane_f32 (const float32_t * __ptr, float32x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x1x2_t @@ -14927,7 +14928,7 @@ vld2_lane_f64 (const float64_t * __ptr, float64x1x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanedf ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x8x2_t @@ -14935,7 +14936,7 @@ vld2_lane_p8 (const poly8_t * __ptr, poly8x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x4x2_t @@ -14943,7 +14944,7 @@ vld2_lane_p16 (const poly16_t * __ptr, poly16x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x1x2_t @@ -14951,7 +14952,7 @@ vld2_lane_p64 (const poly64_t * __ptr, poly64x1x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanedi_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vld2q_lane */ @@ -14961,7 +14962,7 @@ vld2q_lane_u8 (const uint8_t * __ptr, uint8x16x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev16qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x8x2_t @@ -14969,7 +14970,7 @@ vld2q_lane_u16 (const uint16_t * __ptr, uint16x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x4x2_t @@ -14977,7 +14978,7 @@ vld2q_lane_u32 (const uint32_t * __ptr, uint32x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x2x2_t @@ -14985,7 +14986,7 @@ vld2q_lane_u64 (const uint64_t * __ptr, uint64x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2di_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x16x2_t @@ -14993,7 +14994,7 @@ vld2q_lane_s8 (const int8_t * __ptr, int8x16x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev16qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x8x2_t @@ -15001,7 +15002,7 @@ vld2q_lane_s16 (const int16_t * __ptr, int16x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x4x2_t @@ -15009,7 +15010,7 @@ vld2q_lane_s32 (const int32_t * __ptr, int32x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x2x2_t @@ -15017,7 +15018,7 @@ vld2q_lane_s64 (const int64_t * __ptr, int64x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2di ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x8x2_t @@ -15025,7 +15026,7 @@ vld2q_lane_f16 (const float16_t * __ptr, float16x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x4x2_t @@ -15033,7 +15034,7 @@ vld2q_lane_f32 (const float32_t * __ptr, float32x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x2x2_t @@ -15041,7 +15042,7 @@ vld2q_lane_f64 (const float64_t * __ptr, float64x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2df ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x16x2_t @@ -15049,7 +15050,7 @@ vld2q_lane_p8 (const poly8_t * __ptr, poly8x16x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev16qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x8x2_t @@ -15057,7 +15058,7 @@ vld2q_lane_p16 (const poly16_t * __ptr, poly16x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x2x2_t @@ -15065,7 +15066,7 @@ vld2q_lane_p64 (const poly64_t * __ptr, poly64x2x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev2di_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vld3_lane */ @@ -15075,7 +15076,7 @@ vld3_lane_u8 (const uint8_t * __ptr, uint8x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x4x3_t @@ -15083,7 +15084,7 @@ vld3_lane_u16 (const uint16_t * __ptr, uint16x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x2x3_t @@ -15091,7 +15092,7 @@ vld3_lane_u32 (const uint32_t * __ptr, uint32x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x1x3_t @@ -15099,7 +15100,7 @@ vld3_lane_u64 (const uint64_t * __ptr, uint64x1x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanedi_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x8x3_t @@ -15107,7 +15108,7 @@ vld3_lane_s8 (const int8_t * __ptr, int8x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x4x3_t @@ -15115,7 +15116,7 @@ vld3_lane_s16 (const int16_t * __ptr, int16x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x2x3_t @@ -15123,7 +15124,7 @@ vld3_lane_s32 (const int32_t * __ptr, int32x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x1x3_t @@ -15131,7 +15132,7 @@ vld3_lane_s64 (const int64_t * __ptr, int64x1x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanedi ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x4x3_t @@ -15139,7 +15140,7 @@ vld3_lane_f16 (const float16_t * __ptr, float16x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x2x3_t @@ -15147,7 +15148,7 @@ vld3_lane_f32 (const float32_t * __ptr, float32x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x1x3_t @@ -15155,7 +15156,7 @@ vld3_lane_f64 (const float64_t * __ptr, float64x1x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanedf ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x8x3_t @@ -15163,7 +15164,7 @@ vld3_lane_p8 (const poly8_t * __ptr, poly8x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x4x3_t @@ -15171,7 +15172,7 @@ vld3_lane_p16 (const poly16_t * __ptr, poly16x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x1x3_t @@ -15179,7 +15180,7 @@ vld3_lane_p64 (const poly64_t * __ptr, poly64x1x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanedi_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vld3q_lane */ @@ -15189,7 +15190,7 @@ vld3q_lane_u8 (const uint8_t * __ptr, uint8x16x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev16qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x8x3_t @@ -15197,7 +15198,7 @@ vld3q_lane_u16 (const uint16_t * __ptr, uint16x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x4x3_t @@ -15205,7 +15206,7 @@ vld3q_lane_u32 (const uint32_t * __ptr, uint32x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x2x3_t @@ -15213,7 +15214,7 @@ vld3q_lane_u64 (const uint64_t * __ptr, uint64x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2di_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x16x3_t @@ -15221,7 +15222,7 @@ vld3q_lane_s8 (const int8_t * __ptr, int8x16x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev16qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x8x3_t @@ -15229,7 +15230,7 @@ vld3q_lane_s16 (const int16_t * __ptr, int16x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x4x3_t @@ -15237,7 +15238,7 @@ vld3q_lane_s32 (const int32_t * __ptr, int32x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x2x3_t @@ -15245,7 +15246,7 @@ vld3q_lane_s64 (const int64_t * __ptr, int64x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2di ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x8x3_t @@ -15253,7 +15254,7 @@ vld3q_lane_f16 (const float16_t * __ptr, float16x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x4x3_t @@ -15261,7 +15262,7 @@ vld3q_lane_f32 (const float32_t * __ptr, float32x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x2x3_t @@ -15269,7 +15270,7 @@ vld3q_lane_f64 (const float64_t * __ptr, float64x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2df ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x16x3_t @@ -15277,7 +15278,7 @@ vld3q_lane_p8 (const poly8_t * __ptr, poly8x16x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev16qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x8x3_t @@ -15285,7 +15286,7 @@ vld3q_lane_p16 (const poly16_t * __ptr, poly16x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x2x3_t @@ -15293,7 +15294,7 @@ vld3q_lane_p64 (const poly64_t * __ptr, poly64x2x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev2di_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vld4_lane */ @@ -15303,7 +15304,7 @@ vld4_lane_u8 (const uint8_t * __ptr, uint8x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x4x4_t @@ -15311,7 +15312,7 @@ vld4_lane_u16 (const uint16_t * __ptr, uint16x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x2x4_t @@ -15319,7 +15320,7 @@ vld4_lane_u32 (const uint32_t * __ptr, uint32x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x1x4_t @@ -15327,7 +15328,7 @@ vld4_lane_u64 (const uint64_t * __ptr, uint64x1x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanedi_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x8x4_t @@ -15335,7 +15336,7 @@ vld4_lane_s8 (const int8_t * __ptr, int8x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x4x4_t @@ -15343,7 +15344,7 @@ vld4_lane_s16 (const int16_t * __ptr, int16x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x2x4_t @@ -15351,7 +15352,7 @@ vld4_lane_s32 (const int32_t * __ptr, int32x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x1x4_t @@ -15359,7 +15360,7 @@ vld4_lane_s64 (const int64_t * __ptr, int64x1x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanedi ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x4x4_t @@ -15367,7 +15368,7 @@ vld4_lane_f16 (const float16_t * __ptr, float16x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x2x4_t @@ -15375,7 +15376,7 @@ vld4_lane_f32 (const float32_t * __ptr, float32x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x1x4_t @@ -15383,7 +15384,7 @@ vld4_lane_f64 (const float64_t * __ptr, float64x1x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanedf ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x8x4_t @@ -15391,7 +15392,7 @@ vld4_lane_p8 (const poly8_t * __ptr, poly8x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x4x4_t @@ -15399,7 +15400,7 @@ vld4_lane_p16 (const poly16_t * __ptr, poly16x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x1x4_t @@ -15407,7 +15408,7 @@ vld4_lane_p64 (const poly64_t * __ptr, poly64x1x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanedi_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vld4q_lane */ @@ -15417,7 +15418,7 @@ vld4q_lane_u8 (const uint8_t * __ptr, uint8x16x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev16qi_usus ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline uint16x8x4_t @@ -15425,7 +15426,7 @@ vld4q_lane_u16 (const uint16_t * __ptr, uint16x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8hi_usus ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline uint32x4x4_t @@ -15433,7 +15434,7 @@ vld4q_lane_u32 (const uint32_t * __ptr, uint32x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4si_usus ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline uint64x2x4_t @@ -15441,7 +15442,7 @@ vld4q_lane_u64 (const uint64_t * __ptr, uint64x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2di_usus ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline int8x16x4_t @@ -15449,7 +15450,7 @@ vld4q_lane_s8 (const int8_t * __ptr, int8x16x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev16qi ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline int16x8x4_t @@ -15457,7 +15458,7 @@ vld4q_lane_s16 (const int16_t * __ptr, int16x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8hi ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline int32x4x4_t @@ -15465,7 +15466,7 @@ vld4q_lane_s32 (const int32_t * __ptr, int32x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4si ( - (__builtin_aarch64_simd_si *) __ptr, __b, __c); + (const __builtin_aarch64_simd_si *) __ptr, __b, __c); } __extension__ extern __inline int64x2x4_t @@ -15473,7 +15474,7 @@ vld4q_lane_s64 (const int64_t * __ptr, int64x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2di ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } __extension__ extern __inline float16x8x4_t @@ -15481,7 +15482,7 @@ vld4q_lane_f16 (const float16_t * __ptr, float16x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8hf ( - (__builtin_aarch64_simd_hf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hf *) __ptr, __b, __c); } __extension__ extern __inline float32x4x4_t @@ -15489,7 +15490,7 @@ vld4q_lane_f32 (const float32_t * __ptr, float32x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4sf ( - (__builtin_aarch64_simd_sf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_sf *) __ptr, __b, __c); } __extension__ extern __inline float64x2x4_t @@ -15497,7 +15498,7 @@ vld4q_lane_f64 (const float64_t * __ptr, float64x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2df ( - (__builtin_aarch64_simd_df *) __ptr, __b, __c); + (const __builtin_aarch64_simd_df *) __ptr, __b, __c); } __extension__ extern __inline poly8x16x4_t @@ -15505,7 +15506,7 @@ vld4q_lane_p8 (const poly8_t * __ptr, poly8x16x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev16qi_psps ( - (__builtin_aarch64_simd_qi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_qi *) __ptr, __b, __c); } __extension__ extern __inline poly16x8x4_t @@ -15513,7 +15514,7 @@ vld4q_lane_p16 (const poly16_t * __ptr, poly16x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8hi_psps ( - (__builtin_aarch64_simd_hi *) __ptr, __b, __c); + (const __builtin_aarch64_simd_hi *) __ptr, __b, __c); } __extension__ extern __inline poly64x2x4_t @@ -15521,7 +15522,7 @@ vld4q_lane_p64 (const poly64_t * __ptr, poly64x2x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev2di_psps ( - (__builtin_aarch64_simd_di *) __ptr, __b, __c); + (const __builtin_aarch64_simd_di *) __ptr, __b, __c); } /* vmax */ @@ -24236,140 +24237,140 @@ __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_f16 (float16x4_t __a, float16x4_t __b) { - return (float16x4x2_t) {vtrn1_f16 (__a, __b), vtrn2_f16 (__a, __b)}; + return (float16x4x2_t) {{vtrn1_f16 (__a, __b), vtrn2_f16 (__a, __b)}}; } __extension__ extern __inline float32x2x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_f32 (float32x2_t __a, float32x2_t __b) { - return (float32x2x2_t) {vtrn1_f32 (__a, __b), vtrn2_f32 (__a, __b)}; + return (float32x2x2_t) {{vtrn1_f32 (__a, __b), vtrn2_f32 (__a, __b)}}; } __extension__ extern __inline poly8x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_p8 (poly8x8_t __a, poly8x8_t __b) { - return (poly8x8x2_t) {vtrn1_p8 (__a, __b), vtrn2_p8 (__a, __b)}; + return (poly8x8x2_t) {{vtrn1_p8 (__a, __b), vtrn2_p8 (__a, __b)}}; } __extension__ extern __inline poly16x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_p16 (poly16x4_t __a, poly16x4_t __b) { - return (poly16x4x2_t) {vtrn1_p16 (__a, __b), vtrn2_p16 (__a, __b)}; + return (poly16x4x2_t) {{vtrn1_p16 (__a, __b), vtrn2_p16 (__a, __b)}}; } __extension__ extern __inline int8x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_s8 (int8x8_t __a, int8x8_t __b) { - return (int8x8x2_t) {vtrn1_s8 (__a, __b), vtrn2_s8 (__a, __b)}; + return (int8x8x2_t) {{vtrn1_s8 (__a, __b), vtrn2_s8 (__a, __b)}}; } __extension__ extern __inline int16x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_s16 (int16x4_t __a, int16x4_t __b) { - return (int16x4x2_t) {vtrn1_s16 (__a, __b), vtrn2_s16 (__a, __b)}; + return (int16x4x2_t) {{vtrn1_s16 (__a, __b), vtrn2_s16 (__a, __b)}}; } __extension__ extern __inline int32x2x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_s32 (int32x2_t __a, int32x2_t __b) { - return (int32x2x2_t) {vtrn1_s32 (__a, __b), vtrn2_s32 (__a, __b)}; + return (int32x2x2_t) {{vtrn1_s32 (__a, __b), vtrn2_s32 (__a, __b)}}; } __extension__ extern __inline uint8x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_u8 (uint8x8_t __a, uint8x8_t __b) { - return (uint8x8x2_t) {vtrn1_u8 (__a, __b), vtrn2_u8 (__a, __b)}; + return (uint8x8x2_t) {{vtrn1_u8 (__a, __b), vtrn2_u8 (__a, __b)}}; } __extension__ extern __inline uint16x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_u16 (uint16x4_t __a, uint16x4_t __b) { - return (uint16x4x2_t) {vtrn1_u16 (__a, __b), vtrn2_u16 (__a, __b)}; + return (uint16x4x2_t) {{vtrn1_u16 (__a, __b), vtrn2_u16 (__a, __b)}}; } __extension__ extern __inline uint32x2x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_u32 (uint32x2_t __a, uint32x2_t __b) { - return (uint32x2x2_t) {vtrn1_u32 (__a, __b), vtrn2_u32 (__a, __b)}; + return (uint32x2x2_t) {{vtrn1_u32 (__a, __b), vtrn2_u32 (__a, __b)}}; } __extension__ extern __inline float16x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_f16 (float16x8_t __a, float16x8_t __b) { - return (float16x8x2_t) {vtrn1q_f16 (__a, __b), vtrn2q_f16 (__a, __b)}; + return (float16x8x2_t) {{vtrn1q_f16 (__a, __b), vtrn2q_f16 (__a, __b)}}; } __extension__ extern __inline float32x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_f32 (float32x4_t __a, float32x4_t __b) { - return (float32x4x2_t) {vtrn1q_f32 (__a, __b), vtrn2q_f32 (__a, __b)}; + return (float32x4x2_t) {{vtrn1q_f32 (__a, __b), vtrn2q_f32 (__a, __b)}}; } __extension__ extern __inline poly8x16x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_p8 (poly8x16_t __a, poly8x16_t __b) { - return (poly8x16x2_t) {vtrn1q_p8 (__a, __b), vtrn2q_p8 (__a, __b)}; + return (poly8x16x2_t) {{vtrn1q_p8 (__a, __b), vtrn2q_p8 (__a, __b)}}; } __extension__ extern __inline poly16x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_p16 (poly16x8_t __a, poly16x8_t __b) { - return (poly16x8x2_t) {vtrn1q_p16 (__a, __b), vtrn2q_p16 (__a, __b)}; + return (poly16x8x2_t) {{vtrn1q_p16 (__a, __b), vtrn2q_p16 (__a, __b)}}; } __extension__ extern __inline int8x16x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_s8 (int8x16_t __a, int8x16_t __b) { - return (int8x16x2_t) {vtrn1q_s8 (__a, __b), vtrn2q_s8 (__a, __b)}; + return (int8x16x2_t) {{vtrn1q_s8 (__a, __b), vtrn2q_s8 (__a, __b)}}; } __extension__ extern __inline int16x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_s16 (int16x8_t __a, int16x8_t __b) { - return (int16x8x2_t) {vtrn1q_s16 (__a, __b), vtrn2q_s16 (__a, __b)}; + return (int16x8x2_t) {{vtrn1q_s16 (__a, __b), vtrn2q_s16 (__a, __b)}}; } __extension__ extern __inline int32x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_s32 (int32x4_t __a, int32x4_t __b) { - return (int32x4x2_t) {vtrn1q_s32 (__a, __b), vtrn2q_s32 (__a, __b)}; + return (int32x4x2_t) {{vtrn1q_s32 (__a, __b), vtrn2q_s32 (__a, __b)}}; } __extension__ extern __inline uint8x16x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_u8 (uint8x16_t __a, uint8x16_t __b) { - return (uint8x16x2_t) {vtrn1q_u8 (__a, __b), vtrn2q_u8 (__a, __b)}; + return (uint8x16x2_t) {{vtrn1q_u8 (__a, __b), vtrn2q_u8 (__a, __b)}}; } __extension__ extern __inline uint16x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_u16 (uint16x8_t __a, uint16x8_t __b) { - return (uint16x8x2_t) {vtrn1q_u16 (__a, __b), vtrn2q_u16 (__a, __b)}; + return (uint16x8x2_t) {{vtrn1q_u16 (__a, __b), vtrn2q_u16 (__a, __b)}}; } __extension__ extern __inline uint32x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrnq_u32 (uint32x4_t __a, uint32x4_t __b) { - return (uint32x4x2_t) {vtrn1q_u32 (__a, __b), vtrn2q_u32 (__a, __b)}; + return (uint32x4x2_t) {{vtrn1q_u32 (__a, __b), vtrn2q_u32 (__a, __b)}}; } /* vtst */ @@ -24591,8 +24592,8 @@ __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \ v ## op ## Q ## _ ## funcsuffix (intype a, intype b) \ { \ - return (rettype) {v ## op ## 1 ## Q ## _ ## funcsuffix (a, b), \ - v ## op ## 2 ## Q ## _ ## funcsuffix (a, b)}; \ + return (rettype) {{v ## op ## 1 ## Q ## _ ## funcsuffix (a, b), \ + v ## op ## 2 ## Q ## _ ## funcsuffix (a, b)}}; \ } #define __INTERLEAVE_LIST(op) \ @@ -28576,7 +28577,7 @@ vld2_lane_bf16 (const bfloat16_t * __ptr, bfloat16x4x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev4bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline bfloat16x8x2_t @@ -28584,7 +28585,7 @@ vld2q_lane_bf16 (const bfloat16_t * __ptr, bfloat16x8x2_t __b, const int __c) { return __builtin_aarch64_ld2_lanev8bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline bfloat16x4x3_t @@ -28592,7 +28593,7 @@ vld3_lane_bf16 (const bfloat16_t * __ptr, bfloat16x4x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev4bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline bfloat16x8x3_t @@ -28600,7 +28601,7 @@ vld3q_lane_bf16 (const bfloat16_t * __ptr, bfloat16x8x3_t __b, const int __c) { return __builtin_aarch64_ld3_lanev8bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline bfloat16x4x4_t @@ -28608,7 +28609,7 @@ vld4_lane_bf16 (const bfloat16_t * __ptr, bfloat16x4x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev4bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline bfloat16x8x4_t @@ -28616,7 +28617,7 @@ vld4q_lane_bf16 (const bfloat16_t * __ptr, bfloat16x8x4_t __b, const int __c) { return __builtin_aarch64_ld4_lanev8bf ( - (__builtin_aarch64_simd_bf *) __ptr, __b, __c); + (const __builtin_aarch64_simd_bf *) __ptr, __b, __c); } __extension__ extern __inline void @@ -28773,6 +28774,7 @@ return __builtin_aarch64_simd_usmmlav16qi_ssus (__r, __a, __b); } +#pragma GCC diagnostics pop #pragma GCC pop_options __extension__ extern __inline poly8x8_t diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/driver-aarch64.cc dist/gcc/config/aarch64/driver-aarch64.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/driver-aarch64.cc 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/driver-aarch64.cc 2025-11-14 01:50:21 @@ -27,6 +27,7 @@ #include "tm.h" #include "aarch64-protos.h" #include "aarch64-feature-deps.h" +#include "diagnostic-core.h" struct aarch64_arch_extension { @@ -259,6 +260,14 @@ ARGC and ARGV are set depending on the actual arguments given in the spec. */ +#ifdef __NetBSD__ +/* The NetBSD/arm64 platform may not export linux-style /proc/cpuinfo, + but the data is available via a sysctl(3) interface. */ +#include +#include +#include +#endif + const char * host_detect_local_cpu (int argc, const char **argv) { @@ -298,6 +307,7 @@ if (!arch && !tune && !cpu) goto not_found; +#ifndef __NetBSD__ fcpu_info = getenv ("GCC_CPUINFO"); if (fcpu_info) f = fopen (fcpu_info, "r"); @@ -393,6 +403,145 @@ fclose (f); f = NULL; +#else + unsigned int curcpu; + size_t len; + char impl_buf[8]; + int mib[2], ncpu; + + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + len = sizeof(ncpu); + if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1) + goto not_found; + + for (curcpu = 0; curcpu < ncpu; curcpu++) + { + char path[128]; + struct aarch64_sysctl_cpu_id id; + + len = sizeof id; + snprintf(path, sizeof path, "machdep.cpu%d.cpu_id", curcpu); + if (sysctlbyname(path, &id, &len, NULL, 0) != 0) + goto not_found; + + unsigned cimp = __SHIFTOUT(id.ac_midr, MIDR_EL1_IMPL); + if (cimp == INVALID_IMP) + goto not_found; + + if (imp == INVALID_IMP) + imp = cimp; + /* FIXME: BIG.little implementers are always equal. */ + else if (imp != cimp) + goto not_found; + + unsigned cvariant = __SHIFTOUT(id.ac_midr, MIDR_EL1_VARIANT); + if (!contains_core_p (variants, cvariant)) + { + if (n_variants == 2) + goto not_found; + + variants[n_variants++] = cvariant; + } + + unsigned ccore = __SHIFTOUT(id.ac_midr, MIDR_EL1_PARTNUM); + if (!contains_core_p (cores, ccore)) + { + if (n_cores == 2) + goto not_found; + + cores[n_cores++] = ccore; + } + + if (!tune && !processed_exts) + { + std::string exts; + + /* These are all the extensions from aarch64-option-extensions.def. */ + if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_FP) == ID_AA64PFR0_EL1_FP_IMPL) + exts += "fp "; + if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_ADVSIMD) == ID_AA64PFR0_EL1_ADV_SIMD_IMPL) + exts += "asimd "; +#ifdef ID_AA64ISAR0_EL1_RDM + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_RDM) == ID_AA64ISAR0_EL1_RDM_SQRDML) + exts += "asimdrdm "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_DP) == ID_AA64ISAR0_EL1_DP_UDOT) + exts += "asimddp "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_FHM) == ID_AA64ISAR0_EL1_FHM_FMLAL) + exts += "asimdfml "; +#endif + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_AES) + exts += "aes "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_PMUL) + exts += "aes pmull "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_CRC32) == ID_AA64ISAR0_EL1_CRC32_CRC32X) + exts += "crc32 "; +#ifdef ID_AA64ISAR0_EL1_ATOMIC + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_ATOMIC) == ID_AA64ISAR0_EL1_ATOMIC_SWP) + exts += "atomics "; +#endif + if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA1) & ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU) != 0) + exts += "sha1 "; + if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA256HSU) != 0) + exts += "sha2 "; +#ifdef ID_AA64ISAR0_EL1_SHA2_SHA512HSU + if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA512HSU) != 0) + exts += "sha512 "; + if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA3) & ID_AA64ISAR0_EL1_SHA3_EOR3) != 0) + exts += "sha3 "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM3) == ID_AA64ISAR0_EL1_SM3_SM3) + exts += "sm3 "; + if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM4) == ID_AA64ISAR0_EL1_SM4_SM4) + exts += "sm4 "; + if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_SVE) == ID_AA64PFR0_EL1_SVE_IMPL) + exts += "sve "; + if (__SHIFTOUT(id.ac_aa64isar1, ID_AA64ISAR1_EL1_LRCPC) == ID_AA64ISAR1_EL1_LRCPC_PR) + exts += "lrcpc "; +#endif + + for (i = 0; i < num_exts; i++) + { + const char *p = aarch64_extensions[i].feat_string; + + /* If the feature contains no HWCAPS string then ignore it for the + auto detection. */ + if (*p == '\0') + continue; + + bool enabled = true; + + /* This may be a multi-token feature string. We need + to match all parts, which could be in any order. */ + size_t len = strlen (exts.c_str()); + do + { + const char *end = strchr (p, ' '); + if (end == NULL) + end = strchr (p, '\0'); + if (memmem (exts.c_str(), len, p, end - p) == NULL) + { + /* Failed to match this token. Turn off the + features we'd otherwise enable. */ + enabled = false; + break; + } + if (*end == '\0') + break; + p = end + 1; + } + while (1); + + if (enabled) + extension_flags |= aarch64_extensions[i].flag; + else + extension_flags &= ~(aarch64_extensions[i].flag); + } + + processed_exts = true; + } + } + /* End of NetBSD specific section. */ +#endif /* Weird cpuinfo format that we don't know how to handle. */ if (n_cores == 0 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/t-aarch64 dist/gcc/config/aarch64/t-aarch64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/aarch64/t-aarch64 2025-05-23 13:02:04 +++ dist/gcc/config/aarch64/t-aarch64 2025-11-14 01:50:21 @@ -30,6 +30,8 @@ $(srcdir)/config/aarch64/aarch64-tune.md: s-aarch64-tune-md; @true s-aarch64-tune-md: $(srcdir)/config/aarch64/gentune.sh \ $(srcdir)/config/aarch64/aarch64-cores.def + @echo "NOT REBUILDING $@" +NetBSD_DISABLED_aarch64-tune.md: $(SHELL) $(srcdir)/config/aarch64/gentune.sh \ $(srcdir)/config/aarch64/aarch64-cores.def > \ tmp-aarch64-tune.md diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/alpha.h dist/gcc/config/alpha/alpha.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/alpha.h 2025-05-23 13:02:04 +++ dist/gcc/config/alpha/alpha.h 2025-11-14 01:50:21 @@ -919,6 +919,12 @@ #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \ alpha_output_filename (STREAM, NAME) +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ + ( fputs (".comm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (int)(ROUNDED))) + + /* By default, turn on GDB extensions. */ #define DEFAULT_GDB_EXTENSIONS 1 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/elf.h dist/gcc/config/alpha/elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/alpha/elf.h 2025-11-14 01:50:21 @@ -18,6 +18,27 @@ along with GCC; see the file COPYING3. If not see . */ +#undef OBJECT_FORMAT_COFF +#undef EXTENDED_COFF +#define OBJECT_FORMAT_ELF + +#undef DBX_DEBUGGING_INFO + +#define DWARF2_DEBUGGING_INFO 1 + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +#undef ASM_FINAL_SPEC + +/* alpha/ doesn't use elfos.h for some reason. */ +#define TARGET_OBJFMT_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__ELF__"); \ + } \ + while (0) + #undef CC1_SPEC #define CC1_SPEC "%{G*}" @@ -141,6 +162,6 @@ As of Jan 2002, only glibc 2.2.4 can actually make use of this, but I imagine that other systems will catch up. In the meantime, it doesn't harm to make sure that the data exists to be used later. */ -#if defined(HAVE_LD_EH_FRAME_HDR) +#if defined(HAVE_LD_EH_FRAME_HDR) && !defined(LINK_EH_SPEC) #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/netbsd.h dist/gcc/config/alpha/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/alpha/netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/alpha/netbsd.h 2025-11-14 01:50:21 @@ -41,12 +41,9 @@ #define CPP_SPEC NETBSD_CPP_SPEC #undef EXTRA_SPECS -#define EXTRA_SPECS \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, \ - { "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC }, +#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS +#undef SUBTARGET_EXTRA_SPECS - /* Provide a LINK_SPEC appropriate for a NetBSD/alpha ELF target. */ #undef LINK_SPEC @@ -57,6 +54,15 @@ #define NETBSD_ENTRY_POINT "__start" +/* Provide a STARTFILE_SPEC appropriate for NetBSD. Here we add the + (even more) magical crtbegin.o file which provides part of the + support for getting C++ file-scope static object constructed + before entering `main'. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared: %{pg|p:gcrt0.o%s;:crt0.o%s}}\ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" /* Provide an ENDFILE_SPEC appropriate for NetBSD/alpha ELF. Here we add crtend.o, which provides part of the support for getting diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/arm.h dist/gcc/config/arm/arm.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/arm.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/arm.h 2025-11-14 01:50:21 @@ -951,6 +951,11 @@ #define ARM_UNWIND_INFO 0 #endif +/* Overriden by config/arm/netbsd-eabi.h. */ +#ifndef ARM_DWARF_UNWIND_TABLES +#define ARM_DWARF_UNWIND_TABLES 0 +#endif + /* Use r0 and r1 to pass exception handling information. */ #define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM) @@ -962,11 +967,19 @@ #define ARM_TARGET2_DWARF_FORMAT DW_EH_PE_pcrel #endif +#if ARM_DWARF_UNWIND_TABLES +/* DWARF unwinding uses the normal indirect/pcrel vs absptr format + for 32bit platforms. */ +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ + (flag_pic ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ + : DW_EH_PE_absptr) +#else /* ttype entries (the only interesting data references used) use TARGET2 relocations. */ #define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \ (((code) == 0 && (data) == 1 && ARM_UNWIND_INFO) ? ARM_TARGET2_DWARF_FORMAT \ : DW_EH_PE_absptr) +#endif /* The native (Norcroft) Pascal compiler for the ARM passes the static chain as an invisible last argument (possible since varargs don't exist in @@ -2494,7 +2507,7 @@ /* -mcpu=native handling only makes sense with compiler running on an ARM chip. */ -#if defined(__arm__) +#if defined(__arm__) && defined(__linux__) extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT # define MCPU_MTUNE_NATIVE_FUNCTIONS \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/arm_neon.h dist/gcc/config/arm/arm_neon.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/arm_neon.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/arm_neon.h 2025-11-14 01:50:21 @@ -18268,12 +18268,12 @@ vldrq_p128 (poly128_t const * __ptr) { #ifdef __ARM_BIG_ENDIAN - poly64_t* __ptmp = (poly64_t*) __ptr; + poly64_t const * __ptmp = (poly64_t const *) __ptr; poly64_t __d0 = vld1_p64 (__ptmp); poly64_t __d1 = vld1_p64 (__ptmp + 1); return vreinterpretq_p128_p64 (vcombine_p64 (__d1, __d0)); #else - return vreinterpretq_p128_p64 (vld1q_p64 ((poly64_t*) __ptr)); + return vreinterpretq_p128_p64 (vld1q_p64 ((poly64_t const *) __ptr)); #endif } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/bpabi-netbsd.c dist/gcc/config/arm/bpabi-netbsd.c --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/bpabi-netbsd.c 1970-01-01 01:00:00 +++ dist/gcc/config/arm/bpabi-netbsd.c 2025-11-14 01:50:21 @@ -0,0 +1 @@ +#include "bpabi.c" diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/bpabi.h dist/gcc/config/arm/bpabi.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/bpabi.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/bpabi.h 2025-11-14 01:50:21 @@ -24,6 +24,7 @@ . */ /* Use the AAPCS ABI by default. */ +#undef ARM_DEFAULT_ABI #define ARM_DEFAULT_ABI ARM_ABI_AAPCS /* Assume that AAPCS ABIs should adhere to the full BPABI. */ @@ -107,7 +108,9 @@ /* The BPABI specifies the use of .{init,fini}_array. Therefore, we do not want GCC to put anything into the .{init,fini} sections. */ #undef INIT_SECTION_ASM_OP +#define INIT_SECTION_ASM_OP "" #undef FINI_SECTION_ASM_OP +#define FINI_SECTION_ASM_OP "" #define INIT_ARRAY_SECTION_ASM_OP ARM_EABI_CTORS_SECTION_OP #define FINI_ARRAY_SECTION_ASM_OP ARM_EABI_DTORS_SECTION_OP diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/elf.h dist/gcc/config/arm/elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/elf.h 2025-11-14 01:50:21 @@ -157,6 +157,8 @@ #undef L_floatdidf #undef L_floatdisf #undef L_floatundidf +/* XXXMRG: don't take this out, we need it! */ +# ifndef __NetBSD__ #undef L_floatundisf +# endif #endif - diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/netbsd-eabi.h dist/gcc/config/arm/netbsd-eabi.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/netbsd-eabi.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/netbsd-eabi.h 2025-11-14 01:50:21 @@ -49,8 +49,8 @@ #undef ARM_UNWIND_INFO #define ARM_UNWIND_INFO 0 -#undef DWARF2_UNWIND_INFO -#define DWARF2_UNWIND_INFO 1 +#undef ARM_DWARF_UNWIND_TABLES +#define ARM_DWARF_UNWIND_TABLES 1 #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ @@ -59,7 +59,7 @@ if (TARGET_AAPCS_BASED) \ TARGET_BPABI_CPP_BUILTINS(); \ NETBSD_OS_CPP_BUILTINS_ELF(); \ - if (DWARF2_UNWIND_INFO) \ + if (ARM_DWARF_UNWIND_TABLES) \ builtin_define ("__ARM_DWARF_EH__"); \ } \ while (0) @@ -81,17 +81,25 @@ #undef SUBTARGET_EXTRA_ASM_SPEC #define SUBTARGET_EXTRA_ASM_SPEC \ - "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} " \ + "-matpcs %{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} " \ "%{fpic|fpie:-k} " \ "%{fPIC|fPIE:-k}" +/* Default to full VFP if -mhard-float is specified. */ +#undef SUBTARGET_ASM_FLOAT_SPEC +#define SUBTARGET_ASM_FLOAT_SPEC \ + "%{mhard-float:%{!mfpu=*:-mfpu=vfp}} \ + %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}" + #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ + { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ { "linker_eabi_suffix", TARGET_LINKER_EABI_SUFFIX }, \ { "linker_emulation", TARGET_LINKER_EMULATION }, \ { "linker_big_emulation", TARGET_LINKER_BIG_EMULATION }, \ { "linker_little_emulation", TARGET_LINKER_LITTLE_EMULATION }, \ + { "be8_link_spec", BE8_LINK_SPEC }, \ { "target_fix_v4bx_spec", TARGET_FIX_V4BX_SPEC }, \ NETBSD_SUBTARGET_EXTRA_SPECS @@ -102,4 +110,5 @@ "-X %{mbig-endian:-EB -m %(linker_big_emulation)} " \ "%{mlittle-endian:-EL -m %(linker_liitle_emulation)} " \ "%{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} " \ + "%(be8_link_spec) " \ "%(target_fix_v4bx_spec) %(netbsd_link_spec)" diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/netbsd-elf.h dist/gcc/config/arm/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/arm/netbsd-elf.h 2025-11-14 01:50:21 @@ -27,9 +27,20 @@ /* arm.h defaults to ARM6 CPU. */ -/* This defaults us to little-endian. */ -#ifndef TARGET_ENDIAN_DEFAULT -#define TARGET_ENDIAN_DEFAULT 0 +/* Default EABI to armv5t so that thumb shared libraries work. + The ARM926EH-S core is the default for armv5te, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + +#define SUBTARGET_CPU_DEFAULT \ + (ARM_DEFAULT_ABI != ARM_ABI_APCS && ARM_DEFAULT_ABI != ARM_ABI_ATPCS \ + ? TARGET_CPU_arm926ejs : TARGET_CPU_arm6) + +/* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ +#if TARGET_BIG_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END +#else +#define TARGET_ENDIAN_DEFAULT 0 #endif #undef MULTILIB_DEFAULTS @@ -56,25 +67,28 @@ #undef SUBTARGET_EXTRA_ASM_SPEC #define SUBTARGET_EXTRA_ASM_SPEC \ + "-matpcs %{mabi=aapcs*:-meabi=5} " \ "%{" FPIE_OR_FPIC_SPEC ":-k}" +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ + { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ + NETBSD_SUBTARGET_EXTRA_SPECS + /* Default to full VFP if -mfloat-abi=hard is specified. */ #undef SUBTARGET_ASM_FLOAT_SPEC -#define SUBTARGET_ASM_FLOAT_SPEC \ - "%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}" +#define SUBTARGET_ASM_FLOAT_SPEC \ + "%{mhard-float:%{!mfpu=*:-mfpu=vfp}} \ + %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}" -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ - { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, - #define NETBSD_ENTRY_POINT "__start" #undef LINK_SPEC #define LINK_SPEC \ - "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \ + "-X \ + %{mbig-endian:-EB %{-mabi=aapcs*:-m armelfb_nbsd_eabi}} \ + %{mlittle-endian:-EL %{-mabi=aapcs*:-m armelf_nbsd_eabi}} \ %(netbsd_link_spec)" /* Make GCC agree with . */ @@ -84,6 +98,12 @@ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" + +#undef INTPTR_TYPE +#define INTPTR_TYPE PTRDIFF_TYPE + +#undef UINTPTR_TYPE +#define UINTPTR_TYPE SIZE_TYPE /* NetBSD does its profiling differently to the Acorn compiler. We don't need a word following the mcount call; and to skip it diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/t-netbsdeabi dist/gcc/config/arm/t-netbsdeabi --- /Users/io/Downloads/gcc-14.3.0/gcc/config/arm/t-netbsdeabi 1970-01-01 01:00:00 +++ dist/gcc/config/arm/t-netbsdeabi 2025-11-14 01:50:21 @@ -0,0 +1,8 @@ +# NetBSD has (will have) "non-native" libraries in /usr/lib/. + +MULTILIB_OPTIONS = mabi=aapcs-linux/mabi=apcs-gnu +MULTILIB_DIRNAMES = eabi oabi +MULTILIB_OSDIRNAMES = . ../lib/oabi + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/host-darwin.cc dist/gcc/config/host-darwin.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/host-darwin.cc 2025-05-23 13:02:04 +++ dist/gcc/config/host-darwin.cc 2025-11-14 01:50:21 @@ -23,6 +23,8 @@ #include "options.h" #include "diagnostic-core.h" #include "config/host-darwin.h" +#include "hosthooks.h" +#include "hosthooks-def.h" #include /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the @@ -181,3 +183,5 @@ return 1; } + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/host-netbsd.cc dist/gcc/config/host-netbsd.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/host-netbsd.cc 2025-05-23 13:02:04 +++ dist/gcc/config/host-netbsd.cc 2025-11-14 01:50:21 @@ -78,7 +78,21 @@ addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, offset); - return addr == base ? 1 : -1; + if (addr == base) + return 1; + + if (addr != (void *) MAP_FAILED) + munmap(addr, size); + + addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + if (addr == (void *) MAP_FAILED) + return -1; + + /* Signal to the caller that whilst memory has been allocated, it + must read the PCH data */ + base = addr; + return 0; } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx2intrin.h dist/gcc/config/i386/avx2intrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx2intrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avx2intrin.h 2025-11-14 01:50:21 @@ -919,7 +919,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_stream_load_si256 (__m256i const *__X) { - return (__m256i) __builtin_ia32_movntdqa256 ((__v4di *) __X); + return (__m256i) __builtin_ia32_movntdqa256 ((__v4di *)(unsigned long)__X); } extern __inline __m128 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512bwintrin.h dist/gcc/config/i386/avx512bwintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512bwintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avx512bwintrin.h 2025-11-14 01:50:21 @@ -388,7 +388,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_epi16 (void const *__P) { - return (__m512i) (*(__v32hi_u *) __P); + return (__m512i) (*(const __v32hi_u *) __P); } extern __inline __m512i @@ -465,7 +465,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_epi8 (void const *__P) { - return (__m512i) (*(__v64qi_u *) __P); + return (__m512i) (*(const __v64qi_u *) __P); } extern __inline __m512i diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512fintrin.h dist/gcc/config/i386/avx512fintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512fintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avx512fintrin.h 2025-11-14 01:50:21 @@ -4163,7 +4163,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_load_pd (void const *__P) { - return *(__m512d *) __P; + return *(const __m512d *) __P; } extern __inline __m512d @@ -4204,7 +4204,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_load_ps (void const *__P) { - return *(__m512 *) __P; + return *(const __m512 *) __P; } extern __inline __m512 @@ -4264,7 +4264,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_load_epi64 (void const *__P) { - return *(__m512i *) __P; + return *(const __m512i *) __P; } extern __inline __m512i @@ -4324,14 +4324,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_load_si512 (void const *__P) { - return *(__m512i *) __P; + return *(const __m512i *) __P; } extern __inline __m512i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_load_epi32 (void const *__P) { - return *(__m512i *) __P; + return *(const __m512i *) __P; } extern __inline __m512i @@ -9332,7 +9332,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_pd (void const *__P) { - return *(__m512d_u *)__P; + return *(const __m512d_u *)__P; } extern __inline __m512d @@ -9373,7 +9373,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_ps (void const *__P) { - return *(__m512_u *)__P; + return *(const __m512_u *)__P; } extern __inline __m512 @@ -9414,7 +9414,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_epi64 (void const *__P) { - return *(__m512i_u *) __P; + return *(const __m512i_u *) __P; } extern __inline __m512i @@ -9455,14 +9455,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_si512 (void const *__P) { - return *(__m512i_u *)__P; + return *(const __m512i_u *)__P; } extern __inline __m512i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_loadu_epi32 (void const *__P) { - return *(__m512i_u *) __P; + return *(const __m512i_u *) __P; } extern __inline __m512i diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512vlbwintrin.h dist/gcc/config/i386/avx512vlbwintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512vlbwintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avx512vlbwintrin.h 2025-11-14 01:50:21 @@ -368,7 +368,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_epi16 (void const *__P) { - return (__m256i) (*(__v16hi_u *) __P); + return (__m256i) (*(const __v16hi_u *) __P); } extern __inline __m256i @@ -394,7 +394,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_epi16 (void const *__P) { - return (__m128i) (*(__v8hi_u *) __P); + return (__m128i) (*(const __v8hi_u *) __P); } extern __inline __m128i @@ -459,7 +459,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_epi8 (void const *__P) { - return (__m256i) (*(__v32qi_u *) __P); + return (__m256i) (*(const __v32qi_u *) __P); } extern __inline __m256i @@ -485,7 +485,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_epi8 (void const *__P) { - return (__m128i) (*(__v16qi_u *) __P); + return (__m128i) (*(const __v16qi_u *) __P); } extern __inline __m128i diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512vlintrin.h dist/gcc/config/i386/avx512vlintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avx512vlintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avx512vlintrin.h 2025-11-14 01:50:21 @@ -152,7 +152,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_load_pd (__m256d __W, __mmask8 __U, void const *__P) { - return (__m256d) __builtin_ia32_loadapd256_mask ((__v4df *) __P, + return (__m256d) __builtin_ia32_loadapd256_mask ((const __v4df *) __P, (__v4df) __W, (__mmask8) __U); } @@ -161,7 +161,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_load_pd (__mmask8 __U, void const *__P) { - return (__m256d) __builtin_ia32_loadapd256_mask ((__v4df *) __P, + return (__m256d) __builtin_ia32_loadapd256_mask ((const __v4df *) __P, (__v4df) _mm256_avx512_setzero_pd (), (__mmask8) __U); @@ -171,7 +171,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_load_pd (__m128d __W, __mmask8 __U, void const *__P) { - return (__m128d) __builtin_ia32_loadapd128_mask ((__v2df *) __P, + return (__m128d) __builtin_ia32_loadapd128_mask ((const __v2df *) __P, (__v2df) __W, (__mmask8) __U); } @@ -180,7 +180,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_load_pd (__mmask8 __U, void const *__P) { - return (__m128d) __builtin_ia32_loadapd128_mask ((__v2df *) __P, + return (__m128d) __builtin_ia32_loadapd128_mask ((const __v2df *) __P, (__v2df) _mm_avx512_setzero_pd (), (__mmask8) __U); @@ -246,7 +246,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_load_ps (__m256 __W, __mmask8 __U, void const *__P) { - return (__m256) __builtin_ia32_loadaps256_mask ((__v8sf *) __P, + return (__m256) __builtin_ia32_loadaps256_mask ((const __v8sf *) __P, (__v8sf) __W, (__mmask8) __U); } @@ -255,7 +255,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_load_ps (__mmask8 __U, void const *__P) { - return (__m256) __builtin_ia32_loadaps256_mask ((__v8sf *) __P, + return (__m256) __builtin_ia32_loadaps256_mask ((const __v8sf *) __P, (__v8sf) _mm256_avx512_setzero_ps (), (__mmask8) __U); @@ -265,7 +265,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_load_ps (__m128 __W, __mmask8 __U, void const *__P) { - return (__m128) __builtin_ia32_loadaps128_mask ((__v4sf *) __P, + return (__m128) __builtin_ia32_loadaps128_mask ((const __v4sf *) __P, (__v4sf) __W, (__mmask8) __U); } @@ -274,7 +274,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_load_ps (__mmask8 __U, void const *__P) { - return (__m128) __builtin_ia32_loadaps128_mask ((__v4sf *) __P, + return (__m128) __builtin_ia32_loadaps128_mask ((const __v4sf *) __P, (__v4sf) _mm_avx512_setzero_ps (), (__mmask8) __U); @@ -340,14 +340,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_load_epi64 (void const *__P) { - return (__m256i) (*(__v4di *) __P); + return (__m256i) (*(const __v4di *) __P); } extern __inline __m256i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_load_epi64 (__m256i __W, __mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_movdqa64load256_mask ((__v4di *) __P, + return (__m256i) __builtin_ia32_movdqa64load256_mask ((const __v4di *) __P, (__v4di) __W, (__mmask8) __U); @@ -357,7 +357,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_load_epi64 (__mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_movdqa64load256_mask ((__v4di *) __P, + return (__m256i) __builtin_ia32_movdqa64load256_mask ((const __v4di *) __P, (__v4di) _mm256_avx512_setzero_si256 (), (__mmask8) @@ -368,14 +368,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_load_epi64 (void const *__P) { - return (__m128i) (*(__v2di *) __P); + return (__m128i) (*(const __v2di *) __P); } extern __inline __m128i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_load_epi64 (__m128i __W, __mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_movdqa64load128_mask ((__v2di *) __P, + return (__m128i) __builtin_ia32_movdqa64load128_mask ((const __v2di *) __P, (__v2di) __W, (__mmask8) __U); @@ -385,7 +385,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_load_epi64 (__mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_movdqa64load128_mask ((__v2di *) __P, + return (__m128i) __builtin_ia32_movdqa64load128_mask ((const __v2di *) __P, (__v2di) _mm_avx512_setzero_si128 (), (__mmask8) @@ -452,14 +452,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_load_epi32 (void const *__P) { - return (__m256i) (*(__v8si *) __P); + return (__m256i) (*(const __v8si *) __P); } extern __inline __m256i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_load_epi32 (__m256i __W, __mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_movdqa32load256_mask ((__v8si *) __P, + return (__m256i) __builtin_ia32_movdqa32load256_mask ((const __v8si *) __P, (__v8si) __W, (__mmask8) __U); @@ -469,7 +469,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_load_epi32 (__mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_movdqa32load256_mask ((__v8si *) __P, + return (__m256i) __builtin_ia32_movdqa32load256_mask ((const __v8si *) __P, (__v8si) _mm256_avx512_setzero_si256 (), (__mmask8) @@ -480,14 +480,14 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_load_epi32 (void const *__P) { - return (__m128i) (*(__v4si *) __P); + return (__m128i) (*(const __v4si *) __P); } extern __inline __m128i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_load_epi32 (__m128i __W, __mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_movdqa32load128_mask ((__v4si *) __P, + return (__m128i) __builtin_ia32_movdqa32load128_mask ((const __v4si *) __P, (__v4si) __W, (__mmask8) __U); @@ -497,7 +497,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_load_epi32 (__mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_movdqa32load128_mask ((__v4si *) __P, + return (__m128i) __builtin_ia32_movdqa32load128_mask ((const __v4si *) __P, (__v4si) _mm_avx512_setzero_si128 (), (__mmask8) @@ -836,7 +836,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_epi64 (void const *__P) { - return (__m256i) (*(__v4di_u *) __P); + return (__m256i) (*(const __v4di_u *) __P); } extern __inline __m256i @@ -862,7 +862,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_epi64 (void const *__P) { - return (__m128i) (*(__v2di_u *) __P); + return (__m128i) (*(const __v2di_u *) __P); } extern __inline __m128i @@ -920,7 +920,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_epi32 (void const *__P) { - return (__m256i) (*(__v8si_u *) __P); + return (__m256i) (*(const __v8si_u *) __P); } extern __inline __m256i @@ -946,7 +946,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_epi32 (void const *__P) { - return (__m128i) (*(__v4si_u *) __P); + return (__m128i) (*(const __v4si_u *) __P); } extern __inline __m128i @@ -6267,7 +6267,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_expandloadu_pd (__m256d __W, __mmask8 __U, void const *__P) { - return (__m256d) __builtin_ia32_expandloaddf256_mask ((__v4df *) __P, + return (__m256d) __builtin_ia32_expandloaddf256_mask ((const __v4df *) __P, (__v4df) __W, (__mmask8) __U); @@ -6277,7 +6277,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_expandloadu_pd (__mmask8 __U, void const *__P) { - return (__m256d) __builtin_ia32_expandloaddf256_maskz ((__v4df *) __P, + return (__m256d) __builtin_ia32_expandloaddf256_maskz ((const __v4df *) __P, (__v4df) _mm256_avx512_setzero_pd (), (__mmask8) @@ -6307,7 +6307,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_expandloadu_pd (__m128d __W, __mmask8 __U, void const *__P) { - return (__m128d) __builtin_ia32_expandloaddf128_mask ((__v2df *) __P, + return (__m128d) __builtin_ia32_expandloaddf128_mask ((const __v2df *) __P, (__v2df) __W, (__mmask8) __U); @@ -6317,7 +6317,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_expandloadu_pd (__mmask8 __U, void const *__P) { - return (__m128d) __builtin_ia32_expandloaddf128_maskz ((__v2df *) __P, + return (__m128d) __builtin_ia32_expandloaddf128_maskz ((const __v2df *) __P, (__v2df) _mm_avx512_setzero_pd (), (__mmask8) @@ -6347,7 +6347,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_mask_expandloadu_ps (__m256 __W, __mmask8 __U, void const *__P) { - return (__m256) __builtin_ia32_expandloadsf256_mask ((__v8sf *) __P, + return (__m256) __builtin_ia32_expandloadsf256_mask ((const __v8sf *) __P, (__v8sf) __W, (__mmask8) __U); } @@ -6356,7 +6356,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_expandloadu_ps (__mmask8 __U, void const *__P) { - return (__m256) __builtin_ia32_expandloadsf256_maskz ((__v8sf *) __P, + return (__m256) __builtin_ia32_expandloadsf256_maskz ((const __v8sf *) __P, (__v8sf) _mm256_avx512_setzero_ps (), (__mmask8) @@ -6386,7 +6386,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_expandloadu_ps (__m128 __W, __mmask8 __U, void const *__P) { - return (__m128) __builtin_ia32_expandloadsf128_mask ((__v4sf *) __P, + return (__m128) __builtin_ia32_expandloadsf128_mask ((const __v4sf *) __P, (__v4sf) __W, (__mmask8) __U); } @@ -6395,7 +6395,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_expandloadu_ps (__mmask8 __U, void const *__P) { - return (__m128) __builtin_ia32_expandloadsf128_maskz ((__v4sf *) __P, + return (__m128) __builtin_ia32_expandloadsf128_maskz ((const __v4sf *) __P, (__v4sf) _mm_avx512_setzero_ps (), (__mmask8) @@ -6426,7 +6426,7 @@ _mm256_mask_expandloadu_epi64 (__m256i __W, __mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_expandloaddi256_mask ((__v4di *) __P, + return (__m256i) __builtin_ia32_expandloaddi256_mask ((const __v4di *) __P, (__v4di) __W, (__mmask8) __U); @@ -6436,7 +6436,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_expandloaddi256_maskz ((__v4di *) __P, + return (__m256i) __builtin_ia32_expandloaddi256_maskz ((const __v4di *) __P, (__v4di) _mm256_avx512_setzero_si256 (), (__mmask8) @@ -6466,7 +6466,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_expandloadu_epi64 (__m128i __W, __mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_expandloaddi128_mask ((__v2di *) __P, + return (__m128i) __builtin_ia32_expandloaddi128_mask ((const __v2di *) __P, (__v2di) __W, (__mmask8) __U); @@ -6476,7 +6476,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_expandloaddi128_maskz ((__v2di *) __P, + return (__m128i) __builtin_ia32_expandloaddi128_maskz ((const __v2di *) __P, (__v2di) _mm_avx512_setzero_si128 (), (__mmask8) @@ -6507,7 +6507,7 @@ _mm256_mask_expandloadu_epi32 (__m256i __W, __mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_expandloadsi256_mask ((__v8si *) __P, + return (__m256i) __builtin_ia32_expandloadsi256_mask ((const __v8si *) __P, (__v8si) __W, (__mmask8) __U); @@ -6517,7 +6517,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm256_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) { - return (__m256i) __builtin_ia32_expandloadsi256_maskz ((__v8si *) __P, + return (__m256i) __builtin_ia32_expandloadsi256_maskz ((const __v8si *) __P, (__v8si) _mm256_avx512_setzero_si256 (), (__mmask8) @@ -6547,7 +6547,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_mask_expandloadu_epi32 (__m128i __W, __mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_expandloadsi128_mask ((__v4si *) __P, + return (__m128i) __builtin_ia32_expandloadsi128_mask ((const __v4si *) __P, (__v4si) __W, (__mmask8) __U); @@ -6557,7 +6557,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) { - return (__m128i) __builtin_ia32_expandloadsi128_maskz ((__v4si *) __P, + return (__m128i) __builtin_ia32_expandloadsi128_maskz ((const __v4si *) __P, (__v4si) _mm_avx512_setzero_si128 (), (__mmask8) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avxintrin.h dist/gcc/config/i386/avxintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/avxintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/avxintrin.h 2025-11-14 01:50:21 @@ -866,7 +866,7 @@ extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_load_pd (double const *__P) { - return *(__m256d *)__P; + return *(const __m256d *)__P; } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -878,7 +878,7 @@ extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_load_ps (float const *__P) { - return *(__m256 *)__P; + return *(const __m256 *)__P; } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -890,7 +890,7 @@ extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_pd (double const *__P) { - return *(__m256d_u *)__P; + return *(const __m256d_u *)__P; } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -902,7 +902,7 @@ extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_loadu_ps (float const *__P) { - return *(__m256_u *)__P; + return *(const __m256_u *)__P; } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/emmintrin.h dist/gcc/config/i386/emmintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/emmintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/emmintrin.h 2025-11-14 01:50:21 @@ -124,14 +124,14 @@ extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_load_pd (double const *__P) { - return *(__m128d *)__P; + return *(__m128d const *)__P; } /* Load two DPFP values from P. The address need not be 16-byte aligned. */ extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_pd (double const *__P) { - return *(__m128d_u *)__P; + return *(__m128d_u const *)__P; } /* Create a vector with all two elements equal to *P. */ @@ -709,25 +709,25 @@ extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadl_epi64 (__m128i_u const *__P) { - return _mm_set_epi64 ((__m64)0LL, *(__m64_u *)__P); + return _mm_set_epi64 ((__m64)0LL, *(__m64_u const *)__P); } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_si64 (void const *__P) { - return _mm_loadl_epi64 ((__m128i_u *)__P); + return _mm_loadl_epi64 ((__m128i_u const *)__P); } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_si32 (void const *__P) { - return _mm_set_epi32 (0, 0, 0, (*(__m32_u *)__P)[0]); + return _mm_set_epi32 (0, 0, 0, (*(__m32_u const *)__P)[0]); } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_si16 (void const *__P) { - return _mm_set_epi16 (0, 0, 0, 0, 0, 0, 0, (*(__m16_u *)__P)[0]); + return _mm_set_epi16 (0, 0, 0, 0, 0, 0, 0, (*(__m16_u const *)__P)[0]); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/i386.h dist/gcc/config/i386/i386.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/i386.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/i386.h 2025-11-14 01:50:21 @@ -1182,6 +1182,7 @@ #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ (CC_REGNO_P (REGNO) ? VOIDmode \ + : MMX_REGNO_P (REGNO) ? V8QImode \ : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \ : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), NULL) \ : (MODE) == HImode && !((GENERAL_REGNO_P (REGNO) \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/keylockerintrin.h dist/gcc/config/i386/keylockerintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/keylockerintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/keylockerintrin.h 2025-11-14 01:50:21 @@ -99,28 +99,28 @@ unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_aesdecwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) { - return __builtin_ia32_aesdecwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); + return __builtin_ia32_aesdecwide128kl_u8 ((__v2di *) __A, (const __v2di *) __B, __P); } extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_aesdecwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) { - return __builtin_ia32_aesdecwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); + return __builtin_ia32_aesdecwide256kl_u8 ((__v2di *) __A, (const __v2di *) __B, __P); } extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_aesencwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) { - return __builtin_ia32_aesencwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); + return __builtin_ia32_aesencwide128kl_u8 ((__v2di *) __A, (const __v2di *) __B, __P); } extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_aesencwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) { - return __builtin_ia32_aesencwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); + return __builtin_ia32_aesencwide256kl_u8 ((__v2di *) __A, (const __v2di *) __B, __P); } #ifdef __DISABLE_WIDEKL__ #undef __DISABLE_WIDEKL__ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/netbsd-elf.h dist/gcc/config/i386/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/netbsd-elf.h 2025-11-14 01:50:21 @@ -27,14 +27,6 @@ while (0) -/* Extra specs needed for NetBSD/i386 ELF. */ - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, - - /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target. */ #undef LINK_SPEC @@ -49,6 +41,16 @@ #define CPP_SPEC "%(netbsd_cpp_spec)" +/* Provide C11_SPEC/CC1PLUS_SPEC appropriate for NetBSD/i386. */ +#define NETBSD_CC1_CPU_SPEC " %(cc1_cpu) " + +#undef CC1_SPEC +#define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC + + /* Make gcc agree with */ #undef SIZE_TYPE @@ -105,3 +107,14 @@ #define DEFAULT_PCC_STRUCT_RETURN 1 #define HAVE_ENABLE_EXECUTE_STACK + +#define IX86_MAYBE_NO_LIBGCC_TFMODE + +/* Preserve i386 psABI */ +#undef PREFERRED_STACK_BOUNDARY_DEFAULT +#define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY + +/* Define the shadow offsets for asan. */ +#undef SUBTARGET_SHADOW_OFFSET +#define SUBTARGET_SHADOW_OFFSET \ + (TARGET_LP64 ? HOST_WIDE_INT_1 << 46 : HOST_WIDE_INT_1 << 30) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/netbsd64.h dist/gcc/config/i386/netbsd64.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/netbsd64.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/netbsd64.h 2025-11-14 01:50:21 @@ -27,15 +27,6 @@ while (0) -/* Extra specs needed for NetBSD/x86-64 ELF. */ - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, - - /* Provide a LINK_SPEC appropriate for a NetBSD/x86-64 ELF target. */ #undef LINK_SPEC @@ -53,17 +44,37 @@ #define CPP_SPEC "%(netbsd_cpp_spec)" +/* Provide C11_SPEC/CC1PLUS_SPEC appropriate for NetBSD/x86-64. */ +#define NETBSD_CC1_CPU_SPEC " %(cc1_cpu) " + +#undef CC1_SPEC +#define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC NETBSD_CC1_CPU_SPEC + + /* Output assembler code to FILE to call the profiler. */ #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ { \ if (TARGET_64BIT && flag_pic) \ - fprintf (FILE, "\tcall *__mcount@PLT\n"); \ + fprintf (FILE, "\tcall __mcount@PLT\n"); \ else if (flag_pic) \ - fprintf (FILE, "\tcall *__mcount@PLT\n"); \ + fprintf (FILE, "\tcall __mcount@PLT\n"); \ else \ fprintf (FILE, "\tcall __mcount\n"); \ } +/* Preserve i386 psABI */ +#undef PREFERRED_STACK_BOUNDARY_DEFAULT +#define PREFERRED_STACK_BOUNDARY_DEFAULT \ + ((TARGET_64BIT || TARGET_SSE) ? 128 : 32) + #define HAVE_ENABLE_EXECUTE_STACK + +/* Define the shadow offsets for asan. */ +#undef SUBTARGET_SHADOW_OFFSET +#define SUBTARGET_SHADOW_OFFSET \ + (TARGET_LP64 ? HOST_WIDE_INT_1 << 46 : HOST_WIDE_INT_1 << 30) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/pmm_malloc.h dist/gcc/config/i386/pmm_malloc.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/pmm_malloc.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/pmm_malloc.h 2025-11-14 01:50:21 @@ -31,7 +31,7 @@ #ifndef __cplusplus extern int posix_memalign (void **, size_t, size_t); #else -extern "C" int posix_memalign (void **, size_t, size_t) throw (); +extern "C" int posix_memalign (void **, size_t, size_t); #endif static __inline void * diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/t-netbsd64 dist/gcc/config/i386/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/t-netbsd64 1970-01-01 01:00:00 +++ dist/gcc/config/i386/t-netbsd64 2025-11-14 01:50:21 @@ -0,0 +1,15 @@ +# NetBSD has "non-native" libraries in /usr/lib/. +# For NetBSD/amd64 we thus have /usr/lib and /usr/lib/i386. + +MULTILIB_OPTIONS = m64/m32 +MULTILIB_DIRNAMES = 64 32 +MULTILIB_OSDIRNAMES = . ../lib/i386 + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib + +# The pushl in CTOR initialization interferes with frame pointer elimination. +# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables, +# because then __FRAME_END__ might not be the last thing in .eh_frame +# section. +CRTSTUFF_T_CFLAGS += -fno-omit-frame-pointer -fno-asynchronous-unwind-tables diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/xmmintrin.h dist/gcc/config/i386/xmmintrin.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/i386/xmmintrin.h 2025-05-23 13:02:04 +++ dist/gcc/config/i386/xmmintrin.h 2025-11-14 01:50:21 @@ -930,21 +930,21 @@ extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_load_ps (float const *__P) { - return *(__m128 *)__P; + return *(__m128 const *)__P; } /* Load four SPFP values from P. The address need not be 16-byte aligned. */ extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadu_ps (float const *__P) { - return *(__m128_u *)__P; + return *(__m128_u const *)__P; } /* Load four SPFP values in reverse order. The address must be aligned. */ extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_loadr_ps (float const *__P) { - __v4sf __tmp = *(__v4sf *)__P; + __v4sf __tmp = *(__v4sf const *)__P; return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,1,2,3)); } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/ia64/netbsd.h dist/gcc/config/ia64/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/ia64/netbsd.h 1970-01-01 01:00:00 +++ dist/gcc/config/ia64/netbsd.h 2025-11-14 01:50:21 @@ -0,0 +1,49 @@ +/* Definitions of target machine for GNU compiler, + for ia64/ELF NetBSD systems. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + NETBSD_OS_CPP_BUILTINS_ELF(); \ + } \ + while (0) + + +/* Provide a LINK_SPEC appropriate for a NetBSD/ia64 ELF target. */ + +#undef LINK_SPEC +#define LINK_SPEC "%(netbsd_link_spec)" + +#define NETBSD_ENTRY_POINT "_start" + + +/* Provide a CPP_SPEC appropriate for NetBSD. */ + +#undef CPP_SPEC +#define CPP_SPEC "%(netbsd_cpp_spec)" + +#undef TARGET_INIT_LIBFUNCS +#define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs + +#if 0 +/* Attempt to enable execute permissions on the stack. */ +#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK +#endif diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/netbsd-elf.h dist/gcc/config/m68k/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/m68k/netbsd-elf.h 2025-11-14 01:50:21 @@ -35,13 +35,23 @@ } \ while (0) -/* Don't try using XFmode on the 68010. */ +/* Don't try using XFmode on the 68010 or coldfire. */ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_68020 ? 80 : 64) -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, +#undef SUBTARGET_OVERRIDE_OPTIONS +#define SUBTARGET_OVERRIDE_OPTIONS \ + { \ + if (TARGET_COLDFIRE) \ + { \ + target_flags |= MASK_STRICT_ALIGNMENT | MASK_CF_HWDIV; \ + if ((target_flags_explicit & MASK_HARD_FLOAT) == 0) \ + { \ + target_flags &= ~MASK_HARD_FLOAT; \ + m68k_fpu = FPUTYPE_NONE; \ + } \ + } \ + } /* Provide a CPP_SPEC appropriate for NetBSD m68k targets. Currently we @@ -49,7 +59,8 @@ whether or not use of the FPU is allowed. */ #undef CPP_SPEC -#define CPP_SPEC NETBSD_CPP_SPEC +#define CPP_SPEC \ + "%(netbsd_cpp_spec)" /* Provide an ASM_SPEC appropriate for NetBSD m68k ELF targets. We need @@ -57,13 +68,22 @@ #undef ASM_SPEC #define ASM_SPEC \ - "%(asm_cpu_spec) %{" FPIE1_OR_FPIC1_SPEC ":-k} %{" FPIE2_OR_FPIC2_SPEC ":-k -K}" + "%(asm_cpu_spec) \ + %{m68010} %{m68020} %{m68030} %{m68040} %{m68060} \ + %{m5200} %{m5206e} %{m528x} %{m5307} %{m5407} %{mcfv4e} \ + %{" FPIE1_OR_FPIC1_SPEC ":-k} %{" FPIE2_OR_FPIC2_SPEC ":-k -K}" /* Provide a LINK_SPEC appropriate for a NetBSD/m68k ELF target. */ #undef LINK_SPEC #define LINK_SPEC NETBSD_LINK_SPEC_ELF +/* NetBSD/sun2 does not support shlibs, avoid using libgcc_pic. */ +#ifndef ENABLE_SHARED_LIBGCC +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC "-lgcc" +#endif + #define NETBSD_ENTRY_POINT "_start" /* Output assembler code to FILE to increment profiler label # LABELNO @@ -73,7 +93,13 @@ #define FUNCTION_PROFILER(FILE, LABELNO) \ do \ { \ - asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \ + if (TARGET_COLDFIRE) \ + { \ + asm_fprintf (FILE, "\tmovea.l #%LLP%d-.,%Ra1\n", (LABELNO)); \ + asm_fprintf (FILE, "\tlea (-6,%Rpc,%Ra1),%Ra1\n"); \ + } \ + else \ + asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \ if (flag_pic) \ fprintf (FILE, "\tbsr.l __mcount@PLTPC\n"); \ else \ @@ -266,8 +292,8 @@ /* Boundary (in *bits*) on which stack pointer should be aligned. The m68k/SVR4 convention is to keep the stack pointer longword aligned. */ -#undef STACK_BOUNDARY -#define STACK_BOUNDARY 32 +#undef PREFERRED_STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY 32 /* Alignment of field after `int : 0' in a structure. diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/t-m68010-netbsd dist/gcc/config/m68k/t-m68010-netbsd --- /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/t-m68010-netbsd 1970-01-01 01:00:00 +++ dist/gcc/config/m68k/t-m68010-netbsd 2025-11-14 01:50:21 @@ -0,0 +1,4 @@ +# Use unwind-dw2-fde-glibc +LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \ + $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c +LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/t-opts dist/gcc/config/m68k/t-opts --- /Users/io/Downloads/gcc-14.3.0/gcc/config/m68k/t-opts 2025-05-23 13:02:04 +++ dist/gcc/config/m68k/t-opts 2025-11-14 01:50:21 @@ -4,5 +4,7 @@ $(srcdir)/config/m68k/m68k-tables.opt: $(srcdir)/config/m68k/genopt.sh \ $(srcdir)/config/m68k/m68k-devices.def $(srcdir)/config/m68k/m68k-isas.def \ $(srcdir)/config/m68k/m68k-microarchs.def + @echo "NOT REBUILDING $@" +NetBSD_DISABLED_m68k-tables.opt: $(SHELL) $(srcdir)/config/m68k/genopt.sh $(srcdir)/config/m68k > \ $(srcdir)/config/m68k/m68k-tables.opt diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/mips.cc dist/gcc/config/mips/mips.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/mips.cc 2025-05-23 13:02:04 +++ dist/gcc/config/mips/mips.cc 2025-11-14 01:50:21 @@ -9762,7 +9762,7 @@ /* Implement TARGET_ASM_OUTPUT_SOURCE_FILENAME. */ -static void +static void ATTRIBUTE_UNUSED mips_output_filename (FILE *stream, const char *name) { /* If we are emitting DWARF-2, let dwarf2out handle the ".file" @@ -23286,8 +23286,10 @@ #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT mips_trampoline_init +#ifndef MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME #undef TARGET_ASM_OUTPUT_SOURCE_FILENAME #define TARGET_ASM_OUTPUT_SOURCE_FILENAME mips_output_filename +#endif /* MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME */ #undef TARGET_SHIFT_TRUNCATION_MASK #define TARGET_SHIFT_TRUNCATION_MASK mips_shift_truncation_mask diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/netbsd.h dist/gcc/config/mips/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/mips/netbsd.h 2025-11-14 01:50:21 @@ -30,20 +30,61 @@ builtin_define ("__LONG64"); \ \ if (TARGET_ABICALLS) \ - builtin_define ("__ABICALLS__"); \ + builtin_define ("__mips_abicalls"); \ \ - if (mips_abi == ABI_32) \ - builtin_define ("__mips_o32"); \ - else if (mips_abi == ABI_EABI) \ - builtin_define ("__mips_eabi"); \ - else if (mips_abi == ABI_N32) \ + if (mips_abi == ABI_N32) \ + { \ builtin_define ("__mips_n32"); \ + builtin_define ("_ABIN32=2"); \ + builtin_define ("_MIPS_SIM=_ABIN32"); \ + builtin_define ("_MIPS_SZLONG=32"); \ + builtin_define ("_MIPS_SZPTR=32"); \ + } \ else if (mips_abi == ABI_64) \ + { \ builtin_define ("__mips_n64"); \ + builtin_define ("_ABI64=3"); \ + builtin_define ("_MIPS_SIM=_ABI64"); \ + builtin_define ("_MIPS_SZLONG=64"); \ + builtin_define ("_MIPS_SZPTR=64"); \ + } \ else if (mips_abi == ABI_O64) \ + { \ builtin_define ("__mips_o64"); \ + builtin_define ("_ABIO64=4"); \ + builtin_define ("_MIPS_SIM=_ABIO64"); \ + builtin_define ("_MIPS_SZLONG=64"); \ + builtin_define ("_MIPS_SZPTR=64"); \ } \ - while (0) + else if (mips_abi == ABI_EABI) \ + { \ + builtin_define ("__mips_eabi"); \ + builtin_define ("_ABIEMB=5"); \ + builtin_define ("_MIPS_SIM=_ABIEMB"); \ + if (TARGET_LONG64) \ + builtin_define ("_MIPS_SZLONG=64"); \ + else \ + builtin_define ("_MIPS_SZLONG=32"); \ + if (TARGET_64BIT) \ + builtin_define ("_MIPS_SZPTR=64"); \ + else \ + builtin_define ("_MIPS_SZPTR=32"); \ + } \ + else \ + { \ + builtin_define ("__mips_o32"); \ + builtin_define ("_ABIO32=1"); \ + builtin_define ("_MIPS_SIM=_ABIO32"); \ + builtin_define ("_MIPS_SZLONG=32"); \ + builtin_define ("_MIPS_SZPTR=32"); \ + } \ + if (TARGET_FLOAT64) \ + builtin_define ("_MIPS_FPSET=32"); \ + else \ + builtin_define ("_MIPS_FPSET=16"); \ + \ + builtin_define ("_MIPS_SZINT=32"); \ + } while (0) /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD. Specifically, they define too many namespace-invasive macros. Override @@ -106,6 +147,11 @@ else \ builtin_define ("__MIPSEL__"); \ \ + if (TARGET_OCTEON) \ + builtin_define ("__OCTEON__"); \ + \ + if (ISA_HAS_POP) \ + builtin_define ("__mips_popcount"); \ /* No language dialect defines. */ \ \ /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \ @@ -113,13 +159,6 @@ while (0) -/* Extra specs we need. */ -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, - /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */ #undef SUBTARGET_CPP_SPEC @@ -131,11 +170,12 @@ #undef LINK_SPEC #define LINK_SPEC \ - "%{EL:-m elf32lmip} \ - %{EB:-m elf32bmip} \ + "%{EL:-m elf32ltsmip} \ + %{EB:-m elf32btsmip} \ %(endian_spec) \ %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} \ - %{mips32r6} %{mips64} %{mips64r6} \ + %{mips32r6} %{mips64} %{mips64r2} %{mips64r6} \ + %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ %(netbsd_link_spec)" #define NETBSD_ENTRY_POINT "__start" @@ -165,6 +205,20 @@ /* Make gcc agree with */ +#undef SIZE_TYPE +#define SIZE_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \ + ? "long unsigned int" : "unsigned int") + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \ + ? "long int" : "int") + +#undef INTPTR_TYPE +#define INTPTR_TYPE PTRDIFF_TYPE + +#undef UINTPTR_TYPE +#define UINTPTR_TYPE SIZE_TYPE + #undef WCHAR_TYPE #define WCHAR_TYPE "int" @@ -173,3 +227,8 @@ #undef WINT_TYPE #define WINT_TYPE "int" + +#undef TARGET_WRITABLE_EH_FRAME +#define TARGET_WRITABLE_EH_FRAME 0 + +#define MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/netbsd64.h dist/gcc/config/mips/netbsd64.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/netbsd64.h 1970-01-01 01:00:00 +++ dist/gcc/config/mips/netbsd64.h 2025-11-14 01:50:21 @@ -0,0 +1,57 @@ +/* Definitions of target machine for GNU compiler, for MIPS NetBSD systems. + Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004 + 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 2, 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 COPYING. If not, write to +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* Force the default endianness and ABI flags onto the command line + in order to make the other specs easier to write. */ + +#if MIPS_ABI_DEFAULT == ABI_N32 +# define MIPS64_ABI "%{!mabi=*: -mabi=n32}" +# elif MIPS_ABI_DEFAULT == ABI_64 +# define MIPS64_ABI "%{!mabi=*: -mabi=64}" +#else +# error "Missing MIPS_ABI_DEFAULT " # MIPS_ABI_DEFAULT +#endif + +#undef DRIVER_SELF_SPECS +#define DRIVER_SELF_SPECS \ + BASE_DRIVER_SELF_SPECS \ + "%{!EB:%{!EL:%(endian_spec)}}", \ + MIPS64_ABI + +/* Define default target values. */ + +/* Provide a LINK_SPEC appropriate for a NetBSD/mips target. + This is a copy of LINK_SPEC from tweaked for + the MIPS target. */ + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{mabi=64:-m elf64%{EB:b}%{EL:l}tsmip} \ + %{mabi=32:-m elf32%{EB:b}%{EL:l}tsmip} \ + %{mabi=o64:-m elf64%{EB:b}%{EL:l}tsmip} \ + %{mabi=n32:-m elf32%{EB:b}%{EL:l}tsmipn32} \ + %(endian_spec) \ + %{G*} %{mips1} %{mips2} %{mips3} %{mips4} \ + %{mips32} %{mips32r2} %{mips64} %{mips64r2} \ + %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ + %(netbsd_link_spec)" + +#define MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/t-mips dist/gcc/config/mips/t-mips --- /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/t-mips 2025-05-23 13:02:04 +++ dist/gcc/config/mips/t-mips 2025-11-14 01:50:21 @@ -18,6 +18,8 @@ $(srcdir)/config/mips/mips-tables.opt: $(srcdir)/config/mips/genopt.sh \ $(srcdir)/config/mips/mips-cpus.def + @echo "NOT REBUILDING $@" +NetBSD_DISABLED_config_mips_mips-tables.opt: $(SHELL) $(srcdir)/config/mips/genopt.sh $(srcdir)/config/mips > \ $(srcdir)/config/mips/mips-tables.opt diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/t-netbsd64 dist/gcc/config/mips/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/mips/t-netbsd64 1970-01-01 01:00:00 +++ dist/gcc/config/mips/t-netbsd64 2025-11-14 01:50:21 @@ -0,0 +1,17 @@ +# NetBSD has (will have) "non-native" libraries in /usr/lib/. + +MULTILIB_OPTIONS = mabi=n32/mabi=64/mabi=32 +MULTILIB_DIRNAMES = n32 n64 o32 + +# For NetBSD/mips64 we thus have /usr/lib (n32), /usr/lib/o32 and /usr/lib/64. +ifneq ($(filter MIPS_ABI_DEFAULT=ABI_N32,$(tm_defines)),) +MULTILIB_OSDIRNAMES = . ../lib/64 ../lib/o32 +endif + +# For NetBSD/mipsn64 we thus have /usr/lib (64), /usr/lib/o32 and /usr/lib/n32. +ifneq ($(filter MIPS_ABI_DEFAULT=ABI_64,$(tm_defines)),) +MULTILIB_OSDIRNAMES = ../lib/n32 . ../lib/o32 +endif + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd-elf.h dist/gcc/config/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/netbsd-elf.h 2025-11-14 01:50:21 @@ -39,12 +39,12 @@ %{p:gcrt0%O%s} \ %{!p:crt0%O%s}}} \ %:if-exists(crti%O%s) \ - %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \ - %{!static: \ - %{!shared: \ - %{!pie:crtbegin%O%s} \ - %{pie:crtbeginS%O%s}} \ - %{shared:crtbeginS%O%s}}" + %{pie:crtbeginS%O%s} \ + %{!pie: \ + %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \ + %{!static: \ + %{shared:crtbeginS%O%s} \ + %{!shared:crtbegin%O%s}}}" #undef STARTFILE_SPEC #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC @@ -85,10 +85,15 @@ %{!nostdlib: \ %{!r: \ %{!e*:-e %(netbsd_entry_point)}}} \ + %{pie:-pie} \ %{!static: \ %{rdynamic:-export-dynamic} \ - -dynamic-linker /usr/libexec/ld.elf_so} \ - %{static:-static}}" + %(netbsd_link_ld_elf_so)} \ + %{static:-static \ + %{pie:--no-dynamic-linker}}} \ + %{!shared:%{!nostdlib:%{!nodefaultlibs:\ + %{%:sanitize(address): -lasan } \ + %{%:sanitize(undefined): -lubsan}}}}" /* Provide the standard list of subtarget extra specs for NetBSD targets. */ #define NETBSD_SUBTARGET_EXTRA_SPECS \ @@ -105,3 +110,11 @@ #ifdef HAVE_LD_AS_NEEDED #define USE_LD_AS_NEEDED 1 #endif + +#undef TARGET_UNWIND_TABLES_DEFAULT +#define TARGET_UNWIND_TABLES_DEFAULT true + +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC \ + "%{static|static-libgcc:-lgcc}" \ + "%{!static:%{!static-libgcc:--as-needed -lgcc_s --no-as-needed -lgcc}}" diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd-stdint.h dist/gcc/config/netbsd-stdint.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd-stdint.h 2025-05-23 13:02:04 +++ dist/gcc/config/netbsd-stdint.h 2025-11-14 01:50:21 @@ -36,11 +36,11 @@ #define INT_LEAST8_TYPE INT8_TYPE #define INT_LEAST16_TYPE INT16_TYPE #define INT_LEAST32_TYPE INT32_TYPE -#define INT_LEAST64_TYPE INT64_TYPE +#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") #define UINT_LEAST8_TYPE UINT8_TYPE #define UINT_LEAST16_TYPE UINT16_TYPE #define UINT_LEAST32_TYPE UINT32_TYPE -#define UINT_LEAST64_TYPE UINT64_TYPE +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") #ifdef CHAR_FAST8 #define INT_FAST8_TYPE (LONG_TYPE_SIZE == 64 ? "int" : "signed char") @@ -53,19 +53,19 @@ #define INT_FAST16_TYPE INT32_TYPE #endif #define INT_FAST32_TYPE INT32_TYPE -#define INT_FAST64_TYPE INT64_TYPE +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") #ifdef CHAR_FAST8 -#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST8_TYPE (LONG_TYPE_SIZE == 64 ? "unsigned int" : "unsigned char") #else #define UINT_FAST8_TYPE UINT32_TYPE #endif #ifdef SHORT_FAST16 -#define UINT_FAST16_TYPE "short unsigned int" +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "unsigned int" : "short unsigned int") #else #define UINT_FAST16_TYPE UINT32_TYPE #endif #define UINT_FAST32_TYPE UINT32_TYPE -#define UINT_FAST64_TYPE UINT64_TYPE +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE) #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd.cc dist/gcc/config/netbsd.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd.cc 2025-05-23 13:02:04 +++ dist/gcc/config/netbsd.cc 2025-11-14 01:50:21 @@ -23,6 +23,7 @@ #include "tm.h" #include "tree.h" #include "varasm.h" +#include "opts.h" #include "netbsd-protos.h" static void diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd.h dist/gcc/config/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/netbsd.h 2025-11-14 01:50:21 @@ -23,6 +23,7 @@ { \ builtin_define ("__NetBSD__"); \ builtin_define ("__unix__"); \ + builtin_define ("__syslog_attribute__"); \ builtin_assert ("system=bsd"); \ builtin_assert ("system=unix"); \ builtin_assert ("system=NetBSD"); \ @@ -36,38 +37,60 @@ /* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD source tree so it can be configured appropriately without using - the GNU configure/build mechanism. */ + the GNU configure/build mechanism. -#ifdef NETBSD_NATIVE + NETBSD_TOOLS is defined when gcc is built as cross-compiler for + the in-tree toolchain. + */ +#if defined(NETBSD_NATIVE) || defined(NETBSD_TOOLS) + /* Look for the include files in the system-defined places. */ #undef GPLUSPLUS_INCLUDE_DIR #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" +#undef GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT +#define GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT 1 + +#undef GPLUSPLUS_BACKWARD_INCLUDE_DIR +#define GPLUSPLUS_BACKWARD_INCLUDE_DIR "/usr/include/g++/backward" + +#undef GCC_INCLUDE_DIR_ADD_SYSROOT +#define GCC_INCLUDE_DIR_ADD_SYSROOT 1 + +/* + * XXX figure out a better way to do this + */ #undef GCC_INCLUDE_DIR -#define GCC_INCLUDE_DIR "/usr/include" +#define GCC_INCLUDE_DIR "/usr/include/gcc-14" -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - { 0, 0, 0, 0 } \ - } +/* Under NetBSD, the normal location of the various *crt*.o files is the + /usr/lib directory. */ +#undef STANDARD_STARTFILE_PREFIX +#define STANDARD_STARTFILE_PREFIX "/usr/lib/" +#undef STANDARD_STARTFILE_PREFIX_1 +#define STANDARD_STARTFILE_PREFIX_1 "/usr/lib/" + +#endif /* NETBSD_NATIVE || NETBSD_TOOLS */ + +#if defined(NETBSD_NATIVE) /* Under NetBSD, the normal location of the compiler back ends is the /usr/libexec directory. */ #undef STANDARD_EXEC_PREFIX #define STANDARD_EXEC_PREFIX "/usr/libexec/" -/* Under NetBSD, the normal location of the various *crt*.o files is the - /usr/lib directory. */ +#undef TOOLDIR_BASE_PREFIX +#define TOOLDIR_BASE_PREFIX "../" -#undef STANDARD_STARTFILE_PREFIX -#define STANDARD_STARTFILE_PREFIX "/usr/lib/" +#undef STANDARD_BINDIR_PREFIX +#define STANDARD_BINDIR_PREFIX "/usr/bin" +#undef STANDARD_LIBEXEC_PREFIX +#define STANDARD_LIBEXEC_PREFIX STANDARD_EXEC_PREFIX + #endif /* NETBSD_NATIVE */ @@ -76,14 +99,10 @@ 1. Select the appropriate set of libs, depending on whether we're profiling. - 2. Include the pthread library if -pthread is specified (only - if threads are enabled). + 2. Include the pthread library if -pthread is specified. - 3. Include the posix library if -posix is specified. + 3. Include the posix library if -posix is specified. */ - FIXME: Could eliminate the duplication here if we were allowed to - use string concatenation. */ - #define NETBSD_LIB_SPEC \ "%{pthread: \ %{!p: \ @@ -95,7 +114,11 @@ %{!pg:-lposix}} \ %{p:-lposix_p} \ %{pg:-lposix_p}} \ - %{shared:-lc} \ + %{shared: \ + %{!p: \ + %{!pg:-lc}} \ + %{p:-lc_p} \ + %{pg:-lc_p}} \ %{!shared: \ %{!symbolic: \ %{!p: \ @@ -106,8 +129,10 @@ #undef LIB_SPEC #define LIB_SPEC NETBSD_LIB_SPEC -/* Provide a LIBGCC_SPEC appropriate for NetBSD. */ +#define LIBSTDCXX_PROFILE "stdc++_p" +#define MATH_LIBRARY_PROFILE "m_p" +/* Provide a LIBGCC_SPEC appropriate for NetBSD. */ #ifdef NETBSD_NATIVE #define NETBSD_LIBGCC_SPEC \ "%{!symbolic: \ @@ -121,9 +146,16 @@ #define NETBSD_LIBGCC_SPEC "-lgcc" #endif -#undef LIBGCC_SPEC -#define LIBGCC_SPEC NETBSD_LIBGCC_SPEC +/* Pass -cxx-isystem to cc1/cc1plus. */ +#define NETBSD_CC1_AND_CC1PLUS_SPEC \ + "%{cxx-isystem}" +#undef CC1_SPEC +#define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC + #if defined(HAVE_LD_EH_FRAME_HDR) #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " #endif @@ -161,8 +193,42 @@ #undef WINT_TYPE #define WINT_TYPE "int" +/* Use --as-needed -lgcc_s for eh support. */ +#ifdef HAVE_LD_AS_NEEDED +#define USE_LD_AS_NEEDED 1 +#endif + #undef SUBTARGET_INIT_BUILTINS #define SUBTARGET_INIT_BUILTINS \ do { \ netbsd_patch_builtins (); \ } while(0) +/* Link -lasan early on the command line. For -static-libasan, don't link + it for -shared link, the executable should be compiled with -static-libasan + in that case, and for executable link with --{,no-}whole-archive around + it to force everything into the executable. And similarly for -ltsan, + -lhwasan, and -llsan. */ +#if defined(HAVE_LD_STATIC_DYNAMIC) +#undef LIBASAN_EARLY_SPEC +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ + "%{static-libasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" +#undef LIBHWASAN_EARLY_SPEC +#define LIBHWASAN_EARLY_SPEC "%{static-libhwasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lhwasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libhwasan:-lhwasan}" +#undef LIBTSAN_EARLY_SPEC +#define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \ + "%{static-libtsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" +#undef LIBLSAN_EARLY_SPEC +#define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \ + "%{static-liblsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}" +#endif + +/* NetBSD CTF doesn't handle DWARF 5 yet. */ +#define DWARF_VERSION_DEFAULT 4 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa-netbsd.h dist/gcc/config/pa/pa-netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa-netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/pa/pa-netbsd.h 2025-11-14 01:50:21 @@ -131,7 +131,6 @@ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" -#if 0 -#undef TARGET_SYNC_LIBCALL -#define TARGET_SYNC_LIBCALL 1 -#endif +/* NetBSD always uses 128 bits / 16 byte alignment. */ +#undef MALLOC_ABI_ALIGNMENT +#define MALLOC_ABI_ALIGNMENT 128 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa.cc dist/gcc/config/pa/pa.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa.cc 2025-05-23 13:02:04 +++ dist/gcc/config/pa/pa.cc 2025-11-14 01:50:21 @@ -1272,9 +1272,9 @@ || GET_CODE (XEXP (x, 0)) == REG)) { rtx int_part, ptr_reg; - int newoffset; - int offset = INTVAL (XEXP (x, 1)); - int mask; + HOST_WIDE_INT newoffset; + HOST_WIDE_INT offset = INTVAL (XEXP (x, 1)); + HOST_WIDE_INT mask; mask = (GET_MODE_CLASS (mode) == MODE_FLOAT && !INT14_OK_STRICT ? 0x1f : 0x3fff); @@ -1329,7 +1329,7 @@ { /* If we were given a MULT, we must fix the constant as we're going to create the ASHIFT form. */ - int shift_val = INTVAL (XEXP (XEXP (x, 0), 1)); + HOST_WIDE_INT shift_val = INTVAL (XEXP (XEXP (x, 0), 1)); if (GET_CODE (XEXP (x, 0)) == MULT) shift_val = exact_log2 (shift_val); @@ -1413,7 +1413,7 @@ && INTVAL (XEXP (idx, 1)) % INTVAL (XEXP (XEXP (idx, 0), 1)) == 0) { /* Divide the CONST_INT by the scale factor, then add it to A. */ - int val = INTVAL (XEXP (idx, 1)); + HOST_WIDE_INT val = INTVAL (XEXP (idx, 1)); val /= (1 << shift_val); reg1 = XEXP (XEXP (idx, 0), 0); @@ -1517,7 +1517,7 @@ && INTVAL (XEXP (y, 1)) >= -4096 && INTVAL (XEXP (y, 1)) <= 4095) { - int shift_val = INTVAL (XEXP (XEXP (x, 0), 1)); + HOST_WIDE_INT shift_val = INTVAL (XEXP (XEXP (x, 0), 1)); /* If we were given a MULT, we must fix the constant as we're going to create the ASHIFT form. */ @@ -3148,8 +3148,8 @@ const char * pa_output_block_move (rtx *operands, int size_is_constant ATTRIBUTE_UNUSED) { - int align = INTVAL (operands[5]); - unsigned long n_bytes = INTVAL (operands[4]); + HOST_WIDE_INT align = INTVAL (operands[5]); + unsigned HOST_WIDE_INT n_bytes = INTVAL (operands[4]); /* We can't move more than a word at a time because the PA has no longer integer move insns. (Could use fp mem ops?) */ @@ -3276,8 +3276,8 @@ compute_cpymem_length (rtx_insn *insn) { rtx pat = PATTERN (insn); - unsigned int align = INTVAL (XEXP (XVECEXP (pat, 0, 7), 0)); - unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0)); + unsigned HOST_WIDE_INT align = INTVAL (XEXP (XVECEXP (pat, 0, 7), 0)); + unsigned HOST_WIDE_INT n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0)); unsigned int n_insns = 0; /* We can't move more than four bytes at a time because the PA @@ -3312,8 +3312,8 @@ const char * pa_output_block_clear (rtx *operands, int size_is_constant ATTRIBUTE_UNUSED) { - int align = INTVAL (operands[3]); - unsigned long n_bytes = INTVAL (operands[2]); + HOST_WIDE_INT align = INTVAL (operands[3]); + unsigned HOST_WIDE_INT n_bytes = INTVAL (operands[2]); /* We can't clear more than a word at a time because the PA has no longer integer move insns. */ @@ -3418,8 +3418,8 @@ compute_clrmem_length (rtx_insn *insn) { rtx pat = PATTERN (insn); - unsigned int align = INTVAL (XEXP (XVECEXP (pat, 0, 4), 0)); - unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 3), 0)); + unsigned HOST_WIDE_INT align = INTVAL (XEXP (XVECEXP (pat, 0, 4), 0)); + unsigned HOST_WIDE_INT n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 3), 0)); unsigned int n_insns = 0; /* We can't clear more than a word at a time because the PA @@ -5946,7 +5946,7 @@ static void pa_linux_file_start (void) { - pa_file_start_file (1); + pa_file_start_file (0); pa_file_start_level (); pa_file_start_mcount ("CODE"); } @@ -6171,7 +6171,7 @@ const char * pa_output_div_insn (rtx *operands, int unsignedp, rtx_insn *insn) { - int divisor; + HOST_WIDE_INT divisor; /* If the divisor is a constant, try to use one of the special opcodes .*/ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa32-netbsd.h dist/gcc/config/pa/pa32-netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/pa32-netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/pa/pa32-netbsd.h 2025-11-14 01:50:21 @@ -32,6 +32,6 @@ " .text\n" \ " .word __canonicalize_funcptr_for_compare-$PIC_pcrel$0"); \ STATIC func_ptr __CTOR_LIST__[1] \ - __attribute__ ((__used__, section(".ctors"), \ + __attribute__ ((__unused__, section(".ctors"), \ aligned(sizeof(func_ptr)))) \ = { (func_ptr) (-1) } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/t-netbsd dist/gcc/config/pa/t-netbsd --- /Users/io/Downloads/gcc-14.3.0/gcc/config/pa/t-netbsd 1970-01-01 01:00:00 +++ dist/gcc/config/pa/t-netbsd 2025-11-14 01:50:21 @@ -0,0 +1 @@ +#MULTIARCH_DIRNAME = $(call if_multiarch,hppa-linux-gnu) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/riscv/netbsd.h dist/gcc/config/riscv/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/riscv/netbsd.h 1970-01-01 01:00:00 +++ dist/gcc/config/riscv/netbsd.h 2025-11-14 01:50:21 @@ -0,0 +1,74 @@ +/* Definitions for RISCV running NetBSD systems using ELF + Copyright (C) 2014 + Free Software Foundation, Inc. + Contributed by Matt Thomas + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 this program; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef DRIVER_SELF_SPECS +#define DRIVER_SELF_SPECS "" + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_FDIV) + +#undef TARGET_DEFAULT_CMODEL +#define TARGET_DEFAULT_CMODEL CM_MEDANY + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + NETBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__riscv__"); \ + /* The GNU C++ standard library requires this. */ \ + if (c_dialect_cxx ()) \ + builtin_define ("_GNU_SOURCE"); \ + if (!TARGET_HARD_FLOAT) \ + builtin_define ("_SOFT_FLOAT"); \ + } while (0) + +#undef CPP_SPEC +#define CPP_SPEC NETBSD_CPP_SPEC + +#undef LIB_SPEC +#define LIB_SPEC NETBSD_LIB_SPEC + +#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS + +#undef STARTFILE_PREFIX_SPEC + +#define LD_EMUL_SUFFIX \ + "%{mabi=lp64d:}" \ + "%{mabi=lp64f:_lp64f}" \ + "%{mabi=lp64:_lp64}" \ + "%{mabi=ilp32d:}" \ + "%{mabi=ilp32f:_ilp32f}" \ + "%{mabi=ilp32:_ilp32}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX \ + "%(netbsd_link_spec)" + +#undef NETBSD_ENTRY_POINT +#define NETBSD_ENTRY_POINT "_start" + +/* Override netbsd-stdint.h uintptr_t and inptr_t. */ +#undef UINTPTR_TYPE +#define UINTPTR_TYPE "long unsigned int" + +#undef INTPTR_TYPE +#define INTPTR_TYPE "long int" diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/riscv/t-netbsd64 dist/gcc/config/riscv/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/riscv/t-netbsd64 1970-01-01 01:00:00 +++ dist/gcc/config/riscv/t-netbsd64 2025-11-14 01:50:21 @@ -0,0 +1,3 @@ +MULTILIB_OPTIONS = march=rv64i/march=rv64g/march=rv32i/march=rv32g +MULTILIB_DIRNAMES = 64 64 32 32 +MULTILIB_OSDIRNAMES = . . ../lib/rv32 ../lib/rv32 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/netbsd.h dist/gcc/config/rs6000/netbsd.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/netbsd.h 2025-05-23 13:02:04 +++ dist/gcc/config/rs6000/netbsd.h 2025-11-14 01:50:21 @@ -31,6 +31,12 @@ builtin_define ("__powerpc__"); \ builtin_assert ("cpu=powerpc"); \ builtin_assert ("machine=powerpc"); \ + if (TARGET_SECURE_PLT) \ + builtin_define ("_SECURE_PLT"); \ + if (TARGET_SOFT_FLOAT) \ + builtin_define ("_SOFT_FLOAT"); \ + if (TARGET_ISEL) \ + builtin_define ("__PPC_ISEL__"); \ } \ while (0) @@ -62,6 +68,29 @@ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "int" +/* Redefine some types that where redefined by rs6000 include files. */ + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef WINT_TYPE +#define WINT_TYPE "int" + +#undef INT64_TYPE +#define INT64_TYPE "long long int" + +#undef UINT64_TYPE +#define UINT64_TYPE "long long unsigned int" + +#undef INTMAX_TYPE +#define INTMAX_TYPE "long long int" + +#undef UINTMAX_TYPE +#define UINTMAX_TYPE "long long unsigned int" + /* Undo the spec mess from sysv4.h, and just define the specs the way NetBSD systems actually expect. */ @@ -79,17 +108,39 @@ #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC #undef ENDFILE_SPEC -#define ENDFILE_SPEC "%(netbsd_endfile_spec)" +#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC #undef LIB_SPEC #define LIB_SPEC NETBSD_LIB_SPEC #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, \ - { "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC }, + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ + NETBSD_SUBTARGET_EXTRA_SPECS +/* + * Add NetBSD specific defaults: -mstrict-align + */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_STRICT_ALIGN) + +/* + * We know we have the right binutils for this (we shouldn't need to do this + * but until the cross build does the right thing...) + */ +#undef TARGET_SECURE_PLT +#define TARGET_SECURE_PLT secure_plt +#undef HAVE_AS_TLS +#define HAVE_AS_TLS 1 +#define POWERPC_NETBSD + +/* Attempt to enable execute permissions on the stack. */ +//#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK +// XXXMRG use enable-execute-stack-mprotect.c ? +#ifdef L_trampoline +#undef TRAMPOLINE_SIZE +#define TRAMPOLINE_SIZE 48 +#endif /* Use standard DWARF numbering for DWARF debugging information. */ #define RS6000_USE_DWARF_NUMBERING diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/netbsd64.h dist/gcc/config/rs6000/netbsd64.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/netbsd64.h 1970-01-01 01:00:00 +++ dist/gcc/config/rs6000/netbsd64.h 2025-11-14 01:50:21 @@ -0,0 +1,534 @@ +/* Definitions of target machine for GNU compiler, + for 64 bit PowerPC NetBSD. + Copyright (C) 2006-2023 Free Software Foundation, Inc. + Contributed by Matthew Green (mrg@eterna.com.au). + + 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 2, 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 COPYING. If not, write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* Undef gnu-user.h macros we don't want. */ +#undef CPLUSPLUS_CPP_SPEC +#undef LINK_GCC_C_SEQUENCE_SPEC + +#ifndef RS6000_BI_ARCH + +#undef DEFAULT_ABI +#define DEFAULT_ABI ABI_AIX + +#undef TARGET_64BIT +#define TARGET_64BIT 1 + +#define DEFAULT_ARCH64_P 1 +#define RS6000_BI_ARCH_P 0 + +#else + +#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT) +#define RS6000_BI_ARCH_P 1 + +#endif + +#ifdef IN_LIBGCC2 +#undef TARGET_64BIT +#ifdef __powerpc64__ +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#endif + +#undef TARGET_AIX +#define TARGET_AIX TARGET_64BIT + +#ifdef HAVE_LD_NO_DOT_SYMS +/* New ABI uses a local sym for the function entry point. */ +extern int dot_symbols; +#undef DOT_SYMBOLS +#define DOT_SYMBOLS dot_symbols +#endif + +#define TARGET_PROFILE_KERNEL profile_kernel + +#define TARGET_USES_LINUX64_OPT 1 +#ifdef HAVE_LD_LARGE_TOC +#undef TARGET_CMODEL +#define TARGET_CMODEL rs6000_current_cmodel +#define SET_CMODEL(opt) rs6000_current_cmodel = opt +#else +#define SET_CMODEL(opt) do {} while (0) +#endif + +#undef PROCESSOR_DEFAULT +#define PROCESSOR_DEFAULT PROCESSOR_POWER4 +#undef PROCESSOR_DEFAULT64 +#define PROCESSOR_DEFAULT64 PROCESSOR_POWER4 + +/* We don't need to generate entries in .fixup, except when + -mrelocatable or -mrelocatable-lib is given. */ +#undef RELOCATABLE_NEEDS_FIXUP +#define RELOCATABLE_NEEDS_FIXUP \ + (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE) + +#undef RS6000_ABI_NAME +#define RS6000_ABI_NAME "netbsd" + +#define INVALID_64BIT "-m%s not supported in this configuration" +#define INVALID_32BIT INVALID_64BIT + +#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2) + +#undef SUBSUBTARGET_OVERRIDE_OPTIONS +#define SUBSUBTARGET_OVERRIDE_OPTIONS \ + do rs6000_linux64_override_options (); while (0) + +#undef ASM_DEFAULT_SPEC +#undef ASM_SPEC +#undef LINK_OS_NETBSD_SPEC +#undef LINK_SECURE_PLT_SPEC + +#ifndef RS6000_BI_ARCH +#define ASM_DEFAULT_SPEC "-mppc64" +#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" +#define LINK_OS_NETBSD_SPEC "%(link_os_netbsd_spec64)" +#define LINK_SECURE_PLT_SPEC "" +#else +#if DEFAULT_ARCH64_P +#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" +#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" +#define LINK_OS_NETBSD_SPEC "%{m32:%(link_os_netbsd_spec32)}%{!m32:%(link_os_netbsd_spec64)}" +#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}" +#else +#define ASM_DEFAULT_SPEC "-mppc%{m64:64}" +#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" +#define LINK_OS_NETBSD_SPEC "%{!m64:%(link_os_netbsd_spec32)}%{m64:%(link_os_netbsd_spec64)}" +#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}" +#endif +#endif + +#define ASM_SPEC32 "-a32 \ +%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ +%{memb|msdata=eabi: -memb}" + +#define ASM_SPEC64 "-a64" + +#define ASM_SPEC_COMMON "%(asm_cpu) \ +%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ + ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) + +#undef SUBSUBTARGET_EXTRA_SPECS +#define SUBSUBTARGET_EXTRA_SPECS \ + { "asm_spec_common", ASM_SPEC_COMMON }, \ + { "asm_spec32", ASM_SPEC32 }, \ + { "asm_spec64", ASM_SPEC64 }, \ + { "link_os_netbsd_spec32", LINK_OS_NETBSD_SPEC32 }, \ + { "link_os_netbsd_spec64", LINK_OS_NETBSD_SPEC64 }, + +#undef MULTILIB_DEFAULTS +#if DEFAULT_ARCH64_P +#define MULTILIB_DEFAULTS { "m64" } +#else +#define MULTILIB_DEFAULTS { "m32" } +#endif + +#ifndef RS6000_BI_ARCH + +/* 64-bit PowerPC NetBSD is always big-endian. */ +#undef TARGET_LITTLE_ENDIAN +#define TARGET_LITTLE_ENDIAN 0 + +/* 64-bit PowerPC NetBSD always has a TOC. */ +#undef TARGET_TOC +#define TARGET_TOC 1 + +/* Some things from sysv4.h we don't do when 64 bit. */ +#undef TARGET_RELOCATABLE +#define TARGET_RELOCATABLE 0 +#undef TARGET_EABI +#define TARGET_EABI 0 +#undef TARGET_PROTOTYPE +#define TARGET_PROTOTYPE 0 +#undef RELOCATABLE_NEEDS_FIXUP +#define RELOCATABLE_NEEDS_FIXUP 0 + +#endif + +/* We use NetBSD libc _mcount for profiling. */ +#define NO_PROFILE_COUNTERS 1 +#define PROFILE_HOOK(LABEL) \ + do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) + +/* PowerPC64 NetBSD word-aligns FP doubles when -malign-power is given. */ +#undef ADJUST_FIELD_ALIGN +#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ + ((TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ? MIN ((COMPUTED), 32) \ + : (COMPUTED)) + +/* PowerPC64 NetBSD increases natural record alignment to doubleword if + the first field is an FP double, only if in power alignment mode. */ +#undef ROUND_TYPE_ALIGN +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TARGET_64BIT \ + && (TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && TARGET_ALIGN_NATURAL == 0) \ + ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ + : MAX ((COMPUTED), (SPECIFIED))) + +/* Use the default for compiling target libs. */ +#ifdef IN_TARGET_LIBS +#undef TARGET_ALIGN_NATURAL +#define TARGET_ALIGN_NATURAL 1 +#endif + +/* Indicate that jump tables go in the text section. */ +#undef JUMP_TABLES_IN_TEXT_SECTION +#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT + +/* The linux ppc64 ABI isn't explicit on whether aggregates smaller + than a doubleword should be padded upward or downward. You could + reasonably assume that they follow the normal rules for structure + layout treating the parameter area as any other block of memory, + then map the reg param area to registers. i.e. pad upward. + Setting both of the following defines results in this behavior. + Setting just the first one will result in aggregates that fit in a + doubleword being padded downward, and others being padded upward. + Not a bad idea as this results in struct { int x; } being passed + the same way as an int. */ +#define AGGREGATE_PADDING_FIXED TARGET_64BIT +#define AGGREGATES_PAD_UPWARD_ALWAYS 0 + +/* Specify padding for the last element of a block move between + registers and memory. FIRST is nonzero if this is the only + element. */ +#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ + (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE)) + +/* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit + process. */ +#define OS_MISSING_POWERPC64 (!TARGET_64BIT) + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + NETBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__PPC__"); \ + builtin_define ("__ppc__"); \ + builtin_define ("__powerpc__"); \ + if (TARGET_ISEL) \ + builtin_define ("__PPC_ISEL__"); \ + if (TARGET_64BIT) \ + { \ + builtin_define ("__arch64__"); \ + builtin_define ("__PPC64__"); \ + builtin_define ("__powerpc64__"); \ + builtin_define_with_int_value ("__PIC__", 2); \ + builtin_assert ("cpu=powerpc64"); \ + builtin_assert ("machine=powerpc64"); \ + } \ + else \ + { \ + builtin_define_std ("PPC"); \ + builtin_define_std ("powerpc"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ + } \ + } \ + while (0) + +/* Override the default from rs6000.h to avoid conflicts with macros + defined in NetBSD header files. */ + +#undef RS6000_CPU_CPP_ENDIAN_BUILTINS +#define RS6000_CPU_CPP_ENDIAN_BUILTINS() \ + do \ + { \ + builtin_define ("__BIG_ENDIAN__"); \ + builtin_assert ("machine=bigendian"); \ + } \ + while (0) + +#undef CC1_OS_NETBSD_SPEC +#define CC1_OS_NETBSD_SPEC \ + NETBSD_CC1_AND_CC1PLUS_SPEC \ + "%{!m32: %{!mrelocatable: %{!fno-pie: %{!fno-pic: \ + %{!fpie: %{!fpic: \ + %{!fPIE: %{!fPIC:-fPIC}}}}}}}}" +/* %{!m32: %{!mcmodel*: -mcmodel=medium}}" */ + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC CC1_OS_NETBSD_SPEC + +#undef CPP_OS_DEFAULT_SPEC +#define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)" + +#undef LINK_SHLIB_SPEC +#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" + +#undef LIB_DEFAULT_SPEC +#define LIB_DEFAULT_SPEC "%(lib_netbsd)" + +#undef STARTFILE_DEFAULT_SPEC +#define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)" + +#undef ENDFILE_DEFAULT_SPEC +#define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)" + +#undef LINK_START_DEFAULT_SPEC +#define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)" + +#undef LINK_OS_DEFAULT_SPEC +#define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)" + +#define LINK_OS_NETBSD_SPEC32 "-m elf32ppc %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}" + +#define LINK_OS_NETBSD_SPEC64 "-m elf64ppc %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}" + +/* Use standard DWARF numbering for DWARF debugging information. */ +#define RS6000_USE_DWARF_NUMBERING + +#undef TOC_SECTION_ASM_OP +#define TOC_SECTION_ASM_OP \ + (TARGET_64BIT \ + ? "\t.section\t\".toc\",\"aw\"" \ + : "\t.section\t\".got\",\"aw\"") + +#undef MINIMAL_TOC_SECTION_ASM_OP +#define MINIMAL_TOC_SECTION_ASM_OP \ + (TARGET_64BIT \ + ? "\t.section\t\".toc1\",\"aw\"" \ + : (flag_pic \ + ? "\t.section\t\".got2\",\"aw\"" \ + : "\t.section\t\".got1\",\"aw\"")) + +/* This is how to declare the size of a function. */ +#undef ASM_DECLARE_FUNCTION_SIZE +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do \ + { \ + if (!flag_inhibit_size_directive) \ + { \ + fputs ("\t.size\t", (FILE)); \ + if (TARGET_64BIT && DOT_SYMBOLS) \ + putc ('.', (FILE)); \ + assemble_name ((FILE), (FNAME)); \ + fputs (",.-", (FILE)); \ + rs6000_output_function_entry (FILE, FNAME); \ + putc ('\n', (FILE)); \ + } \ + } \ + while (0) + +#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P +#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ + (TARGET_TOC \ + && (SYMBOL_REF_P (X) \ + || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ + && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0))) \ + || GET_CODE (X) == LABEL_REF \ + || (CONST_INT_P (X) \ + && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ + || (CONST_DOUBLE_P (X) \ + && ((TARGET_64BIT \ + && (TARGET_MINIMAL_TOC \ + || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ + && ! TARGET_NO_FP_IN_TOC))) \ + || (!TARGET_64BIT \ + && !TARGET_NO_FP_IN_TOC \ + && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ + && BITS_PER_WORD == HOST_BITS_PER_INT))))) + +/* Make GCC agree with . */ + +#undef SIZE_TYPE +#define SIZE_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") + +#undef INTPTR_TYPE +#define INTPTR_TYPE PTRDIFF_TYPE + +#undef UINTPTR_TYPE +#define UINTPTR_TYPE SIZE_TYPE + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef INT8_TYPE +#define INT8_TYPE "signed char" + +#undef INT16_TYPE +#define INT16_TYPE "short int" + +#undef INT32_TYPE +#define INT32_TYPE "int" + +#undef INT64_TYPE +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") + +#undef UINT8_TYPE +#define UINT8_TYPE "unsigned char" + +#undef UINT16_TYPE +#define UINT16_TYPE "short unsigned int" + +#undef UINT32_TYPE +#define UINT32_TYPE "unsigned int" + +#undef UINT64_TYPE +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#undef INT_FAST8_TYPE +#define INT_FAST8_TYPE "int" + +#undef INT_FAST16_TYPE +#define INT_FAST16_TYPE "int" + +#undef INT_FAST32_TYPE +#define INT_FAST32_TYPE "int" + +#undef INT_FAST64_TYPE +#define INT_FAST64_TYPE INT64_TYPE + +#undef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE "unsigned int" + +#undef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE "unsigned int" + +#undef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE "unsigned int" + +#undef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE "unsigned int" + +#undef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE "unsigned int" + +#undef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE "unsigned int" + +#undef UINT_FAST64_TYPE +#define UINT_FAST64_TYPE UINT64_TYPE + +#undef INT_LEAST8_TYPE +#define INT_LEAST8_TYPE INT8_TYPE + +#undef INT_LEAST16_TYPE +#define INT_LEAST16_TYPE INT16_TYPE + +#undef INT_LEAST32_TYPE +#define INT_LEAST32_TYPE "int" + +#undef INT_LEAST64_TYPE +#define INT_LEAST64_TYPE INT64_TYPE + +#undef UINT_LEAST8_TYPE +#define UINT_LEAST8_TYPE UINT8_TYPE + +#undef UINT_LEAST16_TYPE +#define UINT_LEAST16_TYPE UINT16_TYPE + +#undef UINT_LEAST32_TYPE +#define UINT_LEAST32_TYPE "unsigned int" + +#undef UINT_LEAST64_TYPE +#define UINT_LEAST64_TYPE UINT64_TYPE + +#undef INTMAX_TYPE +#define INTMAX_TYPE INT64_TYPE + +#undef UINTMAX_TYPE +#define UINTMAX_TYPE UINT64_TYPE + +#if 0 +/* Override rs6000.h definition. */ +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +/* Override rs6000.h definition. */ +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" +#endif + +#undef RS6000_MCOUNT +#define RS6000_MCOUNT "_mcount" + +#ifdef __powerpc64__ +/* _init and _fini functions are built from bits spread across many + object files, each potentially with a different TOC pointer. For + that reason, place a nop after the call so that the linker can + restore the TOC pointer if a TOC adjusting call stub is needed. */ +#if DOT_SYMBOLS +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n" \ +" bl ." #FUNC "\n" \ +" nop\n" \ +" .previous"); +#else +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n" \ +" bl " #FUNC "\n" \ +" nop\n" \ +" .previous"); +#endif +#endif + +/* FP save and restore routines. */ +#undef SAVE_FP_PREFIX +#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") +#undef RESTORE_FP_PREFIX +#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") + +/* For backward compatibility, we must continue to use the AIX + structure return convention. */ +#undef DRAFT_V4_STRUCT_RET +#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) + +/* Use --as-needed -lgcc_s for eh support. */ +#ifdef HAVE_LD_AS_NEEDED +#define USE_LD_AS_NEEDED 1 +#endif + +/* + * NetBSD ppc64 used to have 128-bit long double support. + * But it does not work anymore: + * (insn 23 22 24 5 (set (reg:CCFP 179) + * (compare:CCFP (reg/v:TF 171 [ a ]) + * (reg:TF 177))) + * "/usr/src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixxfti.c":43 -1 + */ +#undef RS6000_DEFAULT_LONG_DOUBLE_SIZE +#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64 + +#define POWERPC_NETBSD + +/* The IEEE 128-bit emulator is only built on Linux systems. Flag that we + should enable the type handling for KFmode on VSX systems even if we are not + enabling the __float128 keyword. */ +#undef TARGET_FLOAT128_ENABLE_TYPE +#define TARGET_FLOAT128_ENABLE_TYPE 1 diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/rs6000-logue.cc dist/gcc/config/rs6000/rs6000-logue.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/rs6000-logue.cc 2025-05-23 13:02:04 +++ dist/gcc/config/rs6000/rs6000-logue.cc 2025-11-14 01:50:21 @@ -2263,7 +2263,8 @@ } else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) { -#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) +#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) \ + && !defined(POWERPC_NETBSD) /* No out-of-line save/restore routines for GPRs on AIX. */ gcc_assert (!TARGET_AIX || (sel & SAVRES_REG) != SAVRES_GPR); #endif @@ -2275,7 +2276,8 @@ : ((sel & SAVRES_LR) ? "_restgpr0_" : "_restgpr1_")); else if ((sel & SAVRES_REG) == SAVRES_FPR) { -#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) +#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) \ + || defined(POWERPC_NETBSD) if ((sel & SAVRES_LR)) prefix = ((sel & SAVRES_SAVE) ? "_savefpr_" : "_restfpr_"); else diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/rs6000.cc dist/gcc/config/rs6000/rs6000.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/rs6000.cc 2025-05-23 13:02:04 +++ dist/gcc/config/rs6000/rs6000.cc 2025-11-14 01:50:21 @@ -96,7 +96,7 @@ of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are properly defined. */ #ifndef TARGET_IEEEQUAD_DEFAULT -#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) +#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) && !defined(POWERPC_NETBSD) #define TARGET_IEEEQUAD_DEFAULT 1 #else #define TARGET_IEEEQUAD_DEFAULT 0 @@ -21230,7 +21230,11 @@ if (flag_pic) return 3; else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) +#if defined (POWERPC_NETBSD) + return 3; +#else return 2; +#endif else return 0; } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/sysv4.h dist/gcc/config/rs6000/sysv4.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/sysv4.h 2025-05-23 13:02:04 +++ dist/gcc/config/rs6000/sysv4.h 2025-11-14 01:50:21 @@ -92,6 +92,7 @@ else if (!strcmp (rs6000_abi_name, "aixdesc")) \ rs6000_current_abi = ABI_AIX; \ else if (!strcmp (rs6000_abi_name, "freebsd") \ + || !strcmp (rs6000_abi_name, "netbsd") \ || !strcmp (rs6000_abi_name, "linux")) \ { \ if (TARGET_64BIT) \ @@ -99,8 +100,6 @@ else \ rs6000_current_abi = ABI_V4; \ } \ - else if (!strcmp (rs6000_abi_name, "netbsd")) \ - rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "openbsd")) \ rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "i960-old")) \ @@ -576,7 +575,8 @@ %{mcall-openbsd: -mno-eabi }}} \ %{msdata: -msdata=default} \ %{mno-sdata: -msdata=none} \ -%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}}" \ +%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \ +%(cc1_os_netbsd)" \ GNU_USER_TARGET_CC1_SPEC /* Default starting address if specified. */ @@ -788,28 +788,23 @@ #define CPP_OS_LINUX_SPEC "%{pthread:-D_REENTRANT}" /* NetBSD support. */ -#define LIB_NETBSD_SPEC "\ --lc" +#define LIB_NETBSD_SPEC NETBSD_LIB_SPEC -#define STARTFILE_NETBSD_SPEC "\ -ncrti.o%s crt0.o%s \ -%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" +#define STARTFILE_NETBSD_SPEC NETBSD_STARTFILE_SPEC -#define ENDFILE_NETBSD_SPEC "\ -%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ -ncrtn.o%s" +#define ENDFILE_NETBSD_SPEC NETBSD_ENDFILE_SPEC #define LINK_START_NETBSD_SPEC "\ " -#define LINK_OS_NETBSD_SPEC "\ -%{!shared: %{!static: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker /usr/libexec/ld.elf_so}}" +#define LINK_OS_NETBSD_SPEC NETBSD_LINK_SPEC_ELF #define CPP_OS_NETBSD_SPEC "\ -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__" +#define CC1_OS_NETBSD_SPEC "\ +%{cxx-isystem}" + /* OpenBSD support. */ #ifndef LIB_OPENBSD_SPEC #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" @@ -892,6 +887,7 @@ { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ + { "cc1_os_netbsd", CC1_OS_NETBSD_SPEC }, \ { "link_secure_plt", LINK_SECURE_PLT_SPEC }, \ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/t-netbsd dist/gcc/config/rs6000/t-netbsd --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/t-netbsd 2025-05-23 13:02:04 +++ dist/gcc/config/rs6000/t-netbsd 2025-11-14 01:50:21 @@ -18,6 +18,10 @@ # along with GCC; see the file COPYING3. If not see # . +# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata. +CRTSTUFF_T_CFLAGS += -msdata=none +CRTSTUFF_T_CFLAGS_S += -msdata=none + # Switch synonyms MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \ msoft-float=mcpu?403 \ @@ -34,3 +38,9 @@ MULTILIB_EXCEPTIONS = MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} + +LIBGCC = stmp-multilib + +INSTALL_LIBGCC = install-multilib +EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \ + crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/t-netbsd64 dist/gcc/config/rs6000/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/rs6000/t-netbsd64 1970-01-01 01:00:00 +++ dist/gcc/config/rs6000/t-netbsd64 2025-11-14 01:50:21 @@ -0,0 +1,30 @@ +# Support for NetBSD PowerPC64 ELF targets (ELF64 ABI). + +LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/tramp.asm \ + $(srcdir)/config/rs6000/ppc64-fp.c \ + $(srcdir)/config/rs6000/darwin-ldouble.c + +TARGET_LIBGCC2_CFLAGS += -mno-minimal-toc + +MULTILIB_OPTIONS = m64/m32 +MULTILIB_DIRNAMES = 64 32 +MULTILIB_OSDIRNAMES = . ../lib/powerpc + +MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT) + +# We want fine grained libraries, so use the new code to build the +# floating point emulation libraries. +# fp-bit is only to be used by 32-bit multilibs +FPBIT = fp-bit32.c +DPBIT = dp-bit32.c + +dp-bit32.c: $(srcdir)/config/fp-bit.c + ( echo '#ifndef __powerpc64__'; \ + cat $(srcdir)/config/fp-bit.c; \ + echo '#endif' ) > dp-bit32.c + +fp-bit32.c: $(srcdir)/config/fp-bit.c + ( echo '#ifndef __powerpc64__'; \ + echo '#define FLOAT'; \ + cat $(srcdir)/config/fp-bit.c; \ + echo '#endif' ) > fp-bit32.c diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/sh/netbsd-elf.h dist/gcc/config/sh/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/sh/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/sh/netbsd-elf.h 2025-11-14 01:50:21 @@ -20,13 +20,6 @@ /* Run-time Target Specification. */ -/* Extra specs needed for NetBSD SuperH ELF targets. */ - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, - - #define TARGET_OS_CPP_BUILTINS() \ do \ { \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/sh/t-sh dist/gcc/config/sh/t-sh --- /Users/io/Downloads/gcc-14.3.0/gcc/config/sh/t-sh 2025-05-23 13:02:04 +++ dist/gcc/config/sh/t-sh 2025-11-14 01:50:21 @@ -90,7 +90,6 @@ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al $(out_object_file): gt-sh.h -gt-sh.h : s-gtype ; @true # Local Variables: # mode: Makefile diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/sparc/netbsd-elf.h dist/gcc/config/sparc/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/sparc/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/sparc/netbsd-elf.h 2025-11-14 01:50:21 @@ -46,6 +46,37 @@ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" +/* we keep these "long" on both 32bit and 64bit targets */ +#undef INTPTR_TYPE +#define INTPTR_TYPE PTRDIFF_TYPE + +#undef UINTPTR_TYPE +#define UINTPTR_TYPE SIZE_TYPE + +#undef INT_FAST8_TYPE +#define INT_FAST8_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") + +#undef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE (LONG_TYPE_SIZE == 64 ? "unsigned char" : "unsigned int") + +#undef INT_FAST16_TYPE +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") + +#undef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "short unsigned int" : "unsigned int") + +#undef INT_FAST32_TYPE +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") + +#undef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE "unsigned int" + +#undef INT_FAST64_TYPE +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") + +#undef UINT_FAST64_TYPE +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." @@ -94,7 +125,7 @@ + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128) #undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_MEDANY +#define SPARC_DEFAULT_CMODEL CM_MEDMID #endif @@ -106,7 +137,8 @@ %{!mcpu*:%{!mv8plus:-mcpu=ultrasparc}} \ %{!mno-vis:%{!mcpu=v9:-mvis}} \ %{p:-mcmodel=medlow} \ - %{pg:-mcmodel=medlow}}" + %{pg:-mcmodel=medlow}} " \ + NETBSD_CC1_AND_CC1PLUS_SPEC #define CC1_SPEC64 \ "%{m32:%{m64:%emay not use both -m32 and -m64}} \ @@ -115,9 +147,29 @@ %{!mlong-double-128:-mlong-double-64} \ %{!mcpu*:%{!mv8plus:-mcpu=cypress}}} \ %{!m32: \ - %{p:-mcmodel=medlow} \ - %{pg:-mcmodel=medlow}}" + %{p:-mcmodel=medlow} \ + %{pg:-mcmodel=medlow}} " \ + NETBSD_CC1_AND_CC1PLUS_SPEC +#if defined(SPARC_BI_ARCH) || defined(__arch64__) +/* add code model specific object to the link line for 64bit */ +#define LINK_SPEC_CODE_MODEL64 \ + "%{!shared:" \ + "%{!mcmodel=*:%:if-exists(%R/usr/lib/sparc_mcmedmid.o)}" \ + "%{mcmodel=medlow:%:if-exists(%R/usr/lib/sparc_mcmedlow.o)}" \ + "%{mcmodel=medmid:%:if-exists(%R/usr/lib/sparc_mcmedmid.o)}" \ + "%{mcmodel=medany:%:if-exists(%R/usr/lib/sparc_mcmedany.o)}" \ + "}" + +#ifdef SPARC_BI_ARCH +#define LINK_SPEC_CODE_MODEL "%{!m32:" LINK_SPEC_CODE_MODEL64 "}" +#else +#define LINK_SPEC_CODE_MODEL LINK_SPEC_CODE_MODEL64 +#endif +#else +#define LINK_SPEC_CODE_MODEL "" +#endif + /* Make sure we use the right output format. Pick a default and then make sure -m32/-m64 switch to the right one. */ @@ -134,7 +186,8 @@ #define LINK_SPEC \ "%(link_arch) \ %{!mno-relax:%{!r:-relax}} \ - %(netbsd_link_spec)" + %(netbsd_link_spec) " \ + LINK_SPEC_CODE_MODEL #define NETBSD_ENTRY_POINT "__start" @@ -151,9 +204,7 @@ { "link_arch64", LINK_ARCH64_SPEC }, \ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ { "link_arch", LINK_ARCH_SPEC }, \ - { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ - { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, + NETBSD_SUBTARGET_EXTRA_SPECS /* Build a compiler that supports -m32 and -m64? */ @@ -203,6 +254,13 @@ || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */ #endif /* SPARC_BI_ARCH */ + +#ifdef HAVE_AS_TLS +#undef TARGET_SUN_TLS +#undef TARGET_GNU_TLS +#define TARGET_SUN_TLS 0 +#define TARGET_GNU_TLS 1 +#endif /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ #undef CTORS_SECTION_ASM_OP diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/sparc/t-netbsd64 dist/gcc/config/sparc/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/gcc/config/sparc/t-netbsd64 2025-05-23 13:02:04 +++ dist/gcc/config/sparc/t-netbsd64 2025-11-14 01:50:21 @@ -1,5 +1,9 @@ -# Disable multilib for now, as NetBSD/sparc64 does not ship with -# a 32-bit environment. -#MULTILIB_OPTIONS = m32/m64 -#MULTILIB_DIRNAMES = 32 64 -#MULTILIB_MATCHES = +# NetBSD has (will have) "non-native" libraries in /usr/lib/. +# For NetBSD/sparc64 we thus have /usr/lib and /usr/lib/sparc. + +MULTILIB_OPTIONS = m64/m32 +MULTILIB_DIRNAMES = 64 32 +MULTILIB_OSDIRNAMES = . ../lib/sparc + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/builtins.md dist/gcc/config/vax/builtins.md --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/builtins.md 2025-05-23 13:02:04 +++ dist/gcc/config/vax/builtins.md 2025-11-14 01:50:21 @@ -44,9 +44,9 @@ emit_insn (gen_ctz2_ccz (operands[0], operands[1])); emit_jump_insn (gen_rtx_SET (pc_rtx, target)); - emit_insn (gen_neg2 (operands[0], const1_rtx)); + emit_insn (gen_negsi2 (operands[0], const1_rtx)); emit_label (label); - emit_insn (gen_add3 (operands[0], operands[0], const1_rtx)); + emit_insn (gen_addsi3 (operands[0], operands[0], const1_rtx)); DONE; }") @@ -138,6 +138,10 @@ ;; This effectively combines the two peepholes above, ;; matching the sequence produced by `ffs2'. +;; +;; note - should really only do this for memory references +;; without a mode dependent address, or for +;; registers. (define_peephole2 [(parallel [(set (match_operand:SI 0 "register_operand") @@ -151,7 +155,13 @@ (compare:CCZ (match_dup 0) (const_int 0)))] "!rtx_equal_p (operands[0], operands[2]) - && peep2_reg_dead_p (3, operands[0])" + && peep2_reg_dead_p (3, operands[0]) + && (REG_P (operands[1]) + || (MEM_P (operands[1]) + && !mode_dependent_address_p (XEXP (operands[1], 0), + MEM_ADDR_SPACE (operands[1]))) + ) + " [(parallel [(set (reg:CCZ VAX_PSL_REGNUM) (compare:CCZ (match_dup 1) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/elf.h dist/gcc/config/vax/elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/vax/elf.h 2025-11-14 01:50:21 @@ -46,7 +46,9 @@ count pushed by the CALLS and before the start of the saved registers. */ #define INCOMING_FRAME_SP_OFFSET 0 -/* Offset from the frame pointer register value to the top of the stack. */ +/* Offset from the frame pointer register value to the DWARF Canonical Frame + Address. */ +#undef FRAME_POINTER_CFA_OFFSET #define FRAME_POINTER_CFA_OFFSET(FNDECL) 0 /* We use R2-R5 (call-clobbered) registers for exceptions. */ @@ -57,14 +59,14 @@ gen_rtx_MEM (SImode, \ plus_constant (Pmode, \ gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM),\ - -4)) + -1 * UNITS_PER_WORD)) /* Simple store the return handler into the call frame. */ #define EH_RETURN_HANDLER_RTX \ gen_rtx_MEM (Pmode, \ plus_constant (Pmode, \ gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM),\ - 16)) + RETURN_ADDRESS_OFFSET)) /* The VAX wants no space between the case instruction and the jump table. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/netbsd-elf.h dist/gcc/config/vax/netbsd-elf.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/netbsd-elf.h 2025-05-23 13:02:04 +++ dist/gcc/config/vax/netbsd-elf.h 2025-11-14 01:50:21 @@ -43,25 +43,17 @@ #define NETBSD_ENTRY_POINT "__start" #undef LINK_SPEC -#if 0 -/* FIXME: We must link all executables statically until PIC support - is added to the compiler. */ -#define LINK_SPEC \ - "%{assert*} %{R*} %{rpath*} \ - %{shared:%ethe -shared option is not currently supported for VAX ELF} \ - %{!shared: \ - -dc -dp \ - %{!nostdlib: \ - %{!r: \ - %{!e*:-e %(netbsd_entry_point)}}} \ - %{!static:-static} \ - %{static:-static}}" -#else #define LINK_SPEC NETBSD_LINK_SPEC_ELF -#endif -#define EXTRA_SPECS \ - { "netbsd_entry_point", NETBSD_ENTRY_POINT }, +#undef EXTRA_SPECS +#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS +#undef SUBTARGET_EXTRA_SPECS + +#undef INTPTR_TYPE +#define INTPTR_TYPE "long int" + +#undef UINTPTR_TYPE +#define UINTPTR_TYPE "long unsigned int" /* We use gas, not the UNIX assembler. */ #undef TARGET_DEFAULT diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax-protos.h dist/gcc/config/vax/vax-protos.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax-protos.h 2025-05-23 13:02:04 +++ dist/gcc/config/vax/vax-protos.h 2025-11-14 01:50:21 @@ -17,6 +17,8 @@ along with GCC; see the file COPYING3. If not see . */ +#include + extern bool legitimate_constant_address_p (rtx); extern void vax_expand_prologue (void); diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.cc dist/gcc/config/vax/vax.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.cc 2025-05-23 13:02:04 +++ dist/gcc/config/vax/vax.cc 2025-11-14 01:50:21 @@ -46,6 +46,7 @@ #include "target-def.h" static void vax_option_override (void); +static void vax_init_builtins (void); static bool vax_legitimate_address_p (machine_mode, rtx, bool, code_helper = ERROR_MARK); static void vax_file_start (void); @@ -70,6 +71,7 @@ static poly_int64 vax_return_pops_args (tree, tree, poly_int64); static bool vax_mode_dependent_address_p (const_rtx, addr_space_t); static HOST_WIDE_INT vax_starting_frame_offset (void); +static int vax_bitfield_may_trap_p (const_rtx, unsigned); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -83,6 +85,9 @@ #undef TARGET_INIT_LIBFUNCS #define TARGET_INIT_LIBFUNCS vax_init_libfuncs +#undef TARGET_INIT_BUILTINS +#define TARGET_INIT_BUILTINS vax_init_builtins + #undef TARGET_ASM_OUTPUT_MI_THUNK #define TARGET_ASM_OUTPUT_MI_THUNK vax_output_mi_thunk #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK @@ -143,6 +148,9 @@ #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed +#undef TARGET_BITFIELD_MAY_TRAP_P +#define TARGET_BITFIELD_MAY_TRAP_P vax_bitfield_may_trap_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Set global variables as needed for the options enabled. */ @@ -158,8 +166,18 @@ SUBTARGET_OVERRIDE_OPTIONS; #endif } +/* Implement the TARGET_INIT_BUILTINS target hook. */ static void +vax_init_builtins (void) +{ +#ifdef SUBTARGET_INIT_BUILTINS + SUBTARGET_INIT_BUILTINS; +#endif +} + + +static void vax_add_reg_cfa_offset (rtx insn, int offset, rtx src) { rtx x; @@ -191,12 +209,22 @@ if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) mask |= 1 << regno; + if (crtl->calls_eh_return) + { + mask |= 0 + | ( 1 << EH_RETURN_DATA_REGNO(0) ) + | ( 1 << EH_RETURN_DATA_REGNO(1) ) + | ( 1 << EH_RETURN_DATA_REGNO(2) ) + | ( 1 << EH_RETURN_DATA_REGNO(3) ) + ; + } + insn = emit_insn (gen_procedure_entry_mask (GEN_INT (mask))); RTX_FRAME_RELATED_P (insn) = 1; /* The layout of the CALLG/S stack frame is follows: - <- CFA, AP + <- AP r11 r10 ... Registers saved as specified by MASK @@ -206,28 +234,30 @@ old fp old ap old psw - zero - <- FP, SP + condition handler <- CFA, FP, SP + (initially zero) The rest of the prologue will adjust the SP for the local frame. */ - vax_add_reg_cfa_offset (insn, 4, arg_pointer_rtx); - vax_add_reg_cfa_offset (insn, 8, frame_pointer_rtx); - vax_add_reg_cfa_offset (insn, 12, pc_rtx); + vax_add_reg_cfa_offset (insn, 8, arg_pointer_rtx); + vax_add_reg_cfa_offset (insn, 12, frame_pointer_rtx); + vax_add_reg_cfa_offset (insn, 16, pc_rtx); - offset = 16; + offset = 5 * UNITS_PER_WORD; /* PSW, AP &c */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (mask & (1 << regno)) { vax_add_reg_cfa_offset (insn, offset, gen_rtx_REG (SImode, regno)); - offset += 4; + offset += 1 * UNITS_PER_WORD; } /* Because add_reg_note pushes the notes, adding this last means that it will be processed first. This is required to allow the other - notes be interpreted properly. */ + notes to be interpreted properly. */ + /* The RTX here must match the instantiation of the CFA vreg */ add_reg_note (insn, REG_CFA_DEF_CFA, - plus_constant (Pmode, frame_pointer_rtx, offset)); + plus_constant (Pmode, frame_pointer_rtx, + FRAME_POINTER_CFA_OFFSET(current_function_decl))); /* Allocate the local stack frame. */ size = get_frame_size (); @@ -551,7 +581,7 @@ else if (code == 'b' && CONST_INT_P (x)) fprintf (file, "$%d", (int) (0xff & - INTVAL (x))); else if (code == 'M' && CONST_INT_P (x)) - fprintf (file, "$%d", ~((1 << INTVAL (x)) - 1)); + fprintf (file, "$%d", ((unsigned int)(~0) << (INTVAL (x)))); else if (code == 'x' && CONST_INT_P (x)) fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (x)); else if (REG_P (x)) @@ -1677,13 +1707,67 @@ { /* Negation is tricky. It's basically complement and increment. Negate hi, then lo, and subtract the carry back. */ - if ((MEM_P (low[0]) && GET_CODE (XEXP (low[0], 0)) == POST_INC) - || (MEM_P (operands[0]) - && GET_CODE (XEXP (operands[0], 0)) == POST_INC)) - fatal_insn ("illegal operand detected", insn); - output_asm_insn ("mnegl %2,%0", operands); + + /* + * If the source *or* the destination operands are + * indirect memory references with post-increment + * addressing, an memory reference using the base + * register plus an offset must be constructed to + * address the high word of the source or result. + * + * pre-decrement memory references are rejected by the + * illegal_addsub_di_memory_operand predicate + */ + + rtx earlyhiw[3]; + + /* high word - destination */ + if (MEM_P (operands[0]) + && GET_CODE (XEXP (operands[0], 0)) == POST_INC) + { + const enum machine_mode mode = GET_MODE (operands[0]); + rtx x = XEXP (XEXP (operands[0], 0), 0); + x = plus_constant (Pmode, x, GET_MODE_SIZE (mode)); + x = gen_rtx_MEM (mode, x); + earlyhiw[0] = x; + } + else + earlyhiw[0] = operands[0]; + + earlyhiw[1] = operands[1]; /* easy, this is const0_rtx */ + + /* high word - source */ + if (MEM_P (operands[2]) + && GET_CODE (XEXP (operands[2], 0)) == POST_INC) + { + const enum machine_mode mode = GET_MODE (operands[2]); + rtx x = XEXP (XEXP (operands[2], 0), 0); + x = plus_constant (Pmode, x, GET_MODE_SIZE (mode)); + x = gen_rtx_MEM (mode, x); + earlyhiw[2] = x; + } + else + earlyhiw[2] = operands[2]; + + output_asm_insn ("mnegl %2,%0", earlyhiw); output_asm_insn ("mnegl %2,%0", low); - return "sbwc $0,%0"; + + if (earlyhiw[2] != operands[2]) + { + rtx ops[3]; + const enum machine_mode mode = GET_MODE (operands[2]); + + output_asm_insn ("sbwc $0,%0", operands); + /* update the source operand's base register to + point to the following word */ + ops[0] = XEXP (XEXP (operands[2], 0), 0); + ops[1] = const0_rtx; + ops[2] = gen_int_mode (GET_MODE_SIZE (mode), SImode); + output_asm_insn ("addl2 %2,%0", ops); + return ""; + } + else + return "sbwc $0,%0"; } gcc_assert (rtx_equal_p (operands[0], operands[1])); gcc_assert (rtx_equal_p (low[0], low[1])); @@ -1841,7 +1925,6 @@ index_term_p (rtx prod, machine_mode mode, bool strict) { rtx xfoo0, xfoo1; - bool log_p; if (GET_MODE_SIZE (mode) == 1) return BASE_REGISTER_P (prod, strict); @@ -1850,21 +1933,27 @@ || GET_MODE_SIZE (mode) > 8) return false; - log_p = GET_CODE (prod) == ASHIFT; xfoo0 = XEXP (prod, 0); xfoo1 = XEXP (prod, 1); - if (!log_p + if (GET_CODE (prod) == MULT && CONST_INT_P (xfoo0) && GET_MODE_SIZE (mode) == INTVAL (xfoo0) && INDEX_REGISTER_P (xfoo1, strict)) return true; - if (CONST_INT_P (xfoo1) - && GET_MODE_SIZE (mode) == (log_p ? 1 << INTVAL (xfoo1) : INTVAL (xfoo1)) + if (GET_CODE (prod) == MULT + && CONST_INT_P (xfoo1) + && GET_MODE_SIZE (mode) == INTVAL (xfoo1) && INDEX_REGISTER_P (xfoo0, strict)) return true; + if (GET_CODE (prod) == ASHIFT + && CONST_INT_P (xfoo1) + && GET_MODE_SIZE (mode) == (1 << INTVAL (xfoo1)) + && INDEX_REGISTER_P (xfoo0, strict)) + return true; + return false; } @@ -1971,6 +2060,50 @@ } static rtx +decompose_address_operand(rtx addr) +{ + enum rtx_code code = GET_CODE (addr); + + switch (code) + { + case CONST: + return decompose_address_operand (XEXP (addr, 0)); + case PLUS: + case MULT: + { + rtx op0, op1; + rtx temp; + /* + * Generate a temporary register, assign the result of + * decomposing op0 to it, then generate an op code opping (PLUS + * or MULT) the result of decomposing op1 to it. + * Return the temporary register. + */ + temp = gen_reg_rtx (Pmode); + op0 = decompose_address_operand (XEXP (addr, 0)); + op1 = decompose_address_operand (XEXP (addr, 1)); + + emit_move_insn (temp, op0); + + if (code == PLUS) + { + temp = gen_rtx_PLUS (Pmode, temp, op1); + } + else if (code == MULT) + { + temp = gen_rtx_MULT (Pmode, temp, op1); + } + + return temp; + } + break; + default: + break; + } + return addr; +} + +static rtx fixup_mathdi_operand (rtx x, machine_mode mode) { if (illegal_addsub_di_memory_operand (x, mode)) @@ -1985,7 +2118,7 @@ addr = XEXP (XEXP (addr, 0), 0); } #endif - emit_move_insn (temp, addr); + emit_move_insn (temp, decompose_address_operand (addr)); if (offset) temp = gen_rtx_PLUS (Pmode, temp, offset); x = gen_rtx_MEM (DImode, temp); @@ -2213,3 +2346,33 @@ return TARGET_ELF ? -4 : 0; } +/* Return 1 if a bitfield instruction (extv/extzv) may trap */ +static int +vax_bitfield_may_trap_p (const_rtx x, unsigned flags) +{ + /* per the VARM + * Bitfield instructions may trap if + * size (arg1) GTRU 32 + * size (arg1) NEQ 0, pos (arg 2) GTRU 31 and the field is in a register + * i.e. REG_P(operands[0]) is true + * + * GCC can only determine that a bitfield instruction will not trap + * if the size and position arguments are constants; if they aren't, + * the instruction must be assumed to trap. + */ + rtx field = XEXP (x, 0); + rtx size = XEXP (x, 1); + rtx pos = XEXP (x, 2); + int retval = 0; + + if (!CONST_INT_P (size) || !CONST_INT_P (pos)) + retval = 1; + else if (INTVAL (size) < 0 || INTVAL (size) > GET_MODE_BITSIZE ( SImode )) + retval = 1; + else if (REG_P (field) && INTVAL (size) != 0 + && (INTVAL (pos) < 0 || INTVAL (pos) >= GET_MODE_BITSIZE ( SImode ))) + retval = 1; + else + retval = 0; + return retval; +} diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.h dist/gcc/config/vax/vax.h --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.h 2025-05-23 13:02:04 +++ dist/gcc/config/vax/vax.h 2025-11-14 01:50:21 @@ -17,6 +17,7 @@ along with GCC; see the file COPYING3. If not see . */ +#include "vax-protos.h" /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.md dist/gcc/config/vax/vax.md --- /Users/io/Downloads/gcc-14.3.0/gcc/config/vax/vax.md 2025-05-23 13:02:04 +++ dist/gcc/config/vax/vax.md 2025-11-14 01:50:21 @@ -30,6 +30,8 @@ ; insn in the code. VUNSPEC_SYNC_ISTREAM ; sequence of insns to sync the I-stream VUNSPEC_PEM ; 'procedure_entry_mask' insn. + + VUNSPEC_EH_RETURN ]) ;; UNSPEC usage: @@ -272,6 +274,28 @@ #endif }") +;; Split a store of the upper half of a 64 bit value in memory into +;; two operations. +(define_split + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (subreg:SI + (match_operand:DI 1 "indexed_memory_operand" "") + 4 + ) + ) + (clobber (match_scratch:DI 2 "")) + ] + "" + [ + (set (match_dup 2) + (match_dup 1) + ) + (set (match_dup 0) + (subreg:SI (match_dup 2) 4) + ) + ] +) + (define_insn_and_split "movsi_2" [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:SI 1 "nonsymbolic_operand" "nrmT"))] @@ -728,6 +752,29 @@ (clobber (reg:CC VAX_PSL_REGNUM))])] "") +;; special case for known constant source operand +(define_insn_and_split "*float2" + [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g") + (float:VAXfp (match_operand:VAXint 1 "const_int_operand" "n"))) + ] + "" + "#" + "reload_completed" + [(parallel + [(set (match_dup 0) + (match_dup 2)) + (clobber (reg:CC VAX_PSL_REGNUM))])] + " +{ + const enum machine_mode m = GET_MODE(operands[0]); + HOST_WIDE_INT i = INTVAL(operands[1]); + REAL_VALUE_TYPE r; + + real_from_integer(&r, m, i, SIGNED); + operands[2] = const_double_from_real_value(r, m); +}") + + (define_insn "*float2" [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g") (float:VAXfp (match_operand:VAXint 1 "nonimmediate_operand" "g"))) @@ -932,7 +979,7 @@ "vax_expand_addsub_di_operands (operands, MINUS); DONE;") (define_insn_and_split "sbcdi3" - [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=Rr,Rr") + [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=&Rr,&Rr") (minus:DI (match_operand:DI 1 "general_addsub_di_operand" "0,I") (match_operand:DI 2 "general_addsub_di_operand" "nRr,Rr")))] "TARGET_QMATH" @@ -946,7 +993,7 @@ "") (define_insn "*sbcdi3" - [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=Rr,Rr") + [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=&Rr,&Rr") (minus:DI (match_operand:DI 1 "general_addsub_di_operand" "0,I") (match_operand:DI 2 "general_addsub_di_operand" "nRr,Rr"))) (clobber (reg:CC VAX_PSL_REGNUM))] @@ -1998,7 +2045,14 @@ if (INTVAL (operands[3]) & 31) return \"rotl %R3,%1,%0\;bicl2 %M2,%0\"; if (rtx_equal_p (operands[0], operands[1])) - return \"bicl2 %M2,%0\"; + { + if (INTVAL (operands[2]) == 32) + return \"\"; /* no-op */ + else + return \"bicl2 %M2,%0\"; + } + if (INTVAL (operands[2]) == 32) + return \"movl %1,%0\"; return \"bicl3 %M2,%1,%0\"; }") @@ -2830,6 +2884,36 @@ DONE; }") +;; Exception handling +;; This is used when compiling the stack unwinding routines. +(define_expand "eh_return" + [(use (match_operand 0 "general_operand"))] + "" +{ + if (GET_MODE (operands[0]) != word_mode) + operands[0] = convert_to_mode (word_mode, operands[0], 0); + emit_insn (gen_eh_set_retaddr (operands[0])); + DONE; +}) + +(define_insn_and_split "eh_set_retaddr" + [(unspec [(match_operand:SI 0 "general_operand")] VUNSPEC_EH_RETURN) + (clobber (match_scratch:SI 1 "=&r")) + ] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + rtx tmp = RETURN_ADDR_RTX(0, frame_pointer_rtx); + MEM_VOLATILE_P(tmp) = 1; + tmp = gen_rtx_SET(tmp, operands[0]); + emit_insn(tmp); + DONE; +}) + + + (define_insn "nop" [(const_int 0)] "" @@ -2909,7 +2993,7 @@ "#" "reload_completed" [(parallel - [(match_dup 1) + [(use (match_dup 1)) (set (pc) (plus:SI (sign_extend:SI (mem:HI (plus:SI @@ -2918,11 +3002,13 @@ (const_int 2)) (pc)))) (label_ref:SI (match_dup 2)))) - (clobber (reg:CC VAX_PSL_REGNUM))])] + (clobber (reg:CC VAX_PSL_REGNUM)) + (use (label_ref:SI (match_dup 2))) + ])] "") (define_insn "*casesi1" - [(match_operand:SI 1 "const_int_operand" "n") + [(use (match_operand:SI 1 "const_int_operand" "n")) (set (pc) (plus:SI (sign_extend:SI (mem:HI (plus:SI @@ -2931,7 +3017,9 @@ (const_int 2)) (pc)))) (label_ref:SI (match_operand 2 "" "")))) - (clobber (reg:CC VAX_PSL_REGNUM))] + (clobber (reg:CC VAX_PSL_REGNUM)) + (use (label_ref:SI (match_dup 2))) + ] "reload_completed" "casel %0,$0,%1") diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config.gcc dist/gcc/config.gcc --- /Users/io/Downloads/gcc-14.3.0/gcc/config.gcc 2025-05-23 13:02:04 +++ dist/gcc/config.gcc 2025-11-14 01:50:21 @@ -469,6 +469,16 @@ cpu_type=m32r extra_options="${extra_options} g.opt" ;; +m5200-*-*|m5407-*-*) + cpu_type=m68k + extra_headers=math-68881.h + extra_options="${extra_options} m68k/m68k-tables.opt" + ;; +m680[012]0-*-*) + cpu_type=m68k + extra_headers=math-68881.h + extra_options="${extra_options} m68k/m68k-tables.opt" + ;; m68k-*-*) extra_headers=math-68881.h extra_options="${extra_options} m68k/m68k-tables.opt" @@ -981,6 +991,11 @@ case ${enable_threads} in "" | yes | posix) thread_file='posix' ;; esac + case ${target} in + arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*) + default_gnu_indirect_function=yes + ;; + esac nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h" default_use_cxa_atexit=yes target_has_targetdm=yes @@ -1238,6 +1253,11 @@ tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h" tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + case $target in + aarch64_be-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac ;; aarch64*-*-linux*) tm_file="${tm_file} elfos.h gnu-user.h linux.h glibc-stdint.h" @@ -1385,7 +1405,6 @@ with_tls=${with_tls:-gnu} ;; arm*-*-netbsdelf*) - target_cpu_cname="strongarm" tmake_file="${tmake_file} arm/t-arm" tm_file="elfos.h ${nbsd_tm_file} arm/elf.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" @@ -1394,26 +1413,33 @@ esac case ${target} in arm*-*-netbsdelf-*eabi*) - tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h" - tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi" + tm_file="${tm_file} arm/netbsd-elf.h arm/bpabi.h arm/netbsd-eabi.h" + # GCC 7 vs NetBSD/eabi -> avoid arm unwinder + #tmake_file="$tmake_file arm/t-bpabi" + tmake_file="$tmake_file arm/t-netbsdeabi" + # The EABI requires the use of __cxa_atexit. + default_use_cxa_atexit=yes ;; *) - tm_file="$tm_file arm/netbsd-elf.h" + tm_file="$tm_file arm/netbsd-elf.h arm/bpabi.h" + #tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi" tmake_file="$tmake_file arm/t-netbsd" ;; esac tm_file="${tm_file} arm/aout.h arm/arm.h" case ${target} in arm*-*-netbsdelf-*eabihf*) - # Hard-float requires at least Arm v5te - target_cpu_cname="arm10e" tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD" ;; esac case ${target} in - armv6*) target_cpu_cname="arm1176jzf-s";; - armv7*) target_cpu_cname="generic-armv7-a";; + armv4*) with_cpu=${with_cpu:-strongarm};; + armv6*) with_cpu=${with_cpu:-arm1176jzf-s};; + armv7*) with_cpu=${with_cpu:-cortex-a8};; + arm*eabihf*) with_cpu=${with_cpu:-arm10e};; + arm*) with_cpu=${with_cpu:-arm9e};; esac + target_cpu_cname="$with_cpu" ;; arm*-*-linux-* | arm*-*-uclinuxfdpiceabi) tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" @@ -1965,6 +1991,7 @@ ;; x86_64-*-netbsd*) tm_file="${tm_file} i386/unix.h i386/att.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h" + tmake_file="${tmake_file} i386/t-netbsd64" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ;; i[34567]86-*-openbsd*) @@ -2301,6 +2328,16 @@ target_cpu_default="${target_cpu_default}|MASK_GNU_LD" fi ;; +ia64*-*-netbsd*) + tm_file="${tm_file} elfos.h ${nbsd_tm_file} ia64/sysv4.h ia64/netbsd.h" + target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" + tmake_file="${tmake_file} ia64/t-ia64" + if test x$with_system_libunwind != xyes ; then + tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind" + fi + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; ia64*-*-freebsd*) tm_file="${tm_file} elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h" target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" @@ -2397,8 +2434,25 @@ ;; esac ;; -m68k*-*-netbsdelf*) +m68010-*-netbsdelf* | m68k-*-netbsdelf* | m5407-*-netbsdelf*) default_m68k_cpu=68020 + case ${target} in + m5407*) + with_arch=${with_arch:-cf} + target_cpu_default="mcf5475" +# target="`echo ${target} | sed 's/m68kcf/m68k/'`" + ;; + m68010*) + target_cpu_default="m68010" + tmake_file="${tmake_file} m68k/t-m68kelf m68k/t-m68010-netbsd" + default_m68k_cpu=68010 + tmake_file="${tmake_file} m68k/t-floatlib" + ;; + *) + with_arch=${with_arch:-m68k} + tmake_file="${tmake_file} m68k/t-floatlib" + ;; + esac default_cf_cpu=5475 tm_file="${tm_file} elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" @@ -2547,6 +2601,19 @@ gcc_cv_initfini_array=yes with_tls=${with_tls:-trad} ;; +riscv*-*-netbsd*) # NetBSD RISC-V + tm_file="elfos.h ${tm_file} ${nbsd_tm_file} riscv/netbsd.h" + tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1" + case ${target} in + riscv32*) tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=0" ;; + *) tmake_file="${tmake_file} riscv/t-netbsd64" ;; + esac + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} riscv/t-riscv" + gnu_ld=yes + gas=yes + gcc_cv_initfini_array=yes + ;; loongarch*-*-linux*) tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}" @@ -2564,6 +2631,21 @@ gcc_cv_initfini_array=yes ;; +mipsn64*-*-netbsd*) # NetBSD/mips64, either endian. + target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI" + tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h" + tmake_file="${tmake_file} mips/t-netbsd64" + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; +mips64*-*-netbsd*) # NetBSD/mips64, either endian. + target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI" + tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h" + tmake_file="${tmake_file} mips/t-netbsd64" + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; + loongarch*-*-elf*) tm_file="elfos.h newlib-stdint.h ${tm_file}" tm_file="${tm_file} loongarch/elf.h loongarch/linux.h loongarch/loongarch-driver.h" @@ -3001,11 +3083,24 @@ ;; esac ;; -powerpc-*-netbsd*) - tm_file="${tm_file} elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h" +powerpc*-*-netbsd*) + tm_file="${tm_file} elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h" + case ${target} in + powerpc64*) + tm_file="rs6000/biarch64.h ${tm_file}" + tm_file="${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h" + tmake_file="${tmake_file} rs6000/t-netbsd64" + ;; + *) + tm_file="${tm_file} rs6000/sysv4.h rs6000/netbsd.h" + tmake_file="${tmake_file} rs6000/t-netbsd" + ;; + esac extra_options="${extra_options} netbsd.opt netbsd-elf.opt" - tmake_file="${tmake_file} rs6000/t-netbsd" - extra_options="${extra_options} rs6000/sysv4.opt" + extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt" + if test x${enable_secureplt} != xno; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi ;; powerpc-*-eabisimaltivec*) tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h" @@ -3510,9 +3605,11 @@ sparc64-*-netbsd*) tm_file="sparc/biarch64.h ${tm_file}" tm_file="${tm_file} elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h" + tm_file="${tm_file} sparc/default64.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" extra_options="${extra_options} sparc/long-double-switch.opt" tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64" + with_cpu=ultrasparc ;; sparc64-*-openbsd*) tm_file="sparc/openbsd1-64.h ${tm_file} elfos.h sparc/sysv4.h sparc/sp64-elf.h" @@ -4019,6 +4116,9 @@ frv550-*-*linux*) with_cpu=fr550 ;; + m5200-*-*|m5407-*-*) + with_cpu=${default_cf_cpu} + ;; m68k*-*-*) case "$with_arch" in "cf") @@ -4526,7 +4626,7 @@ esac ;; - fido-*-* | m68k*-*-*) + fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*) supported_defaults="arch cpu" case "$with_arch" in "" | "m68k"| "cf") diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/config.host dist/gcc/config.host --- /Users/io/Downloads/gcc-14.3.0/gcc/config.host 2025-05-23 13:02:04 +++ dist/gcc/config.host 2025-11-14 01:50:21 @@ -100,7 +100,7 @@ case ${host} in aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ - aarch64*-*-darwin*) + aarch64*-*-darwin* | aarch64*-*-netbsd*) case ${target} in aarch64*-*-*) host_extra_gcc_objs="driver-aarch64.o" @@ -274,6 +274,7 @@ *-*-openbsd*) out_host_hook_obj=host-openbsd.o host_xmake_file="${host_xmake_file} x-openbsd" + host_lto_plugin_soname=liblto_plugin.so.0.0 ;; *-*-netbsd*) out_host_hook_obj=host-netbsd.o diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/configure dist/gcc/configure --- /Users/io/Downloads/gcc-14.3.0/gcc/configure 2025-05-23 13:02:04 +++ dist/gcc/configure 2025-11-14 01:50:21 @@ -3398,15 +3398,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done @@ -7955,7 +7955,7 @@ else case $target in - aarch64* | \ + aarch64*-*-linux* | \ powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ @@ -26690,7 +26690,7 @@ test $ac_status = 0; }; } then -if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \ +if $gcc_cv_readelf --debug-dump=frames conftest.o 2>/dev/null \ | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then gcc_cv_as_cfi_advance_working=yes fi @@ -27494,7 +27494,7 @@ .text call #gettlsoff(x)' ;; - hppa*-*-linux*) + hppa*-*-linux* | hppa*-*-netbsd*) conftest_s=' t1: .reg %r20 t2: .reg %r21 @@ -27647,7 +27647,7 @@ addiu $4, $4, %tprel_lo(x)' tls_as_opt='-32 --fatal-warnings' ;; - m68k-*-*) + m68k-*-*|m5407-*-*) conftest_s=' .section .tdata,"awT",@progbits x: @@ -27801,7 +27801,7 @@ brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' tls_as_opt="-m64 -Aesame --fatal-warnings" ;; - sh-*-* | sh[123456789lbe]*-*-*) + sh-*-* | sh[34]-*-* | sh*l*-*-*) conftest_s=' .section ".tdata","awT",@progbits foo: .long 25 @@ -33116,12 +33116,12 @@ esac case "$target:$tm_file" in - powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) + powerpc64*-*-freebsd* | powerpc64-*-netbsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) case "$target" in *le-*-linux*) emul_name="-melf64lppc" ;; - *-*-linux*) + *-*-linux* | *-*-netbsd*) emul_name="-melf64ppc" ;; *le-*-freebsd*) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/configure.ac dist/gcc/configure.ac --- /Users/io/Downloads/gcc-14.3.0/gcc/configure.ac 2025-05-23 13:02:04 +++ dist/gcc/configure.ac 2025-11-14 01:50:21 @@ -3409,7 +3409,7 @@ .cfi_adjust_cfa_offset 128 .cfi_endproc], [[ -if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \ +if $gcc_cv_readelf --debug-dump=frames conftest.o 2>/dev/null \ | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then gcc_cv_as_cfi_advance_working=yes fi @@ -3837,7 +3837,7 @@ .text call #gettlsoff(x)' ;; - hppa*-*-linux*) + hppa*-*-linux* | hppa*-*-netbsd*) conftest_s=' t1: .reg %r20 t2: .reg %r21 @@ -3991,7 +3991,7 @@ addiu $4, $4, %tprel_lo(x)' tls_as_opt='-32 --fatal-warnings' ;; - m68k-*-*) + m68k-*-* | m5407-*-*) conftest_s=' .section .tdata,"awT",@progbits x: @@ -4145,7 +4145,7 @@ brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' tls_as_opt="-m64 -Aesame --fatal-warnings" ;; - sh-*-* | sh[123456789lbe]*-*-*) + sh-*-* | sh[34]-*-* | sh*l*-*-*) conftest_s=' .section ".tdata","awT",@progbits foo: .long 25 @@ -6733,12 +6733,12 @@ esac case "$target:$tm_file" in - powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) + powerpc64*-*-freebsd* | powerpc64-*-netbsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) case "$target" in *le-*-linux*) emul_name="-melf64lppc" ;; - *-*-linux*) + *-*-linux* | *-*-netbsd*) emul_name="-melf64ppc" ;; *le-*-freebsd*) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/cp/Make-lang.in dist/gcc/cp/Make-lang.in --- /Users/io/Downloads/gcc-14.3.0/gcc/cp/Make-lang.in 2025-05-23 13:02:04 +++ dist/gcc/cp/Make-lang.in 2025-11-14 01:50:21 @@ -137,7 +137,7 @@ else \ build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(CODYLIB) $(LIBDEPS) \ checksum-options > cc1plus-checksum.cc.tmp && \ - $(srcdir)/../move-if-change cc1plus-checksum.cc.tmp cc1plus-checksum.cc; \ + $(SHELL) $(srcdir)/../move-if-change cc1plus-checksum.cc.tmp cc1plus-checksum.cc; \ fi cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(CODYLIB) $(LIBDEPS) $(c++.prev) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/cppbuiltin.cc dist/gcc/cppbuiltin.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/cppbuiltin.cc 2025-05-23 13:02:04 +++ dist/gcc/cppbuiltin.cc 2025-11-14 01:50:21 @@ -96,6 +96,12 @@ if (flag_sanitize & SANITIZE_HWADDRESS) cpp_define (pfile, "__SANITIZE_HWADDRESS__"); + if (flag_sanitize & SANITIZE_UNDEFINED) + cpp_define (pfile, "__SANITIZE_UNDEFINED__"); + + if (flag_sanitize & SANITIZE_LEAK) + cpp_define (pfile, "__SANITIZE_LEAK__"); + if (flag_sanitize & SANITIZE_THREAD) cpp_define (pfile, "__SANITIZE_THREAD__"); diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/cppdefault.cc dist/gcc/cppdefault.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/cppdefault.cc 2025-05-23 13:02:04 +++ dist/gcc/cppdefault.cc 2025-11-14 01:50:21 @@ -61,8 +61,12 @@ GPLUSPLUS_LIBCXX_INCLUDE_DIR_ADD_SYSROOT, 0 }, #endif #ifdef GCC_INCLUDE_DIR +#ifndef GCC_INCLUDE_DIR_ADD_SYSROOT +#define GCC_INCLUDE_DIR_ADD_SYSROOT 0 +#endif /* This is the dir for gcc's private headers. */ - { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, + { GCC_INCLUDE_DIR, "GCC", 0, 0, + GCC_INCLUDE_DIR_ADD_SYSROOT, 0 }, #endif #ifdef LOCAL_INCLUDE_DIR /* /usr/local/include comes before the fixincluded header files. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/dse.cc dist/gcc/dse.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/dse.cc 2025-05-23 13:02:04 +++ dist/gcc/dse.cc 2025-11-14 01:50:21 @@ -301,9 +301,23 @@ /* Return a bitmask with the first N low bits set. */ static unsigned HOST_WIDE_INT +#ifdef NB_FIX_VAX_BACKEND +lowpart_bitmask (unsigned int n) +#else lowpart_bitmask (int n) +#endif { unsigned HOST_WIDE_INT mask = HOST_WIDE_INT_M1U; +#ifdef NB_FIX_VAX_BACKEND + if (n < 1) + return 0; + if (n >= HOST_BITS_PER_WIDE_INT) + return mask; +#else // XXXMRG + gcc_assert(n >= 0 && n <= HOST_BITS_PER_WIDE_INT); + if (n == 0) + return 0; +#endif return mask >> (HOST_BITS_PER_WIDE_INT - n); } @@ -1339,6 +1353,10 @@ return false; return true; } +#ifdef NB_FIX_VAX_BACKEND + else if (const_start >= HOST_BITS_PER_WIDE_INT || const_start < 0) + return true; +#endif else { unsigned HOST_WIDE_INT mask diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/expr.cc dist/gcc/expr.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/expr.cc 2025-05-23 13:02:04 +++ dist/gcc/expr.cc 2025-11-14 01:50:21 @@ -5292,7 +5292,8 @@ int overlapping = 0; if (mode == BLKmode - || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode))) + || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode) + && type != NULL_TREE)) { /* Copy a block into the stack, entirely or partially. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/file-prefix-map.cc dist/gcc/file-prefix-map.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/file-prefix-map.cc 2025-05-23 13:02:04 +++ dist/gcc/file-prefix-map.cc 2025-11-14 01:50:21 @@ -41,7 +41,8 @@ add_prefix_map (file_prefix_map *&maps, const char *arg, const char *opt) { file_prefix_map *map; - const char *p; + const char *p, *old; + size_t oldlen; /* Note: looking for the last '='. The thinking is we can control the paths inside our projects but not where the users build them. */ @@ -51,10 +52,29 @@ error ("invalid argument %qs to %qs", arg, opt); return; } + if (*arg == '$') + { + char *env = xstrndup (arg + 1, p - (arg + 1)); + old = getenv(env); + if (!old) + { + warning (0, "environment variable %qs not set in argument to " + "%s", env, opt); + free(env); + return; + } + oldlen = strlen(old); + free(env); + } + else + { + old = xstrndup (arg, p - arg); + oldlen = p - arg; + } map = XNEW (file_prefix_map); map->canonicalize = flag_canon_prefix_map; - map->old_prefix = xstrndup (arg, p - arg); - map->old_len = p - arg; + map->old_prefix = old; + map->old_len = oldlen; if (map->canonicalize) { char *realname = lrealpath (map->old_prefix); @@ -166,12 +186,126 @@ return remap_filename (macro_prefix_maps, filename); } +/* Original GCC version disabled. The NetBSD version handles regex */ +#if 0 /* Remap using -fdebug-prefix-map. Return the GC-allocated new name corresponding to FILENAME or FILENAME if no remapping was performed. */ const char * remap_debug_filename (const char *filename) { return remap_filename (debug_prefix_maps, filename); +} +#endif + +/***** + ***** The following code is a NetBSD extension that allows regex and + ***** \[0-9] substitutition arguments. + *****/ + +/* Perform user-specified mapping of debug filename prefixes. Return + the new name corresponding to FILENAME. */ + +static const char * +remap_debug_prefix_filename (const char *filename) +{ + file_prefix_map *map; + char *s; + const char *name; + size_t name_len; + + for (map = debug_prefix_maps; map; map = map->next) + if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) + break; + if (!map) + return filename; + name = filename + map->old_len; + name_len = strlen (name) + 1; + s = (char *) alloca (name_len + map->new_len); + memcpy (s, map->new_prefix, map->new_len); + memcpy (s + map->new_len, name, name_len); + return ggc_strdup (s); +} + +#include + +typedef struct debug_regex_map +{ + regex_t re; + const char *sub; + struct debug_regex_map *next; +} debug_regex_map; + +/* Linked list of such structures. */ +debug_regex_map *debug_regex_maps; + + +/* Record a debug file regex mapping. ARG is the argument to + -fdebug-regex-map and must be of the form OLD=NEW. */ + +void +add_debug_regex_map (const char *arg) +{ + debug_regex_map *map; + const char *p; + char *old; + char buf[1024]; + regex_t re; + int e; + + p = strchr (arg, '='); + if (!p) + { + error ("invalid argument %qs to -fdebug-regex-map", arg); + return; + } + + old = xstrndup (arg, p - arg); + if ((e = regcomp(&re, old, REG_EXTENDED)) != 0) + { + regerror(e, &re, buf, sizeof(buf)); + warning (0, "regular expression compilation for %qs in argument to " + "-fdebug-regex-map failed: %qs", old, buf); + free(old); + return; + } + free(old); + + map = XNEW (debug_regex_map); + map->re = re; + p++; + map->sub = xstrdup (p); + map->next = debug_regex_maps; + debug_regex_maps = map; +} + +extern "C" ssize_t regasub(char **, const char *, + const regmatch_t *rm, const char *); + +/* Perform user-specified mapping of debug filename regular expressions. Return + the new name corresponding to FILENAME. */ + +static const char * +remap_debug_regex_filename (const char *filename) +{ + debug_regex_map *map; + char *s; + regmatch_t rm[10]; + + for (map = debug_regex_maps; map; map = map->next) + if (regexec (&map->re, filename, 10, rm, 0) == 0 + && regasub (&s, map->sub, rm, filename) >= 0) + { + const char *name = ggc_strdup(s); + free(s); + return name; + } + return filename; +} + +const char * +remap_debug_filename (const char *filename) +{ + return remap_debug_regex_filename (remap_debug_prefix_filename (filename)); } /* Remap using -fprofile-prefix-map. Return the GC-allocated new name diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/file-prefix-map.h dist/gcc/file-prefix-map.h --- /Users/io/Downloads/gcc-14.3.0/gcc/file-prefix-map.h 2025-05-23 13:02:04 +++ dist/gcc/file-prefix-map.h 2025-11-14 01:50:21 @@ -22,6 +22,7 @@ void add_debug_prefix_map (const char *); void add_file_prefix_map (const char *); void add_profile_prefix_map (const char *); +void add_debug_regex_map (const char *); extern bool flag_canon_prefix_map; const char *remap_macro_filename (const char *); diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/function.cc dist/gcc/function.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/function.cc 2025-05-23 13:02:04 +++ dist/gcc/function.cc 2025-11-14 01:50:21 @@ -1725,6 +1725,26 @@ break; case SUBREG: +#ifdef NB_FIX_VAX_BACKEND + if (MEM_P (XEXP (x, 0))) + { + /* convert a subreg of a MEMORY operand into a + register operand */ + rtx mx = XEXP (x, 0); /* memory operand */ + rtx addr = XEXP (mx, 0); + instantiate_virtual_regs_in_rtx (&addr); + start_sequence (); + mx = replace_equiv_address (mx, addr, true); + addr = force_reg (GET_MODE (addr), addr); + mx = replace_equiv_address (mx, addr, true); + seq = get_insns (); + end_sequence (); + if (seq) + emit_insn_before (seq, insn); + /* generate a new subreg expression */ + x = gen_rtx_SUBREG (GET_MODE (x), mx, SUBREG_BYTE (x)); + } +#endif new_rtx = instantiate_new_reg (SUBREG_REG (x), &offset); if (new_rtx == NULL) continue; @@ -1830,6 +1850,15 @@ instantiate_decl_rtl (XEXP (x, 1)); return; } + +#ifdef NB_FIX_VAX_BACKEND + /* If this is a SUBREG, recurse for the pieces */ + if (GET_CODE (x) == SUBREG) + { + instantiate_decl_rtl (XEXP (x, 0)); + return; + } +#endif /* If this is not a MEM, no need to do anything. Similarly if the address is a constant or a register that is not a virtual register. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/gcc.cc dist/gcc/gcc.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/gcc.cc 2025-05-23 13:02:04 +++ dist/gcc/gcc.cc 2025-11-14 01:50:21 @@ -1099,23 +1099,23 @@ /* Linker command line options for -fsanitize= early on the command line. */ #ifndef SANITIZER_EARLY_SPEC #define SANITIZER_EARLY_SPEC "\ -%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ +%{!shared:%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ %{%:sanitize(hwaddress):" LIBHWASAN_EARLY_SPEC "} \ %{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \ - %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}" + %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}}" #endif /* Linker command line options for -fsanitize= late on the command line. */ #ifndef SANITIZER_SPEC #define SANITIZER_SPEC "\ -%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ +%{!shared:%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}}\ %{%:sanitize(hwaddress):" LIBHWASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=hwaddress}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=thread}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}\ - %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}" + %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}}" #endif #ifndef POST_LINK_SPEC @@ -4797,6 +4797,10 @@ /* FIXME: make_relative_prefix doesn't yet work for VMS. */ if (!gcc_exec_prefix) { +#ifdef NETBSD_NATIVE + add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC", + PREFIX_PRIORITY_LAST, 0, 0); +#else gcc_exec_prefix = get_relative_prefix (decoded_options[0].arg, standard_bindir_prefix, standard_exec_prefix); @@ -4805,6 +4809,7 @@ standard_libexec_prefix); if (gcc_exec_prefix) xputenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL)); +#endif } else { @@ -8491,6 +8496,7 @@ spec_machine_suffix = just_machine_suffix; #endif +#ifndef NETBSD_NATIVE /* We need to check standard_exec_prefix/spec_machine_suffix/specs for any override of as, ld and libraries. */ specs_file = (char *) alloca (strlen (standard_exec_prefix) @@ -8500,6 +8506,7 @@ strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) read_specs (specs_file, true, false); +#endif /* Process any configure-time defaults specified for the command line options, via OPTION_DEFAULT_SPECS. */ @@ -8595,14 +8602,17 @@ PREFIX_PRIORITY_LAST, 0, 1); else if (*cross_compile == '0') { +#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS) add_prefix (&startfile_prefixes, concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix, machine_suffix, standard_startfile_prefix, NULL), NULL, PREFIX_PRIORITY_LAST, 0, 1); +#endif /* NETBSD_NATIVE */ } +#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS) /* Sysrooted prefixes are relocated because target_system_root is also relocated by gcc_exec_prefix. */ if (*standard_startfile_prefix_1) @@ -8613,6 +8623,7 @@ add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1); +#endif /* NETBSD_NATIVE */ } /* Process any user specified specs in the order given on the command diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/genemit.cc dist/gcc/genemit.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/genemit.cc 2025-05-23 13:02:04 +++ dist/gcc/genemit.cc 2025-11-14 01:50:21 @@ -187,7 +187,9 @@ else { fprintf (file, "GEN_INT ("); - fprintf (file, HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x)); + fprintf (file, "HOST_WIDE_INT_C ("); + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); + fprintf (file, ")"); fprintf (file, ")"); } return; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/genmultilib dist/gcc/genmultilib --- /Users/io/Downloads/gcc-14.3.0/gcc/genmultilib 2025-05-23 13:02:04 +++ dist/gcc/genmultilib 2025-11-14 01:50:21 @@ -154,8 +154,10 @@ # Since not all versions of sh support functions, we achieve recursion # by creating a temporary shell script which invokes itself. rm -f tmpmultilib -cat >tmpmultilib <<\EOF -#!/bin/sh +cat >tmpmultilib <>tmpmultilib <<\EOF # This recursive script basically outputs all combinations of its # input arguments, handling mutually exclusive sets of options by # repetition. When the script is called, ${initial} is the list of @@ -190,8 +192,10 @@ # If there exceptions, weed them out now if [ -n "${exceptions}" ]; then - cat >tmpmultilib2 <<\EOF -#!/bin/sh + cat >tmpmultilib2 <>tmpmultilib2 <<\EOF # This recursive script weeds out any combination of multilib # switches that should not be generated. The output looks like # a list of subdirectory names with leading and trailing slashes. @@ -338,8 +342,10 @@ # opt1/opt2 nopt1 nopt2 # In other words, we must output all combinations of matches. rm -f tmpmultilib2 -cat >tmpmultilib2 <<\EOF -#!/bin/sh +cat >tmpmultilib2 <>tmpmultilib2 <<\EOF # The positional parameters are a list of matches to consider. # ${dirout} is the directory name and ${optout} is the current list of # options. diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/genrecog.cc dist/gcc/genrecog.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/genrecog.cc 2025-05-23 13:02:04 +++ dist/gcc/genrecog.cc 2025-11-14 01:50:21 @@ -4526,9 +4526,9 @@ { uint64_t min = uint64_t (1) << (HOST_BITS_PER_WIDE_INT - 1); if (val == min) - printf ("(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1); + printf ("( HOST_WIDE_INT_C (" HOST_WIDE_INT_PRINT_DEC ") - 1)", val + 1); else - printf (HOST_WIDE_INT_PRINT_DEC_C, val); + printf (" HOST_WIDE_INT_C (" HOST_WIDE_INT_PRINT_DEC ")", val); } /* Print the C expression for actual parameter PARAM. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/ggc-common.cc dist/gcc/ggc-common.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/ggc-common.cc 2025-05-23 13:02:04 +++ dist/gcc/ggc-common.cc 2025-11-14 01:50:21 @@ -748,6 +748,8 @@ size_t i; struct mmap_info mmi; int result; + struct line_maps * old_line_table = line_table; + location_t old_input_loc = input_location; /* We are about to reload the line maps along with the rest of the PCH data, which means that the (loaded) ones cannot be guaranteed to be @@ -767,7 +769,11 @@ for (rt = gt_pch_scalar_rtab; *rt; rt++) for (rti = *rt; rti->base != NULL; rti++) if (fread (rti->base, rti->stride, 1, f) != 1) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } /* Read in all the global pointers, in 6 easy loops. */ bool error_reading_pointers = false; @@ -786,7 +792,11 @@ fatal_error (input_location, "cannot read PCH file: %m"); if (fread (&mmi, sizeof (mmi), 1, f) != 1) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } void *orig_preferred_base = mmi.preferred_base; result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size, @@ -796,6 +806,8 @@ address needed. */ if (result < 0) { + line_table = old_line_table; + input_location = old_input_loc; sorry_at (input_location, "PCH allocation failure"); /* There is no point in continuing from here, we will only end up with a crashed (most likely hanging) compiler. */ @@ -809,14 +821,26 @@ { if (fseek (f, mmi.offset, SEEK_SET) != 0 || fread (mmi.preferred_base, mmi.size, 1, f) != 1) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } } else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } size_t reloc_addrs_size; if (fread (&reloc_addrs_size, sizeof (reloc_addrs_size), 1, f) != 1) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } if (orig_preferred_base != mmi.preferred_base) { @@ -851,7 +875,11 @@ = MIN (reloc_addrs_size, (size_t) (4096 - (uleb128_ptr - uleb128_buf))); if (fread (uleb128_ptr, 1, this_size, f) != this_size) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } unsigned char *uleb128_end = uleb128_ptr + this_size; if (this_size != reloc_addrs_size) uleb128_end -= 2 * sizeof (size_t); @@ -888,7 +916,11 @@ unsigned num_callbacks; if (fread (&pch_save, sizeof (pch_save), 1, f) != 1 || fread (&num_callbacks, sizeof (num_callbacks), 1, f) != 1) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } if (pch_save != >_pch_save) { uintptr_t binbias = (uintptr_t) >_pch_save - (uintptr_t) pch_save; @@ -898,7 +930,11 @@ = (uintptr_t) mmi.preferred_base - (uintptr_t) orig_preferred_base; if (fread (ptrs, sizeof (void *), num_callbacks, f) != num_callbacks) - fatal_error (input_location, "cannot read PCH file: %m"); + { + line_table = old_line_table; + input_location = old_input_loc; + fatal_error (input_location, "cannot read PCH file: %m"); + } for (i = 0; i < num_callbacks; ++i) { void *ptr = (void *) ((uintptr_t) ptrs[i] + bias); diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/ginclude/stddef.h dist/gcc/ginclude/stddef.h --- /Users/io/Downloads/gcc-14.3.0/gcc/ginclude/stddef.h 2025-05-23 13:02:04 +++ dist/gcc/ginclude/stddef.h 2025-11-14 01:50:21 @@ -445,8 +445,13 @@ use __float128 here; that is only available on some architectures, but only on i386 is extra alignment needed for __float128. */ -#ifdef __i386__ +#if defined(__i386__) +#ifdef __clang__ + // 16 is the gcc alignment for __float128 + long long __max_align_128 __attribute__((__aligned__(16))); +#else __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); +#endif #endif } max_align_t; #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/ginclude/unwind-arm-common.h dist/gcc/ginclude/unwind-arm-common.h --- /Users/io/Downloads/gcc-14.3.0/gcc/ginclude/unwind-arm-common.h 2025-05-23 13:02:04 +++ dist/gcc/ginclude/unwind-arm-common.h 2025-11-14 01:50:21 @@ -184,7 +184,7 @@ #define _Unwind_Exception _Unwind_Control_Block typedef char _Unwind_Exception_Class[8]; - void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetLanguageSpecificData (_Unwind_Context *); _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); @@ -235,7 +235,7 @@ } _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); - void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetLanguageSpecificData (_Unwind_Context *); /* leb128 type numbers have a potentially unlimited size. The target of the following definitions of _sleb128_t and _uleb128_t diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/ipa-inline.cc dist/gcc/ipa-inline.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/ipa-inline.cc 2025-05-23 13:02:04 +++ dist/gcc/ipa-inline.cc 2025-11-14 01:50:21 @@ -2837,7 +2837,11 @@ could remove other nodes with flatten attribute. See PR82801. */ struct cgraph_node_hook_list *node_removal_hook_holder = NULL; hash_set *flatten_removed_nodes = NULL; - if (j < nnodes - 2) + /* + * XXXMRG: added "nnodes > 1" as -O2 (but not -O) warn: + * "assuming signed overflow does not occur" + */ + if (nnodes > 1 && j < nnodes - 2) { flatten_removed_nodes = new hash_set; node_removal_hook_holder diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/objc/Make-lang.in dist/gcc/objc/Make-lang.in --- /Users/io/Downloads/gcc-14.3.0/gcc/objc/Make-lang.in 2025-05-23 13:02:04 +++ dist/gcc/objc/Make-lang.in 2025-11-14 01:50:21 @@ -69,7 +69,7 @@ else \ build/genchecksum$(build_exeext) $(OBJC_OBJS) $(C_AND_OBJC_OBJS) \ $(BACKEND) $(LIBDEPS) checksum-options > $@.tmp && \ - $(srcdir)/../move-if-change $@.tmp $@; \ + $(SHELL) $(srcdir)/../move-if-change $@.tmp $@; \ fi cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/objcp/Make-lang.in dist/gcc/objcp/Make-lang.in --- /Users/io/Downloads/gcc-14.3.0/gcc/objcp/Make-lang.in 2025-05-23 13:02:04 +++ dist/gcc/objcp/Make-lang.in 2025-11-14 01:50:21 @@ -72,7 +72,7 @@ else \ build/genchecksum$(build_exeext) $(OBJCXX_OBJS) $(BACKEND) \ $(CODYLIB) $(LIBDEPS) checksum-options > $@.tmp && \ - $(srcdir)/../move-if-change $@.tmp $@; \ + $(SHELL) $(srcdir)/../move-if-change $@.tmp $@; \ fi cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) \ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/opts-global.cc dist/gcc/opts-global.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/opts-global.cc 2025-05-23 13:02:04 +++ dist/gcc/opts-global.cc 2025-11-14 01:50:21 @@ -388,6 +388,10 @@ add_debug_prefix_map (opt->arg); break; + case OPT_fdebug_regex_map_: + add_debug_regex_map (opt->arg); + break; + case OPT_ffile_prefix_map_: add_file_prefix_map (opt->arg); break; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/opts.cc dist/gcc/opts.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/opts.cc 2025-05-23 13:02:04 +++ dist/gcc/opts.cc 2025-11-14 01:50:21 @@ -2890,6 +2890,10 @@ /* Deferred. */ break; + case OPT_fdebug_regex_map_: + /* Deferred. */ + break; + case OPT_fcanon_prefix_map: flag_canon_prefix_map = value; break; diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/recog.cc dist/gcc/recog.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/recog.cc 2025-05-23 13:02:05 +++ dist/gcc/recog.cc 2025-11-14 01:50:21 @@ -1497,7 +1497,13 @@ ??? This is a kludge. */ if (!reload_completed && maybe_ne (SUBREG_BYTE (op), 0) - && MEM_P (sub)) + && MEM_P (sub) +#ifdef NB_FIX_VAX_BACKEND + && (maybe_gt (SUBREG_BYTE (op), GET_MODE_SIZE (GET_MODE (sub))) + || !multiple_p (SUBREG_BYTE (op), GET_MODE_SIZE (mode)) + ) +#endif /* NB_FIX_VAX_BACKEND */ + ) return false; if (REG_P (sub) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/regsub.cc dist/gcc/regsub.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/regsub.cc 1970-01-01 01:00:00 +++ dist/gcc/regsub.cc 2025-11-14 01:50:21 @@ -0,0 +1,165 @@ +/* $NetBSD: regsub.cc,v 1.2 2024/09/25 16:26:05 christos Exp $ */ + +/*- + * Copyright (c) 2015 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +extern "C" { + +#include +#include +#include +#include +#include +#include + +struct str { + char *s_ptr; + size_t s_max; + size_t s_len; + int s_fixed; +}; + +#define REINCR 64 + +static int +addspace(struct str *s, size_t len) +{ + void *v; + + if (s->s_max - s->s_len > len) + return 0; + + if (s->s_fixed) + return -1; + + s->s_max += len + REINCR; + + v = realloc(s->s_ptr, s->s_max); + if (v == NULL) + return -1; + s->s_ptr = (char *)v; + + return 0; +} + +static void +addchar(struct str *s, int c) +{ + if (addspace(s, 1) == -1) + s->s_len++; + else + s->s_ptr[s->s_len++] = c; + if (c == 0) { + --s->s_len; + s->s_ptr[s->s_max - 1] = c; + } +} + +static void +addnstr(struct str *s, const char *buf, size_t len) +{ + if (addspace(s, len) != -1) + memcpy(s->s_ptr + s->s_len, buf, len); + s->s_len += len; +} + +static int +initstr(struct str *s, char *buf, size_t len) +{ + s->s_max = len; + s->s_ptr = (char *)(buf == NULL ? malloc(len) : buf); + s->s_fixed = buf != NULL; + s->s_len = 0; + return s->s_ptr == NULL ? -1 : 0; +} + +static ssize_t +regsub1(char **buf, size_t len, const char *sub, + const regmatch_t *rm, const char *str) +{ + ssize_t i; + char c; + struct str s; + + if (initstr(&s, *buf, len) == -1) + return -1; + + while ((c = *sub++) != '\0') { + + switch (c) { + case '&': + i = 0; + break; + case '\\': + if (isdigit((unsigned char)*sub)) + i = *sub++ - '0'; + else + i = -1; + break; + default: + i = -1; + break; + } + + if (i == -1) { + if (c == '\\' && (*sub == '\\' || *sub == '&')) + c = *sub++; + addchar(&s, c); + } else if (rm[i].rm_so != -1 && rm[i].rm_eo != -1) { + size_t l = (size_t)(rm[i].rm_eo - rm[i].rm_so); + addnstr(&s, str + rm[i].rm_so, l); + } + } + + addchar(&s, '\0'); + if (!s.s_fixed) { + if (s.s_len >= s.s_max) { + free(s.s_ptr); + return -1; + } + *buf = s.s_ptr; + } + return s.s_len; +} + +ssize_t +regnsub(char *buf, size_t len, const char *sub, const regmatch_t *rm, + const char *str) +{ + return regsub1(&buf, len, sub, rm, str); +} + +ssize_t +regasub(char **buf, const char *sub, const regmatch_t *rm, const char *str) +{ + *buf = NULL; + return regsub1(buf, REINCR, sub, rm, str); +} + +} diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/reload.cc dist/gcc/reload.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/reload.cc 2025-05-23 13:02:05 +++ dist/gcc/reload.cc 2025-11-14 01:50:21 @@ -838,6 +838,7 @@ reload_inner_reg_of_subreg (rtx x, machine_mode mode, bool output) { rtx inner; + int regno; /* Only SUBREGs are problematical. */ if (GET_CODE (x) != SUBREG) @@ -849,10 +850,20 @@ if (CONSTANT_P (inner) || GET_CODE (inner) == PLUS) return true; - /* If INNER is not a hard register, then INNER will not need reloading. */ - if (!(REG_P (inner) && HARD_REGISTER_P (inner))) + /* If INNER is not a register, then INNER will not need reloading. */ + if (!REG_P (inner)) return false; + regno = REGNO (inner); + + /* If INNER is not a hard register, then INNER will not need reloading + unless it's a mode dependent memory reference. */ + if (regno >= FIRST_PSEUDO_REGISTER) + return !output + && reg_equiv_mem (regno) != 0 + && mode_dependent_address_p (XEXP (reg_equiv_mem (regno), 0), + MEM_ADDR_SPACE (reg_equiv_mem (regno))); + /* If INNER is not ok for MODE, then INNER will need reloading. */ if (!targetm.hard_regno_mode_ok (subreg_regno (x), mode)) return true; @@ -1138,7 +1149,7 @@ if (in != 0 && reload_inner_reg_of_subreg (in, inmode, false)) { - if (REG_P (SUBREG_REG (in))) + if (REG_P (SUBREG_REG (in)) && HARD_REGISTER_P (SUBREG_REG (in))) subreg_in_class = find_valid_class (inmode, GET_MODE (SUBREG_REG (in)), subreg_regno_offset (REGNO (SUBREG_REG (in)), @@ -1146,8 +1157,13 @@ SUBREG_BYTE (in), GET_MODE (in)), REGNO (SUBREG_REG (in))); +#if 1 // XXXMRG + else if (REG_P (SUBREG_REG (in)) + || GET_CODE (SUBREG_REG (in)) == SYMBOL_REF) +#else else if (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS) +#endif subreg_in_class = find_valid_class_1 (inmode, GET_MODE (SUBREG_REG (in)), rclass); @@ -4532,6 +4548,53 @@ } } } + +#ifdef NB_FIX_VAX_BACKEND + /* + * Scan the reloads again looking for a case where there is + * precisely one RELOAD_FOR_OPERAND_ADDRESS reload and one + * RELOAD_FOR_OPADDR_ADDR reload BUT they are for different + * operands. choose_reload_regs assumes that the + * RELOAD_FOR_OPADDR_ADDR and RELOAD_FOR_OPERAND_ADDRESS reloads are + * a pair operating on the same operand and will choose the same + * register for both, which is not what is wanted. + */ + { + int need_change = 0; + int n_operand_address_reloads = 0, + n_opaddr_addr_reloads = 0; + int reloadnum_for_operand_address_reload = -1, + reloadnum_for_opaddr_addr_reload = -1; + + for (i = 0; i < n_reloads; i++) + { + switch (rld[i].when_needed) + { + case RELOAD_FOR_OPADDR_ADDR: + n_opaddr_addr_reloads++; + reloadnum_for_opaddr_addr_reload = i; + break; + case RELOAD_FOR_OPERAND_ADDRESS: + n_operand_address_reloads++; + reloadnum_for_operand_address_reload = i; + break; + default: + break; + } + } + need_change = + (n_operand_address_reloads == 1 + && n_opaddr_addr_reloads == 1 + && rld[reloadnum_for_opaddr_addr_reload].opnum + != rld[reloadnum_for_operand_address_reload].opnum); + + if (need_change) + { + rld[reloadnum_for_opaddr_addr_reload].when_needed + = RELOAD_FOR_OPERAND_ADDRESS; + } + } +#endif /* See if we have any reloads that are now allowed to be merged because we've changed when the reload is needed to diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/rtlanal.cc dist/gcc/rtlanal.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/rtlanal.cc 2025-05-23 13:02:05 +++ dist/gcc/rtlanal.cc 2025-11-14 01:50:21 @@ -3253,6 +3253,15 @@ /* These operations don't trap even with floating point. */ break; + case SIGN_EXTRACT: + if (targetm.have_extv ()) + return targetm.bitfield_may_trap_p (x, flags); + break; + case ZERO_EXTRACT: + if (targetm.have_extzv ()) + return targetm.bitfield_may_trap_p (x, flags); + break; + default: /* Any floating arithmetic may trap. */ if (FLOAT_MODE_P (GET_MODE (x)) && flag_trapping_math) diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/system.h dist/gcc/system.h --- /Users/io/Downloads/gcc-14.3.0/gcc/system.h 2025-05-23 13:02:05 +++ dist/gcc/system.h 2025-11-14 01:50:21 @@ -43,6 +43,12 @@ # include #endif +#ifndef GENERATOR_FILE +#ifdef __cplusplus +# include +#endif +#endif + #include /* Define a generic NULL if one hasn't already been defined. */ diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/target.def dist/gcc/target.def --- /Users/io/Downloads/gcc-14.3.0/gcc/target.def 2025-05-23 13:02:05 +++ dist/gcc/target.def 2025-11-14 01:50:21 @@ -4066,6 +4066,20 @@ int, (const_rtx x, unsigned flags), default_unspec_may_trap_p) +/* Return nonzero if evaluating SIGN_EXTRACT X or ZERO_EXTRACT X might + cause a trap. FLAGS has the same meaning as in rtlanal.c: + may_trap_p_1. */ +DEFHOOK +(bitfield_may_trap_p, + "This target hook returns nonzero if @var{x}, an @code{sign_extract} or\n\ +@code{zero_extract} operation, might cause a trap. Targets can use\n\ +this hook to enhance precision of analysis for @code{sign_extract} and\n\ +@code{zero_extract} operations. You may call @code{may_trap_p_1}\n\ +to analyze inner elements of @var{x} in which case @var{flags} should be\n\ +passed along.", + int, (const_rtx x, unsigned flags), + default_bitfield_may_trap_p) + /* Given a register, this hook should return a parallel of registers to represent where to find the register pieces. Define this hook if the register and its mode are represented in Dwarf in diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/targhooks.cc dist/gcc/targhooks.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/targhooks.cc 2025-05-23 13:02:05 +++ dist/gcc/targhooks.cc 2025-11-14 01:50:21 @@ -139,6 +139,12 @@ return 0; } +int +default_bitfield_may_trap_p (const_rtx x, unsigned flags) +{ + return 0; +} + machine_mode default_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, machine_mode mode, @@ -987,7 +993,17 @@ DECL_ARTIFICIAL (t) = 1; DECL_IGNORED_P (t) = 1; DECL_VISIBILITY_SPECIFIED (t) = 1; +#if 1 + /* + * This is a hack: + * It appears that our gas does not generate @PLT for hidden + * symbols. It could be that we need a newer version, or that + * this local function is handled differently on linux. + */ + DECL_VISIBILITY (t) = VISIBILITY_DEFAULT; +#else DECL_VISIBILITY (t) = VISIBILITY_HIDDEN; +#endif stack_chk_fail_decl = t; } diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/targhooks.h dist/gcc/targhooks.h --- /Users/io/Downloads/gcc-14.3.0/gcc/targhooks.h 2025-05-23 13:02:05 +++ dist/gcc/targhooks.h 2025-11-14 01:50:21 @@ -29,6 +29,7 @@ extern bool default_const_not_ok_for_debug_p (rtx); extern int default_unspec_may_trap_p (const_rtx, unsigned); +extern int default_bitfield_may_trap_p (const_rtx, unsigned); extern machine_mode default_promote_function_mode (const_tree, machine_mode, int *, const_tree, int); extern machine_mode default_promote_function_mode_always_promote diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/tree-cfg.cc dist/gcc/tree-cfg.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/tree-cfg.cc 2025-05-23 13:02:08 +++ dist/gcc/tree-cfg.cc 2025-11-14 01:50:21 @@ -9801,7 +9801,11 @@ } if (location == UNKNOWN_LOCATION) location = cfun->function_end_locus; - warning_at (location, 0, "% function does return"); + +#ifdef notyet + if (warn_missing_noreturn) + warning_at (location, 0, "% function does return"); +#endif } /* If we see "return;" in some basic block, then we do reach the end diff -Nru /Users/io/Downloads/gcc-14.3.0/gcc/ubsan.cc dist/gcc/ubsan.cc --- /Users/io/Downloads/gcc-14.3.0/gcc/ubsan.cc 2025-05-23 13:02:08 +++ dist/gcc/ubsan.cc 2025-11-14 01:50:21 @@ -52,6 +52,7 @@ #include "realmpfr.h" #include "target.h" #include "langhooks.h" +#include "file-prefix-map.h" /* Map from a tree to a VAR_DECL tree. */ @@ -323,8 +324,9 @@ else { /* Fill in the values from LOC. */ - size_t len = strlen (xloc.file) + 1; - str = build_string (len, xloc.file); + const char *file = remap_debug_filename (xloc.file); + size_t len = strlen (file) + 1; + str = build_string (len, file); TREE_TYPE (str) = build_array_type_nelts (char_type_node, len); TREE_READONLY (str) = 1; TREE_STATIC (str) = 1; diff -Nru /Users/io/Downloads/gcc-14.3.0/include/ansidecl.h dist/include/ansidecl.h --- /Users/io/Downloads/gcc-14.3.0/include/ansidecl.h 2025-05-23 13:02:08 +++ dist/include/ansidecl.h 2025-11-14 01:50:21 @@ -288,7 +288,7 @@ /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ -#if GCC_VERSION < 2008 +#if GCC_VERSION < 2008 && !defined(__extension__) #define __extension__ #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libbacktrace/configure dist/libbacktrace/configure --- /Users/io/Downloads/gcc-14.3.0/libbacktrace/configure 2025-05-23 13:02:08 +++ dist/libbacktrace/configure 2025-11-14 01:50:21 @@ -2602,15 +2602,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/Makefile.in dist/libcpp/Makefile.in --- /Users/io/Downloads/gcc-14.3.0/libcpp/Makefile.in 2025-05-23 13:03:15 +++ dist/libcpp/Makefile.in 2025-11-14 01:50:21 @@ -139,7 +139,7 @@ localedir.h: localedir.hs; @true localedir.hs: Makefile echo "#define LOCALEDIR \"$(localedir)\"" > localedir.new - $(srcdir)/../move-if-change localedir.new localedir.h + $(SHELL) $(srcdir)/../move-if-change localedir.new localedir.h echo timestamp > localedir.hs # Installation rules and other phony targets diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/configure dist/libcpp/configure --- /Users/io/Downloads/gcc-14.3.0/libcpp/configure 2025-05-23 13:03:15 +++ dist/libcpp/configure 2025-11-14 01:50:21 @@ -2677,15 +2677,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/files.cc dist/libcpp/files.cc --- /Users/io/Downloads/gcc-14.3.0/libcpp/files.cc 2025-05-23 13:02:08 +++ dist/libcpp/files.cc 2025-11-14 01:50:21 @@ -227,20 +227,32 @@ static bool open_file (_cpp_file *file) { + const char *cpp_restricted; + + cpp_restricted = getenv ("CPP_RESTRICTED"); + if (file->path[0] == '\0') { file->fd = 0; set_stdin_to_binary_mode (); } else - file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY, 0666); + file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY + | ((cpp_restricted != NULL) ? O_NONBLOCK : 0), 0666); + if (file->fd != -1) { if (fstat (file->fd, &file->st) == 0) { if (!S_ISDIR (file->st.st_mode)) + if (cpp_restricted != NULL + ? S_ISREG (file->st.st_mode) : !S_ISDIR (file->st.st_mode)) + { + if (cpp_restricted) + fcntl(file->fd, F_SETFL, + fcntl(file->fd, F_GETFL, 0) & ~O_NONBLOCK); file->err_no = 0; return true; } diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/include/cpplib.h dist/libcpp/include/cpplib.h --- /Users/io/Downloads/gcc-14.3.0/libcpp/include/cpplib.h 2025-05-23 13:02:08 +++ dist/libcpp/include/cpplib.h 2025-11-14 01:50:21 @@ -1093,6 +1093,9 @@ /* Set the include paths. */ extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); +/* Provide src:dst pair for __FILE__ remapping. */ +extern void add_cpp_remap_path (const char *); + /* Call these to get pointers to the options, callback, and deps structures for a given reader. These pointers are good until you call cpp_finish on that reader. You can either edit the callbacks diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/lex.cc dist/libcpp/lex.cc --- /Users/io/Downloads/gcc-14.3.0/libcpp/lex.cc 2025-05-23 13:02:08 +++ dist/libcpp/lex.cc 2025-11-14 01:50:21 @@ -3048,6 +3048,8 @@ { unsigned char *buffer; unsigned int len, clen, i; + int convert_to_c = (pfile->state.in_directive || pfile->state.parsing_args) + && type == '/'; len = pfile->buffer->cur - from + 1; /* + 1 for the initial '/'. */ @@ -3062,8 +3064,7 @@ Note that the only time we encounter a directive here is when we are saving comments in a "#define". */ - clen = ((pfile->state.in_directive || pfile->state.parsing_args) - && type == '/') ? len + 2 : len; + clen = convert_to_c ? len + 2 : len; buffer = _cpp_unaligned_alloc (pfile, clen); @@ -3075,7 +3076,7 @@ memcpy (buffer + 1, from, len - 1); /* Finish conversion to a C comment, if necessary. */ - if ((pfile->state.in_directive || pfile->state.parsing_args) && type == '/') + if (convert_to_c) { buffer[1] = '*'; buffer[clen - 2] = '*'; diff -Nru /Users/io/Downloads/gcc-14.3.0/libcpp/macro.cc dist/libcpp/macro.cc --- /Users/io/Downloads/gcc-14.3.0/libcpp/macro.cc 2025-05-23 13:02:08 +++ dist/libcpp/macro.cc 2025-11-14 01:50:21 @@ -486,6 +486,61 @@ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; +static size_t remap_pairs; +static char **remap_src; +static char **remap_dst; + +void +add_cpp_remap_path (const char *arg) +{ + const char *arg_dst; + size_t len; + + arg_dst = strchr(arg, ':'); + if (arg_dst == NULL) { + fprintf(stderr, "Invalid argument for -iremap"); + exit(1); + } + len = arg_dst - arg; + ++arg_dst; + + remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1)); + remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1)); + + remap_src[remap_pairs] = (char *) xmalloc(len + 1); + memcpy(remap_src[remap_pairs], arg, len); + remap_src[remap_pairs][len] = '\0'; + remap_dst[remap_pairs] = xstrdup(arg_dst); + ++remap_pairs; +} + +static const char * +cpp_remap_file (const char *arg, char **tmp_name) +{ + char *result; + size_t i, len; + + for (i = 0; i < remap_pairs; ++i) { + len = strlen (remap_src[i]); + if (strncmp (remap_src[i], arg, len)) + continue; + if (arg[len] == '\0') + return remap_dst[i]; + if (arg[len] != '/') + continue; + arg += len; + len = strlen (remap_dst[i]); + result = (char *) xmalloc (len + strlen (arg) + 1); + memcpy(result, remap_dst[i], len); + strcpy(result + len, arg); + *tmp_name = result; + + return result; + } + + return arg; +} + /* Helper function for builtin_macro. Returns the text generated by a builtin macro. */ const uchar * @@ -550,6 +605,7 @@ { unsigned int len; const char *name; + char *tmp_name; uchar *buf; if (node->value.builtin == BT_FILE @@ -568,11 +624,14 @@ } if (pfile->cb.remap_filename && !pfile->state.in_directive) name = pfile->cb.remap_filename (name); + tmp_name = NULL; + name = cpp_remap_file (name, &tmp_name); len = strlen (name); buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); result = buf; *buf = '"'; buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); + free (tmp_name); *buf++ = '"'; *buf = '\0'; } diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/Makefile.in dist/libgcc/Makefile.in --- /Users/io/Downloads/gcc-14.3.0/libgcc/Makefile.in 2025-05-23 13:02:08 +++ dist/libgcc/Makefile.in 2025-11-14 01:50:21 @@ -1125,7 +1125,7 @@ dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \ cp unwind.h $$dest; \ chmod a+r $$dest; \ - sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h + $(SHELL) $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h # Copy unwind.h to the place where gcc will look at run-time, once installed # diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/alpha/qrnnd.S dist/libgcc/config/alpha/qrnnd.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/alpha/qrnnd.S 2025-05-23 13:02:08 +++ dist/libgcc/config/alpha/qrnnd.S 2025-11-14 01:50:21 @@ -22,8 +22,9 @@ # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # . -#ifdef __ELF__ +#if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"" +.previous #endif .set noreorder diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/pr-support.c dist/libgcc/config/arm/pr-support.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/pr-support.c 2025-05-23 13:02:08 +++ dist/libgcc/config/arm/pr-support.c 2025-11-14 01:50:21 @@ -402,7 +402,7 @@ /* Find the Language specific exception data. */ -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (_Unwind_Context * context) { _Unwind_Control_Block *ucbp; @@ -416,7 +416,7 @@ /* Skip the unwind opcodes. */ ptr += (((*ptr) >> 24) & 0xff) + 1; - return ptr; + return (_Unwind_Ptr) ptr; } diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/t-netbsd dist/libgcc/config/arm/t-netbsd --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/t-netbsd 2025-05-23 13:02:08 +++ dist/libgcc/config/arm/t-netbsd 2025-11-14 01:50:21 @@ -10,6 +10,9 @@ # difference. It is then pointless adding debugging. HOST_LIBGCC2_CFLAGS += -fomit-frame-pointer -LIBGCC2_DEBUG_CFLAGS = -g0 - LIB2ADD += $(srcdir)/floatunsidf.c $(srcdir)/floatunsisf.c + +# Currently there is a bug somewhere in GCC's alias analysis +# or scheduling code that is breaking _fpmul_parts in fp-bit.c. +# Disabling function inlining is a workaround for this problem. +HOST_LIBGCC2_CFLAGS += -fno-inline diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/t-netbsd-eabi dist/libgcc/config/arm/t-netbsd-eabi --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/arm/t-netbsd-eabi 2025-05-23 13:02:08 +++ dist/libgcc/config/arm/t-netbsd-eabi 2025-11-14 01:50:21 @@ -6,8 +6,11 @@ # Add the BPABI C functions. LIB2ADD += $(srcdir)/config/arm/unaligned-funcs.c -# Not using libgcc for EH. -LIB2ADDEH = +#LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ +# $(srcdir)/config/arm/libunwind.S \ +# $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c + +LIB2FUNCS_EXCLUDE = _ctors # Add the BPABI names. SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/c6x/pr-support.c dist/libgcc/config/c6x/pr-support.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/c6x/pr-support.c 2025-05-23 13:02:08 +++ dist/libgcc/config/c6x/pr-support.c 2025-11-14 01:50:21 @@ -518,7 +518,7 @@ return (_Unwind_Ptr) ucbp->pr_cache.fnstart; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (_Unwind_Context *context) { _Unwind_Control_Block *ucbp; @@ -531,5 +531,5 @@ /* Skip the unwind opcodes. */ ptr += (((*ptr) >> 24) & 0xff) + 1; - return ptr; + return (_Unwind_Ptr) ptr; } diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/i386/morestack.S dist/libgcc/config/i386/morestack.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/i386/morestack.S 2025-05-23 13:02:08 +++ dist/libgcc/config/i386/morestack.S 2025-11-14 01:50:21 @@ -865,7 +865,7 @@ .quad __morestack_load_mmap #endif -#ifdef __ELF__ +#if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"",@progbits .section .note.GNU-split-stack,"",@progbits .section .note.GNU-no-split-stack,"",@progbits diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/i386/t-cpuinfo dist/libgcc/config/i386/t-cpuinfo --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/i386/t-cpuinfo 2025-05-23 13:02:08 +++ dist/libgcc/config/i386/t-cpuinfo 2025-11-14 01:50:21 @@ -1 +1,3 @@ LIB2ADD += $(srcdir)/config/i386/cpuinfo.c +LIBGCC2_INCLUDES = -I$(srcdir)/../gcc/config/i386 + diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/ia64/unwind-ia64.c dist/libgcc/config/ia64/unwind-ia64.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/ia64/unwind-ia64.c 2025-05-23 13:02:08 +++ dist/libgcc/config/ia64/unwind-ia64.c 2025-11-14 01:50:21 @@ -1715,10 +1715,10 @@ context->rp = val; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) { - return context->lsda; + return (_Unwind_Ptr)context->lsda; } _Unwind_Ptr @@ -2445,6 +2445,16 @@ { return _Unwind_GetIP (context); } + +#ifdef __NetBSD__ +/* dummy for bootstrapping purposes */ +struct unw_table_entry * +_Unwind_FindTableEntry (void *pc, unw_word *segment_base, + unw_word *gp, struct unw_table_entry *ent) +{ + return NULL; +} +#endif #include "unwind.inc" diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/fpgnulib.c dist/libgcc/config/m68k/fpgnulib.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/fpgnulib.c 2025-05-23 13:02:08 +++ dist/libgcc/config/m68k/fpgnulib.c 2025-11-14 01:50:21 @@ -55,7 +55,7 @@ #define HIDDEN (1L << 23L) #define SIGN(fp) ((fp) & SIGNBIT) #define EXPMASK 0xFFL -#define EXP(fp) (((fp) >> 23L) & 0xFF) +#define EXP(fp) (((fp) >> 23L) & EXPMASK) #define MANT(fp) (((fp) & 0x7FFFFFL) | HIDDEN) #define PACK(s,e,m) ((s) | ((e) << 23L) | (m)) @@ -64,7 +64,7 @@ #define HIDDEND (1L << 20L) #define EXPDBITS 11 #define EXPDMASK 0x7FFL -#define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL) +#define EXPD(fp) (((fp.l.upper) >> 20L) & EXPDMASK) #define SIGND(fp) ((fp.l.upper) & SIGNBIT) #define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \ (fp.l.lower >> 22)) @@ -136,6 +136,7 @@ return 0; } +#ifndef LIBCSOFTFLOAT /* convert unsigned int to double */ double __floatunsidf (unsigned long a1) @@ -393,6 +394,7 @@ return __fixdfsi (foo); } +#endif #else /* EXTFLOAT */ /* We do not need these routines for coldfire, as it has no extended @@ -403,6 +405,7 @@ We assume all numbers are normalized, don't do any rounding, etc. */ +#ifndef LIBCSOFTFLOAT /* Prototypes for the above in case we use them. */ double __floatunsidf (unsigned long); double __floatsidf (long); @@ -411,7 +414,8 @@ float __truncdfsf2 (double); long __fixdfsi (double); long __fixsfsi (float); -int __cmpdf2 (double, double); +long __cmpdf2 (double, double); +#endif int __unordxf2(long double a, long double b) @@ -429,6 +433,7 @@ return 0; } +#ifndef LIBCSOFTFLOAT /* convert double to long double */ long double __extenddfxf2 (double d) @@ -691,5 +696,6 @@ return __cmpdf2 ((double) x1, (double) x2); } +#endif #endif /* !__mcoldfire__ */ #endif /* EXTFLOAT */ diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/lb1sf68.S dist/libgcc/config/m68k/lb1sf68.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/lb1sf68.S 2025-05-23 13:02:08 +++ dist/libgcc/config/m68k/lb1sf68.S 2025-11-14 01:50:21 @@ -203,7 +203,7 @@ lea \addr-.-8,a0 jsr pc@(a0) #else - jbsr \addr + jbsr \addr@PLTPC #endif .endm @@ -215,7 +215,7 @@ lea \addr-.-8,a0 jmp pc@(a0) #else - bra \addr + bra \addr@PLTPC #endif .endm diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/t-floatlib dist/libgcc/config/m68k/t-floatlib --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/t-floatlib 2025-05-23 13:02:08 +++ dist/libgcc/config/m68k/t-floatlib 2025-11-14 01:50:21 @@ -1,6 +1,6 @@ LIB1ASMSRC = m68k/lb1sf68.S LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ - _double _float _floatex \ + _floatex _float _double \ _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/t-netbsd-m68010 dist/libgcc/config/m68k/t-netbsd-m68010 --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/m68k/t-netbsd-m68010 1970-01-01 01:00:00 +++ dist/libgcc/config/m68k/t-netbsd-m68010 2025-11-14 01:50:21 @@ -0,0 +1,5 @@ +LIB1ASMSRC = m68k/lb1sf68.S +LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ + _double _float _floatex \ + _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ + _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/crti.S dist/libgcc/config/or1k/crti.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/crti.S 1970-01-01 01:00:00 +++ dist/libgcc/config/or1k/crti.S 2025-11-14 01:50:21 @@ -0,0 +1,36 @@ +# Start .init and .fini sections. +# Copyright (C) 2010 Embecosm Limited +# +# This file 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 +# . + +#include "or1k-asm.h" + + .section .init + .global _init + l.nop # So _init doesn't start at 0 +_init: + l.addi r1,r1,-4 + l.sw 0(r1),r9 + + .section .fini + .global _fini +_fini: + l.addi r1,r1,-4 + l.sw 0(r1),r9 diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/crtn.S dist/libgcc/config/or1k/crtn.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/crtn.S 1970-01-01 01:00:00 +++ dist/libgcc/config/or1k/crtn.S 2025-11-14 01:50:21 @@ -0,0 +1,37 @@ +# End .init and .fini sections. +# Copyright (C) 2010 Embecosm Limited +# +# This file 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 +# . + +#include "or1k-asm.h" + + .section .init + l.lwz r9,0(r1) + OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,4), + OR1K_INST(l.jr r9) + ) + + .section .fini + l.lwz r9,0(r1) + OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,4), + OR1K_INST(l.jr r9) + ) diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/or1k-asm.h dist/libgcc/config/or1k/or1k-asm.h --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/or1k-asm.h 1970-01-01 01:00:00 +++ dist/libgcc/config/or1k/or1k-asm.h 2025-11-14 01:50:21 @@ -0,0 +1,20 @@ +#ifndef OR1K_ASM_H +#define OR1K_ASM_H + +#define OR1K_INST(...) __VA_ARGS__ + +#if defined(__OR1K_NODELAY__) +#define OR1K_DELAYED(a, b) a; b +#define OR1K_DELAYED_NOP(a) a +.nodelay +#elif defined(__OR1K_DELAY__) +#define OR1K_DELAYED(a, b) b; a +#define OR1K_DELAYED_NOP(a) a; l.nop +#elif defined(__OR1K_DELAY_COMPAT__) +#define OR1K_DELAYED(a, b) a; b; l.nop +#define OR1K_DELAYED_NOP(a) a; l.nop +#else +#error One of __OR1K_NODELAY__, __OR1K_DELAY__, or __OR1K_DELAY_COMPAT__ must be defined +#endif + +#endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/or1k.S dist/libgcc/config/or1k/or1k.S --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/or1k.S 1970-01-01 01:00:00 +++ dist/libgcc/config/or1k/or1k.S 2025-11-14 01:50:21 @@ -0,0 +1,237 @@ +#include "or1k-asm.h" +/* + * Assembly functions for software multiplication and devision. + */ + +#define ENTRY(symbol) \ + .align 4 ;\ + .global symbol ;\ + .type symbol, @function ;\ +symbol: + +#ifdef L__mulsi3 +ENTRY(__mulsi3) + l.addi r11,r0,0x0 + l.sfne r3,r11 +OR1K_DELAYED( + OR1K_INST(l.ori r5,r3,0x0), + OR1K_INST(l.bnf 3f) +) + l.addi r6,r0,0x0 +1: + l.andi r3,r5,0x1 + l.sfeq r3,r6 +OR1K_DELAYED( + OR1K_INST(l.srli r5,r5,0x1), + OR1K_INST(l.bf 2f) +) + l.add r11,r11,r4 +2: + l.sfne r5,r6 +OR1K_DELAYED( + OR1K_INST(l.slli r4,r4,0x1), + OR1K_INST(l.bf 1b) +) +3: +OR1K_DELAYED_NOP( + OR1K_INST(l.jr r9) +) +.size __mulsi3,.-__mulsi3 +#endif + +#ifdef L__udivsi3 +.global __udivsi3_internal +.hidden __udivsi3_internal +__udivsi3_internal: +ENTRY(__udivsi3) + l.addi r1,r1,-4 + l.sw 0(r1),r9 + l.addi r11,r0,0 + l.addi r8,r4,0 + l.addi r5,r3,0 + l.sfne r8,r11 +OR1K_DELAYED( + OR1K_INST(l.addi r7,r0,0), + OR1K_INST(l.bnf 4f) +) + /* The following work equally on delay and no-delay implementations */ + l.sfgtu r8,r5 + l.bf 5f + l.sfeq r8,r5 + l.bf 6f + l.sfltu r11,r8 + +OR1K_DELAYED( + OR1K_INST(l.addi r13,r0,32), + OR1K_INST(l.bnf 2f) +) + l.movhi r9,hi(0x80000000) + l.addi r6,r0,-1 +1: + l.and r3,r5,r9 + l.slli r4,r7,1 + l.addi r15,r5,0 + l.srli r3,r3,31 + l.add r13,r13,r6 + l.or r7,r4,r3 + l.sfltu r7,r8 +OR1K_DELAYED( + OR1K_INST(l.slli r5,r5,1), + OR1K_INST(l.bf 1b) +) +2: + l.srli r7,r7,1 + l.addi r13,r13,1 + l.addi r9,r0,0 + l.sfltu r9,r13 +OR1K_DELAYED( + OR1K_INST(l.addi r5,r15,0), + OR1K_INST(l.bnf 4f) +) + l.movhi r15,hi(0x80000000) + l.addi r17,r0,0 +3: + l.and r3,r5,r15 + l.slli r4,r7,1 + l.srli r3,r3,31 + l.or r7,r4,r3 + l.sub r6,r7,r8 + l.and r3,r6,r15 + l.srli r3,r3,31 + l.addi r4,r0,0 + l.sfne r3,r4 +OR1K_DELAYED( + OR1K_INST(l.slli r3,r11,1), + OR1K_INST(l.bf 1f) +) + l.addi r4,r0,1 +1: + l.slli r5,r5,1 + l.sfne r4,r17 +OR1K_DELAYED( + OR1K_INST(l.or r11,r3,r4), + OR1K_INST(l.bnf 2f) +) + l.addi r7,r6,0 +2: + l.addi r9,r9,1 + l.sfltu r9,r13 +OR1K_DELAYED_NOP( + OR1K_INST(l.bf 3b) +) +OR1K_DELAYED_NOP( + OR1K_INST(l.j 4f) +) +6: +OR1K_DELAYED( + OR1K_INST(l.addi r11,r0,1), + OR1K_INST(l.j 4f) +) +5: + l.addi r7,r5,0 +4: + l.lwz r9,0(r1) +OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,4), + OR1K_INST(l.jr r9) +) +.size __udivsi3,.-__udivsi3 +#endif + + +#ifdef L__divsi3 +ENTRY(__divsi3) + l.addi r1,r1,-8 + l.sw 0(r1),r9 + l.sw 4(r1),r14 + l.addi r5,r3,0 + l.addi r14,r0,0 + l.sflts r5,r0 +OR1K_DELAYED( + OR1K_INST(l.addi r3,r0,0), + OR1K_INST(l.bnf 1f) +) + l.addi r14,r0,1 + l.sub r5,r0,r5 +1: + l.sflts r4,r0 +OR1K_DELAYED_NOP( + OR1K_INST(l.bnf 1f) +) + l.addi r14,r14,1 + l.sub r4,r0,r4 +1: +OR1K_DELAYED( + OR1K_INST(l.addi r3,r5,0), + OR1K_INST(l.jal __udivsi3_internal) +) + l.sfeqi r14,1 +OR1K_DELAYED_NOP( + OR1K_INST(l.bnf 1f) +) + l.sub r11,r0,r11 +1: + l.lwz r9,0(r1) + l.lwz r14,4(r1) +OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,8), + OR1K_INST(l.jr r9) +) +.size __divsi3,.-__divsi3 +#endif + + +#ifdef L__umodsi3 +ENTRY(__umodsi3) + l.addi r1,r1,-4 + l.sw 0(r1),r9 +OR1K_DELAYED_NOP( + OR1K_INST(l.jal __udivsi3_internal) +) + l.addi r11,r7,0 + l.lwz r9,0(r1) +OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,4), + OR1K_INST(l.jr r9) +) +.size __umodsi3,.-__umodsi3 +#endif + + +#ifdef L__modsi3 +ENTRY(__modsi3) + l.addi r1,r1,-8 + l.sw 0(r1),r9 + l.sw 4(r1),r14 + l.addi r14,r0,0 + l.sflts r3,r0 +OR1K_DELAYED_NOP( + OR1K_INST(l.bnf 1f) +) + l.addi r14,r0,1 + l.sub r3,r0,r3 +1: + l.sflts r4,r0 +OR1K_DELAYED_NOP( + OR1K_INST(l.bnf 1f) +) + l.sub r4,r0,r4 +1: +OR1K_DELAYED_NOP( + OR1K_INST(l.jal __udivsi3_internal) +) + l.sfeqi r14,1 +OR1K_DELAYED( + OR1K_INST(l.addi r11,r7,0), + OR1K_INST(l.bnf 1f) +) + l.sub r11,r0,r11 +1: + l.lwz r9,0(r1) + l.lwz r14,4(r1) +OR1K_DELAYED( + OR1K_INST(l.addi r1,r1,8), + OR1K_INST(l.jr r9) +) +.size __modsi3,.-__modsi3 +#endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/t-crtstuff dist/libgcc/config/or1k/t-crtstuff --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/t-crtstuff 2025-05-23 13:02:08 +++ dist/libgcc/config/or1k/t-crtstuff 2025-11-14 01:50:21 @@ -1,2 +1,4 @@ -# Compile crtbeginS.o and crtendS.o with -mcmodel=large -CRTSTUFF_T_CFLAGS_S += -mcmodel=large +# This will prevent gcc from appending data to .eh_frame. +# Other archs use fno-asynchronous-unwind-tables but we do not have that flag. +CRTSTUFF_T_CFLAGS += -fno-dwarf2-cfi-asm +CRTSTUFF_T_CFLAGS_S += -fno-dwarf2-cfi-asm diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/t-linux dist/libgcc/config/or1k/t-linux --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/or1k/t-linux 1970-01-01 01:00:00 +++ dist/libgcc/config/or1k/t-linux 2025-11-14 01:50:21 @@ -0,0 +1,2 @@ +MULTILIB_DIRNAMES = be +EXTRA_MULTILIB_PARTS = crti.o crtbegin.o crtend.o crtn.o diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/pa/sync-libfuncs.c dist/libgcc/config/pa/sync-libfuncs.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/pa/sync-libfuncs.c 2025-05-23 13:02:08 +++ dist/libgcc/config/pa/sync-libfuncs.c 2025-11-14 01:50:21 @@ -133,11 +133,11 @@ { double tmp; - asm volatile ("stws|stw} %2,-16(%%sp)\n\t" - "{stws|stw} %R2,-12(%%sp)\n\t" - "{fldds|fldd} -16(%%sp),%1\n\t" - "{fstds|fstd} %1,0(%0)" - : "=m" (ptr), "=&f" (tmp) : "r" (value): "memory"); + asm volatile ("{stws|stw} %1,-16(%%sp)\n\t" + "{stws|stw} %R1,-12(%%sp)\n\t" + "{fldds|fldd} -16(%%sp),%0\n\t" + : "=f" (tmp) : "r" (value): "memory"); + *(volatile double *)ptr = tmp; } #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/pa/t-netbsd dist/libgcc/config/pa/t-netbsd --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/pa/t-netbsd 2025-05-23 13:02:08 +++ dist/libgcc/config/pa/t-netbsd 2025-11-14 01:50:21 @@ -7,4 +7,3 @@ HOST_LIBGCC2_CFLAGS += -DELF=1 -DLINUX=1 LIB2ADD = $(srcdir)/config/pa/fptr.c -LIB2ADD_ST = $(srcdir)/config/pa/sync-libfuncs.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/riscv-fp.c dist/libgcc/config/riscv/riscv-fp.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/riscv-fp.c 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/riscv-fp.c 2025-11-14 01:50:21 @@ -0,0 +1,178 @@ +/* Functions needed for soft-float on riscv-linux. Based on + rs6000/ppc64-fp.c with TF types removed. + + Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2006, 2009 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 +. */ + +#if defined(__riscv64) +#include "fp-bit.h" + +extern DItype __fixdfdi (DFtype); +extern DItype __fixsfdi (SFtype); +extern USItype __fixunsdfsi (DFtype); +extern USItype __fixunssfsi (SFtype); +extern DFtype __floatdidf (DItype); +extern DFtype __floatundidf (UDItype); +extern SFtype __floatdisf (DItype); +extern SFtype __floatundisf (UDItype); + +static DItype local_fixunssfdi (SFtype); +static DItype local_fixunsdfdi (DFtype); + +DItype +__fixdfdi (DFtype a) +{ + if (a < 0) + return - local_fixunsdfdi (-a); + return local_fixunsdfdi (a); +} + +DItype +__fixsfdi (SFtype a) +{ + if (a < 0) + return - local_fixunssfdi (-a); + return local_fixunssfdi (a); +} + +USItype +__fixunsdfsi (DFtype a) +{ + if (a >= - (DFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1)) + return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1)) + - (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1); + return (SItype) a; +} + +USItype +__fixunssfsi (SFtype a) +{ + if (a >= - (SFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1)) + return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1)) + - (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1); + return (SItype) a; +} + +DFtype +__floatdidf (DItype u) +{ + DFtype d; + + d = (SItype) (u >> (sizeof (SItype) * 8)); + d *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1)); + d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1)); + + return d; +} + +DFtype +__floatundidf (UDItype u) +{ + DFtype d; + + d = (USItype) (u >> (sizeof (SItype) * 8)); + d *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1)); + d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1)); + + return d; +} + +SFtype +__floatdisf (DItype u) +{ + DFtype f; + + if (53 < (sizeof (DItype) * 8) + && 53 > ((sizeof (DItype) * 8) - 53 + 24)) + { + if (! (- ((DItype) 1 << 53) < u + && u < ((DItype) 1 << 53))) + { + if ((UDItype) u & (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1)) + { + u &= ~ (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1); + u |= ((UDItype) 1 << ((sizeof (DItype) * 8) - 53)); + } + } + } + f = (SItype) (u >> (sizeof (SItype) * 8)); + f *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1)); + f += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1)); + + return (SFtype) f; +} + +SFtype +__floatundisf (UDItype u) +{ + DFtype f; + + if (53 < (sizeof (DItype) * 8) + && 53 > ((sizeof (DItype) * 8) - 53 + 24)) + { + if (u >= ((UDItype) 1 << 53)) + { + if ((UDItype) u & (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1)) + { + u &= ~ (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1); + u |= ((UDItype) 1 << ((sizeof (DItype) * 8) - 53)); + } + } + } + f = (USItype) (u >> (sizeof (SItype) * 8)); + f *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1)); + f += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1)); + + return (SFtype) f; +} + +/* This version is needed to prevent recursion; fixunsdfdi in libgcc + calls fixdfdi, which in turn calls calls fixunsdfdi. */ + +static DItype +local_fixunsdfdi (DFtype a) +{ + USItype hi, lo; + + hi = a / (((UDItype) 1) << (sizeof (SItype) * 8)); + lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8))); + return ((UDItype) hi << (sizeof (SItype) * 8)) | lo; +} + +/* This version is needed to prevent recursion; fixunssfdi in libgcc + calls fixsfdi, which in turn calls calls fixunssfdi. */ + +static DItype +local_fixunssfdi (SFtype original_a) +{ + DFtype a = original_a; + USItype hi, lo; + + hi = a / (((UDItype) 1) << (sizeof (SItype) * 8)); + lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8))); + return ((UDItype) hi << (sizeof (SItype) * 8)) | lo; +} + +#endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-dpbit dist/libgcc/config/riscv/t-dpbit --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-dpbit 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-dpbit 2025-11-14 01:50:21 @@ -0,0 +1,4 @@ +LIB2ADD += dp-bit.c + +dp-bit.c: $(srcdir)/fp-bit.c + cat $(srcdir)/fp-bit.c > dp-bit.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-fpbit dist/libgcc/config/riscv/t-fpbit --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-fpbit 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-fpbit 2025-11-14 01:50:21 @@ -0,0 +1,5 @@ +LIB2ADD += fp-bit.c + +fp-bit.c: $(srcdir)/fp-bit.c + echo '#define FLOAT' > fp-bit.c + cat $(srcdir)/fp-bit.c >> fp-bit.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-linux dist/libgcc/config/riscv/t-linux --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-linux 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-linux 2025-11-14 01:50:21 @@ -0,0 +1 @@ +LIB2ADD += $(srcdir)/config/riscv/riscv-fp.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-netbsd dist/libgcc/config/riscv/t-netbsd --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-netbsd 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-netbsd 2025-11-14 01:50:21 @@ -0,0 +1,17 @@ +LIB2ADD += $(srcdir)/soft-fp/addtf3.c \ + $(srcdir)/soft-fp/divtf3.c \ + $(srcdir)/soft-fp/eqtf2.c \ + $(srcdir)/soft-fp/getf2.c \ + $(srcdir)/soft-fp/letf2.c \ + $(srcdir)/soft-fp/multf3.c \ + $(srcdir)/soft-fp/negtf2.c \ + $(srcdir)/soft-fp/subtf3.c \ + $(srcdir)/soft-fp/unordtf2.c \ + $(srcdir)/soft-fp/fixtfsi.c \ + $(srcdir)/soft-fp/fixunstfsi.c \ + $(srcdir)/soft-fp/floatsitf.c \ + $(srcdir)/soft-fp/floatunsitf.c \ + $(srcdir)/soft-fp/extendsftf2.c \ + $(srcdir)/soft-fp/extenddftf2.c \ + $(srcdir)/soft-fp/trunctfsf2.c \ + $(srcdir)/soft-fp/trunctfdf2.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-netbsd64 dist/libgcc/config/riscv/t-netbsd64 --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-netbsd64 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-netbsd64 2025-11-14 01:50:21 @@ -0,0 +1,4 @@ +LIB2ADD += $(srcdir)/soft-fp/fixtfdi.c \ + $(srcdir)/soft-fp/fixunstfdi.c \ + $(srcdir)/soft-fp/floatditf.c \ + $(srcdir)/soft-fp/floatunditf.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-tpbit dist/libgcc/config/riscv/t-tpbit --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/riscv/t-tpbit 1970-01-01 01:00:00 +++ dist/libgcc/config/riscv/t-tpbit 2025-11-14 01:50:21 @@ -0,0 +1,10 @@ +LIB2ADD += tp-bit.c + +tp-bit.c: $(srcdir)/fp-bit.c + echo '#ifdef _RISCVEL' > tp-bit.c + echo '# define FLOAT_BIT_ORDER_MISMATCH' >> tp-bit.c + echo '#endif' >> tp-bit.c + echo '#if __LDBL_MANT_DIG__ == 113' >> tp-bit.c + echo '# define TFLOAT' >> tp-bit.c + cat $(srcdir)/fp-bit.c >> tp-bit.c + echo '#endif' >> tp-bit.c diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config/xtensa/unwind-dw2-xtensa.c dist/libgcc/config/xtensa/unwind-dw2-xtensa.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/config/xtensa/unwind-dw2-xtensa.c 2025-05-23 13:02:08 +++ dist/libgcc/config/xtensa/unwind-dw2-xtensa.c 2025-11-14 01:50:21 @@ -172,7 +172,7 @@ context->ra = (void *) val; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) { return context->lsda; diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/config.host dist/libgcc/config.host --- /Users/io/Downloads/gcc-14.3.0/libgcc/config.host 2025-05-23 13:02:08 +++ dist/libgcc/config.host 2025-11-14 01:50:21 @@ -435,6 +435,7 @@ aarch64*-*-netbsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" tmake_file="${tmake_file} t-dfprules" md_unwind_header=aarch64/aarch64-unwind.h @@ -536,7 +537,8 @@ case ${host} in arm*-*-netbsdelf-*eabi*) tmake_file="${tmake_file} arm/t-netbsd-eabi" - unwind_header=config/arm/unwind-arm.h + # GCC 7 vs NetBSD/eabi -> avoid arm unwinder + #unwind_header=config/arm/unwind-arm.h ;; *) tmake_file="${tmake_file} arm/t-netbsd t-slibgcc-gld-nover" @@ -964,6 +966,10 @@ fi md_unwind_header=ia64/linux-unwind.h ;; +ia64*-*-netbsd*) + extra_parts="${extra_parts} crtfastmath.o" + tmake_file="${tmake_file} ia64/t-ia64 ia64/t-ia64-elf ia64/t-eh-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat" + ;; ia64*-*-hpux*) tmake_file="ia64/t-ia64 ia64/t-ia64-elf ia64/t-hpux t-slibgcc ia64/t-slibgcc-hpux t-slibgcc-hpux" ;; @@ -1014,8 +1020,11 @@ m68k-*-elf* | fido-*-elf) tmake_file="$tmake_file m68k/t-floatlib" ;; -m68k*-*-netbsdelf*) +m5407-*-netbsdelf*) ;; +m68k*-*-netbsdelf* | m68010-*-netbsdelf*) + tmake_file="$tmake_file m68k/t-floatlib" + ;; m68k*-*-openbsd*) ;; m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc @@ -1053,6 +1062,17 @@ extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o" ;; mips*-*-netbsd*) # NetBSD/mips, either endian. + if test "${libgcc_cv_mips_hard_float}" = no; then + # Eat soft float stuff added above since the netbsd libc provides it. + xtmake_file= + for t in ${tmake_file}; do + case $t in + *softfp*) ;; + *) xtmake_file="${xtmake_file} $t";; + esac + done + tmake_file="${xtmake_file}" + fi ;; mips*-*-linux*) # Linux MIPS, either endian. extra_parts="$extra_parts crtfastmath.o" @@ -1106,7 +1126,7 @@ tmake_file="$tmake_file mips/t-elf mips/t-crtstuff" extra_parts="$extra_parts crti.o crtn.o" ;; -mips64-*-elf* | mips64el-*-elf*) +mips64-*-elf* | mips64el-*-elf* | mipsn64-*-elf* | mipsn64el-*-elf*) tmake_file="$tmake_file mips/t-elf mips/t-crtstuff mips/t-mips16" extra_parts="$extra_parts crti.o crtn.o" ;; @@ -1201,6 +1221,10 @@ tmake_file="$tmake_file t-softfp-sfdf t-softfp" md_unwind_header=or1k/linux-unwind.h ;; +or1k*-*-netbsd*) + tmake_file="$tmake_file or1k/t-or1k" + tmake_file="$tmake_file t-softfp-sfdf t-softfp" + ;; or1k-*-*) tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff" tmake_file="$tmake_file t-softfp-sfdf t-softfp" @@ -1239,8 +1263,8 @@ ;; esac ;; -powerpc-*-netbsd*) - tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff" +powerpc*-*-netbsd*) + tmake_file="${tmake_file} rs6000/t-netbsd rs6000/t-crtstuff" ;; powerpc-*-eabispe*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" @@ -1361,6 +1385,14 @@ riscv*-*-freebsd*) tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc" extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o" + ;; +riscv*-*-netbsd*) + tmake_file="${tmake_file} riscv/t-netbsd" + case ${host} in + riscv64*) + tmake_file="${tmake_file} riscv/t-netbsd64" + ;; + esac ;; riscv*-*-*) tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address}" diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/configure dist/libgcc/configure --- /Users/io/Downloads/gcc-14.3.0/libgcc/configure 2025-05-23 13:02:08 +++ dist/libgcc/configure 2025-11-14 01:50:21 @@ -2202,15 +2202,15 @@ for ac_dir in $libgcc_topdir "$srcdir"/$libgcc_topdir; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done @@ -5499,6 +5499,11 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_cc_tls" >&5 $as_echo "$gcc_cv_have_cc_tls" >&6; } + if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then + +$as_echo "#define HAVE_CC_TLS 1" >>confdefs.h + + fi set_have_cc_tls= if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then set_have_cc_tls="-DHAVE_CC_TLS" diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/emutls.c dist/libgcc/emutls.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/emutls.c 2025-05-23 13:02:08 +++ dist/libgcc/emutls.c 2025-11-14 01:50:21 @@ -66,9 +66,9 @@ #pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" EMUTLS_ATTR -void *__emutls_get_address (struct __emutls_object *); +void *__emutls_get_address (void *); EMUTLS_ATTR -void __emutls_register_common (struct __emutls_object *, word, word, void *); +void __emutls_register_common (void *, word, word, void *); #ifdef __GTHREADS #ifdef __GTHREAD_MUTEX_INIT @@ -145,8 +145,10 @@ implementation here, causes the decl. attributes to be discarded. */ EMUTLS_ATTR void * -__emutls_get_address (struct __emutls_object *obj) +__emutls_get_address (void *vobj) { + struct __emutls_object *obj = vobj; + if (! __gthread_active_p ()) { if (__builtin_expect (obj->loc.ptr == NULL, 0)) @@ -209,9 +211,11 @@ } EMUTLS_ATTR void -__emutls_register_common (struct __emutls_object *obj, +__emutls_register_common (void *vobj, word size, word align, void *templ) { + struct __emutls_object *obj = vobj; + if (obj->size < size) { obj->size = size; diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/gthr-posix.h dist/libgcc/gthr-posix.h --- /Users/io/Downloads/gcc-14.3.0/libgcc/gthr-posix.h 2025-05-23 13:02:08 +++ dist/libgcc/gthr-posix.h 2025-11-14 01:50:21 @@ -178,9 +178,12 @@ working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, - which means the alternate __gthread_active_p below cannot be used there. */ + which means the alternate __gthread_active_p below cannot be used there. + On NetBSD, linking with pthreads but without calling pthread_create() + makes std::call_once() so we do the same. +*/ -#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) +#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) || defined(__NetBSD__) static volatile int __gthread_active = -1; @@ -223,7 +226,7 @@ return __gthread_active_latest_value != 0; } -#else /* neither FreeBSD nor Solaris */ +#else /* neither FreeBSD nor Solaris nor NetBSD */ /* For a program to be multi-threaded the only thing that it certainly must be using is pthread_create. However, there may be other libraries that @@ -265,7 +268,7 @@ return __gthread_active_ptr != 0; } -#endif /* FreeBSD or Solaris */ +#endif /* FreeBSD or Solaris or NetBSD */ #else /* not SUPPORTS_WEAK */ diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-compat.c dist/libgcc/unwind-compat.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-compat.c 2025-05-23 13:02:08 +++ dist/libgcc/unwind-compat.c 2025-11-14 01:50:21 @@ -137,10 +137,10 @@ return __libunwind_Unwind_GetIP (context); } -extern void *__libunwind_Unwind_GetLanguageSpecificData +extern _Unwind_Ptr __libunwind_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) { return __libunwind_Unwind_GetLanguageSpecificData (context); diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-dw2-fde-dip.c dist/libgcc/unwind-dw2-fde-dip.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-dw2-fde-dip.c 2025-05-23 13:02:08 +++ dist/libgcc/unwind-dw2-fde-dip.c 2025-11-14 01:50:21 @@ -32,7 +32,7 @@ #include "tconfig.h" #include "tsystem.h" -#if !defined(inhibit_libc) && !defined(__OpenBSD__) +#if !defined(inhibit_libc) && defined(__GLIBC__) #include /* Get DT_CONFIG. */ #endif #include "coretypes.h" diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-dw2.c dist/libgcc/unwind-dw2.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-dw2.c 2025-05-23 13:02:08 +++ dist/libgcc/unwind-dw2.c 2025-11-14 01:50:21 @@ -370,10 +370,10 @@ context->ra = (void *) val; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) { - return context->lsda; + return (_Unwind_Ptr) context->lsda; } _Unwind_Ptr diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-generic.h dist/libgcc/unwind-generic.h --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-generic.h 2025-05-23 13:02:08 +++ dist/libgcc/unwind-generic.h 2025-11-14 01:50:21 @@ -178,7 +178,7 @@ /* @@@ Retrieve the CFA of the given context. */ extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); -extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *); extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-seh.c dist/libgcc/unwind-seh.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-seh.c 2025-05-23 13:02:08 +++ dist/libgcc/unwind-seh.c 2025-11-14 01:50:21 @@ -131,7 +131,7 @@ c->ra = val; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *c) { return c->disp->HandlerData; diff -Nru /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-sjlj.c dist/libgcc/unwind-sjlj.c --- /Users/io/Downloads/gcc-14.3.0/libgcc/unwind-sjlj.c 2025-05-23 13:02:08 +++ dist/libgcc/unwind-sjlj.c 2025-11-14 01:50:21 @@ -231,10 +231,10 @@ context->fc->call_site = val - 1; } -void * +_Unwind_Ptr _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) { - return context->fc->lsda; + return (_Unwind_Ptr) context->fc->lsda; } _Unwind_Ptr diff -Nru /Users/io/Downloads/gcc-14.3.0/libgomp/acc_prof.h dist/libgomp/acc_prof.h --- /Users/io/Downloads/gcc-14.3.0/libgomp/acc_prof.h 2025-05-23 13:02:08 +++ dist/libgomp/acc_prof.h 2025-11-14 01:50:21 @@ -235,7 +235,7 @@ acc_register_t) __GOACC_NOTHROW; extern void acc_prof_unregister (acc_event_t, acc_prof_callback, acc_register_t) __GOACC_NOTHROW; -typedef void (*acc_query_fn) (); +typedef void (*acc_query_fn) (void); typedef acc_query_fn (*acc_prof_lookup_func) (const char *); extern acc_query_fn acc_prof_lookup (const char *) __GOACC_NOTHROW; /* Don't tag 'acc_register_library' as '__GOACC_NOTHROW': this function can be diff -Nru /Users/io/Downloads/gcc-14.3.0/libgomp/configure dist/libgomp/configure --- /Users/io/Downloads/gcc-14.3.0/libgomp/configure 2025-05-23 13:03:15 +++ dist/libgomp/configure 2025-11-14 01:50:21 @@ -2707,15 +2707,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libgomp/fortran.c dist/libgomp/fortran.c --- /Users/io/Downloads/gcc-14.3.0/libgomp/fortran.c 2025-05-23 13:02:08 +++ dist/libgomp/fortran.c 2025-11-14 01:50:21 @@ -788,7 +788,7 @@ } intptr_t -omp_get_default_allocator_ () +omp_get_default_allocator_ (void) { return (intptr_t) omp_get_default_allocator (); } diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/alloca.c dist/libiberty/alloca.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/alloca.c 2025-05-23 13:02:08 +++ dist/libiberty/alloca.c 2025-11-14 01:50:21 @@ -161,7 +161,7 @@ void * C_alloca (size_t size) { - auto char probe; /* Probes stack depth: */ + char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); #if STACK_DIRECTION == 0 diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/configure dist/libiberty/configure --- /Users/io/Downloads/gcc-14.3.0/libiberty/configure 2025-05-23 13:02:08 +++ dist/libiberty/configure 2025-11-14 01:50:21 @@ -2523,15 +2523,15 @@ for ac_dir in $libiberty_topdir "$srcdir"/$libiberty_topdir; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/cp-demangle.c dist/libiberty/cp-demangle.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/cp-demangle.c 2025-05-23 13:02:08 +++ dist/libiberty/cp-demangle.c 2025-11-14 01:50:21 @@ -119,7 +119,7 @@ # include #else # ifndef alloca -# ifdef __GNUC__ +# if defined(__GNUC__) || defined(__lint__) # define alloca __builtin_alloca # else extern char *alloca (); diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/floatformat.c dist/libiberty/floatformat.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/floatformat.c 2025-05-23 13:02:08 +++ dist/libiberty/floatformat.c 2025-11-14 01:50:21 @@ -53,9 +53,14 @@ #ifdef DBL_QNAN #define NAN DBL_QNAN #else +#ifdef __lint__ +static double zero = 0.0; +#define NAN (0.0 / zero) +#else #define NAN (0.0 / 0.0) #endif #endif +#endif static int mant_bits_set (const struct floatformat *, const unsigned char *); static unsigned long get_field (const unsigned char *, @@ -515,7 +520,11 @@ if (nan) dto = NAN; else +#ifdef __vax__ + dto = HUGE_VAL; +#else dto = INFINITY; +#endif if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) dto = -dto; diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/make-temp-file.c dist/libiberty/make-temp-file.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/make-temp-file.c 2025-05-23 13:02:08 +++ dist/libiberty/make-temp-file.c 2025-11-14 01:50:21 @@ -142,9 +142,9 @@ base = try_dir (P_tmpdir, base); #endif - /* Try /var/tmp, then /tmp. */ - base = try_dir (vartmp, base); + /* Try /tmp, then /var/tmp. */ base = try_dir (tmp, base); + base = try_dir (vartmp, base); /* If all else fails, use the current directory! */ if (base == 0) diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/sha1.c dist/libiberty/sha1.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/sha1.c 2025-05-23 13:02:08 +++ dist/libiberty/sha1.c 2025-11-14 01:50:21 @@ -234,7 +234,11 @@ if (len >= 64) { #if !_STRING_ARCH_unaligned +# if defined(__clang__) || defined(__GNUC__) +# define alignof(type) __alignof__(type) +# else # define alignof(type) offsetof (struct { char c; type x; }, x) +# endif # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0) if (UNALIGNED_P (buffer)) while (len > 64) @@ -455,8 +459,10 @@ if (len >= 64) { #if !_STRING_ARCH_unaligned +#if 0 /* XXXMRG defined above */ # define alignof(type) offsetof (struct { char c; type x; }, x) # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0) +#endif if (UNALIGNED_P (buffer)) while (len > 64) { diff -Nru /Users/io/Downloads/gcc-14.3.0/libiberty/vprintf-support.c dist/libiberty/vprintf-support.c --- /Users/io/Downloads/gcc-14.3.0/libiberty/vprintf-support.c 2025-05-23 13:02:08 +++ dist/libiberty/vprintf-support.c 2025-11-14 01:50:21 @@ -36,6 +36,7 @@ extern unsigned long strtoul (); #endif #include "libiberty.h" +#include "vprintf-support.h" int libiberty_vprintf_buffer_size (const char *format, va_list args) diff -Nru /Users/io/Downloads/gcc-14.3.0/libobjc/configure dist/libobjc/configure --- /Users/io/Downloads/gcc-14.3.0/libobjc/configure 2025-05-23 13:02:08 +++ dist/libobjc/configure 2025-11-14 01:50:21 @@ -2229,15 +2229,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libobjc/encoding.c dist/libobjc/encoding.c --- /Users/io/Downloads/gcc-14.3.0/libobjc/encoding.c 2025-05-23 13:02:08 +++ dist/libobjc/encoding.c 2025-11-14 01:50:21 @@ -647,7 +647,11 @@ return ROUND (size, wordsize); } -inline +/* + Skip type qualifiers. These may eventually precede typespecs + occurring in method prototype encodings. +*/ + const char * objc_skip_type_qualifiers (const char *type) { @@ -665,7 +669,6 @@ return type; } -inline const char * objc_skip_typespec (const char *type) { @@ -796,7 +799,10 @@ } } -inline +/* + Skip an offset as part of a method encoding. This is prepended by a + '+' if the argument is passed in registers. +*/ const char * objc_skip_offset (const char *type) { @@ -1107,7 +1113,10 @@ /* The following are used only if the field is a bitfield */ register const char *bfld_type = 0; - register int bfld_type_align = 0, bfld_field_size = 0; +#ifdef HAVE_BITFIELD_TYPE_MATTERS + register int bfld_type_align = 0; +#endif + register int bfld_field_size = 0; /* The current type without the type qualifiers */ const char *type; @@ -1130,7 +1139,9 @@ bfld_type++) /* do nothing */; +#ifdef HAVE_BITFIELD_TYPE_MATTERS bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__; +#endif bfld_field_size = atoi (objc_skip_typespec (bfld_type)); layout->record_size += bfld_field_size; } @@ -1155,7 +1166,9 @@ bfld_type++) /* do nothing */; +#ifdef HAVE_BITFIELD_TYPE_MATTERS bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__; +#endif bfld_field_size = atoi (objc_skip_typespec (bfld_type)); } diff -Nru /Users/io/Downloads/gcc-14.3.0/libobjc/hash.c dist/libobjc/hash.c --- /Users/io/Downloads/gcc-14.3.0/libobjc/hash.c 2025-05-23 13:02:08 +++ dist/libobjc/hash.c 2025-11-14 01:50:21 @@ -151,8 +151,8 @@ (*cachep)->hash_func, (*cachep)->compare_func); - DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", - (int) *cachep, (*cachep)->size, new->size); + DEBUG_PRINTF ("Expanding cache %p from %d to %d\n", + *cachep, (*cachep)->size, new->size); /* Copy the nodes from the first hash table to the new one. */ while ((node1 = objc_hash_next (*cachep, node1))) diff -Nru /Users/io/Downloads/gcc-14.3.0/libobjc/objects.c dist/libobjc/objects.c --- /Users/io/Downloads/gcc-14.3.0/libobjc/objects.c 2025-05-23 13:02:08 +++ dist/libobjc/objects.c 2025-11-14 01:50:21 @@ -36,7 +36,6 @@ #endif /* FIXME: The semantics of extraBytes are not really clear. */ -inline id class_createInstance (Class class, size_t extraBytes) { diff -Nru /Users/io/Downloads/gcc-14.3.0/libobjc/sendmsg.c dist/libobjc/sendmsg.c --- /Users/io/Downloads/gcc-14.3.0/libobjc/sendmsg.c 2025-05-23 13:02:08 +++ dist/libobjc/sendmsg.c 2025-11-14 01:50:21 @@ -95,7 +95,6 @@ extern IMP __objc_get_forward_imp (id, SEL); /* Given a selector, return the proper forwarding implementation. */ -inline IMP __objc_get_forward_imp (id rcv, SEL sel) { @@ -358,7 +357,6 @@ method can be forwarded. Since this requires the dispatch table to installed, this function will implicitly invoke +initialize for the class of OBJECT if it hasn't been invoked yet. */ -inline BOOL __objc_responds_to (id object, SEL sel) { diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/asan/asan_interceptors.cpp dist/libsanitizer/asan/asan_interceptors.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/asan/asan_interceptors.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/asan/asan_interceptors.cpp 2025-11-14 01:50:21 @@ -706,6 +706,9 @@ #endif #if ASAN_INTERCEPT___CXA_ATEXIT +#ifdef SANITIZER_NETBSD +DECLARE_REAL(int, atexit, void (*func)()); +#endif INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg, void *dso_handle) { #if SANITIZER_APPLE @@ -717,7 +720,11 @@ __lsan::ScopedInterceptorDisabler disabler; #endif int res = REAL(__cxa_atexit)(func, arg, dso_handle); +#ifdef SANITIZER_NETBSD + REAL(atexit)((void (*)())AtCxaAtexit); +#else REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr); +#endif return res; } #endif // ASAN_INTERCEPT___CXA_ATEXIT @@ -728,9 +735,14 @@ #if CAN_SANITIZE_LEAKS __lsan::ScopedInterceptorDisabler disabler; #endif +#ifdef SANITIZER_NETBSD + int res = REAL(atexit)(func); + REAL(atexit)((void (*)())AtCxaAtexit); +#else // Avoid calling real atexit as it is unreachable on at least on Linux. int res = REAL(__cxa_atexit)((void (*)(void *a))func, nullptr, nullptr); REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr); +#endif return res; } #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_allocator.cpp dist/libsanitizer/lsan/lsan_allocator.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_allocator.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/lsan/lsan_allocator.cpp 2025-11-14 01:50:21 @@ -26,7 +26,7 @@ extern "C" void *memset(void *ptr, int value, uptr num); namespace __lsan { -#if defined(__i386__) || defined(__arm__) +#if defined(__i386__) || defined(__arm__) || !defined(_LP64) static const uptr kMaxAllowedMallocSize = 1ULL << 30; #elif defined(__mips64) || defined(__aarch64__) static const uptr kMaxAllowedMallocSize = 4ULL << 30; diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_common.cpp dist/libsanitizer/lsan/lsan_common.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_common.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/lsan/lsan_common.cpp 2025-11-14 01:50:21 @@ -268,7 +268,7 @@ constexpr uptr kLAM_U57Mask = 0x81ff80; constexpr uptr kPointerMask = kLAM_U57Mask << 40; return ((p & kPointerMask) == 0); -# elif defined(__mips64) +# elif defined(__mips64) && defined(_LP64) return ((p >> 40) == 0); # elif defined(__aarch64__) // TBI (Top Byte Ignore) feature of AArch64: bits [63:56] are ignored in @@ -713,7 +713,7 @@ uptr i = InternalLowerBound(threads, os_id); if (i >= threads.size() || threads[i] != os_id) Report( - "Running thread %zu was not suspended. False leaks are possible.\n", + "Running thread %llu was not suspended. False leaks are possible.\n", os_id); } } diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_interceptors.cpp dist/libsanitizer/lsan/lsan_interceptors.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/lsan/lsan_interceptors.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/lsan/lsan_interceptors.cpp 2025-11-14 01:50:21 @@ -378,7 +378,11 @@ #if SANITIZER_INTERCEPT_ATEXIT INTERCEPTOR(int, atexit, void (*f)()) { __lsan::ScopedInterceptorDisabler disabler; +#ifdef SANITIZER_NETBSD + return REAL(atexit)(f); +#else return REAL(__cxa_atexit)((void (*)(void *a))f, 0, 0); +#endif } #define LSAN_MAYBE_INTERCEPT_ATEXIT INTERCEPT_FUNCTION(atexit) #else diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/Makefile.am dist/libsanitizer/sanitizer_common/Makefile.am --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/Makefile.am 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/Makefile.am 2025-11-14 01:50:21 @@ -47,6 +47,7 @@ sanitizer_netbsd.cpp \ sanitizer_platform_limits_freebsd.cpp \ sanitizer_platform_limits_linux.cpp \ + sanitizer_platform_limits_netbsd.cpp \ sanitizer_platform_limits_openbsd.cpp \ sanitizer_platform_limits_posix.cpp \ sanitizer_platform_limits_solaris.cpp \ @@ -69,6 +70,7 @@ sanitizer_symbolizer_report.cpp \ sanitizer_stacktrace_printer.cpp \ sanitizer_stoptheworld_linux_libcdep.cpp \ + sanitizer_stoptheworld_netbsd_libcdep.cpp \ sanitizer_stoptheworld_mac.cpp \ sanitizer_suppressions.cpp \ sanitizer_symbolizer.cpp \ diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/Makefile.in dist/libsanitizer/sanitizer_common/Makefile.in --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/Makefile.in 2025-05-23 13:03:15 +++ dist/libsanitizer/sanitizer_common/Makefile.in 2025-11-14 01:50:21 @@ -133,6 +133,7 @@ sanitizer_mac.lo sanitizer_mac_libcdep.lo sanitizer_mutex.lo \ sanitizer_netbsd.lo sanitizer_platform_limits_freebsd.lo \ sanitizer_platform_limits_linux.lo \ + sanitizer_platform_limits_netbsd.lo \ sanitizer_platform_limits_openbsd.lo \ sanitizer_platform_limits_posix.lo \ sanitizer_platform_limits_solaris.lo sanitizer_posix.lo \ @@ -146,6 +147,7 @@ sanitizer_symbolizer_mac.lo sanitizer_symbolizer_report.lo \ sanitizer_stacktrace_printer.lo \ sanitizer_stoptheworld_linux_libcdep.lo \ + sanitizer_stoptheworld_netbsd_libcdep.lo \ sanitizer_stoptheworld_mac.lo sanitizer_suppressions.lo \ sanitizer_symbolizer.lo sanitizer_symbolizer_libbacktrace.lo \ sanitizer_symbolizer_libcdep.lo \ @@ -409,6 +411,7 @@ sanitizer_netbsd.cpp \ sanitizer_platform_limits_freebsd.cpp \ sanitizer_platform_limits_linux.cpp \ + sanitizer_platform_limits_netbsd.cpp \ sanitizer_platform_limits_openbsd.cpp \ sanitizer_platform_limits_posix.cpp \ sanitizer_platform_limits_solaris.cpp \ @@ -431,6 +434,7 @@ sanitizer_symbolizer_report.cpp \ sanitizer_stacktrace_printer.cpp \ sanitizer_stoptheworld_linux_libcdep.cpp \ + sanitizer_stoptheworld_netbsd_libcdep.cpp \ sanitizer_stoptheworld_mac.cpp \ sanitizer_suppressions.cpp \ sanitizer_symbolizer.cpp \ @@ -568,6 +572,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_netbsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_freebsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_linux.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_netbsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_openbsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_posix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_solaris.Plo@am__quote@ @@ -588,6 +593,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stacktrace_printer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stacktrace_sparc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stoptheworld_linux_libcdep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stoptheworld_netbsd_libcdep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stoptheworld_mac.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_suppressions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_symbolizer.Plo@am__quote@ diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_asm.h dist/libsanitizer/sanitizer_common/sanitizer_asm.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_asm.h 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_asm.h 2025-11-14 01:50:21 @@ -104,7 +104,9 @@ # define ASM_SYMBOL(symbol) symbol # define ASM_SYMBOL_INTERCEPTOR(symbol) symbol # if defined(__i386__) || defined(__powerpc__) || defined(__s390__) || \ - defined(__sparc__) + defined(__sparc__) || defined(__hppa__) || defined(__sh3__) || \ + defined(__vax__) || defined(__m68k__) || defined(__m68000___) || \ + defined(__ia64__) || defined(__alpha__) // For details, see interception.h # define ASM_WRAPPER_NAME(symbol) __interceptor_##symbol # define ASM_TRAMPOLINE_ALIAS(symbol, name) \ @@ -140,7 +142,8 @@ #endif #if defined(__ELF__) && (defined(__GNU__) || defined(__FreeBSD__) || \ - defined(__Fuchsia__) || defined(__linux__)) + defined(__Fuchsia__) || defined(__linux__) || \ + defined(__NetBSD__)) // clang-format off #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits // clang-format on diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h 2025-11-14 01:50:21 @@ -93,10 +93,16 @@ } // namespace __sanitizer // This include provides explicit template instantiations for atomic_uint64_t -// on MIPS32, which does not directly support 8 byte atomics. It has to +// on platforms, which do not directly support 8 byte atomics. It has to // proceed the template definitions above. #if defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32 # include "sanitizer_atomic_clang_mips.h" +#endif +#if SANITIZER_NETBSD +# include +# ifndef __HAVE_ATOMIC64_OPS +# include "sanitizer_atomic_clang_mips.h" +# endif #endif #undef ATOMIC_ORDER diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_flags.inc dist/libsanitizer/sanitizer_common/sanitizer_flags.inc --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_flags.inc 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_flags.inc 2025-11-14 01:50:21 @@ -28,7 +28,7 @@ "Path to external symbolizer. If empty, the tool will search $PATH for " "the symbolizer.") COMMON_FLAG( - bool, allow_addr2line, false, + bool, allow_addr2line, true, "If set, allows online symbolizer to run addr2line binary to symbolize " "stack traces (addr2line will only be used if llvm-symbolizer binary is " "unavailable.") diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h 2025-11-14 01:50:21 @@ -186,8 +186,11 @@ #if (SANITIZER_WORDSIZE == 64) || SANITIZER_APPLE typedef uptr operator_new_size_type; +#elifdef __SIZE_TYPE__ +typedef __SIZE_TYPE__ operator_new_size_type; #else -# if defined(__s390__) && !defined(__s390x__) +# if (defined(__s390__) && !defined(__s390x__)) || \ + (SANITIZER_NETBSD && (defined(__sparc__) || defined(__hppa__) || defined(__mips__))) // Special case: 31-bit s390 has unsigned long as size_t. typedef unsigned long operator_new_size_type; # else diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_leb128.h dist/libsanitizer/sanitizer_common/sanitizer_leb128.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_leb128.h 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_leb128.h 2025-11-14 01:50:21 @@ -38,8 +38,10 @@ unsigned shift = 0; u8 byte; do { - if (UNLIKELY(begin == end)) + if (UNLIKELY(begin == end)) { + *v = 0; return begin; + } byte = *(begin++); T slice = byte & 0x7f; value |= slice << shift; diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp dist/libsanitizer/sanitizer_common/sanitizer_linux.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_linux.cpp 2025-11-14 01:50:21 @@ -34,7 +34,7 @@ // format. Struct kernel_stat is defined as 'struct stat' in asm/stat.h. To // access stat from asm/stat.h, without conflicting with definition in // sys/stat.h, we use this trick. -#if SANITIZER_MIPS64 +#if SANITIZER_MIPS64 && !SANITIZER_NETBSD #include #include #define stat kernel_stat @@ -50,6 +50,10 @@ #undef stat #endif +#if SANITIZER_NETBSD +#include +#endif + #include #include #include @@ -671,6 +675,41 @@ } #endif +#if SANITIZER_NETBSD +static char ** +load_vector(int m) +{ + uptr size; + int nv; + char **v, **ap, *bp, *buf, *endp; + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, getpid(), 0}; + size = sizeof(nv); + mib[3] = m == KERN_PROC_ARGV ? KERN_PROC_NARGV : KERN_PROC_NENV; + if (internal_sysctl(mib, 4, &nv, &size, NULL, 0) == -1) { + Printf("sysctl KERN_PROC_N{ARGV,ENV} failed\n"); + Die(); + } + v = (char **)MmapOrDie((nv + 1) * sizeof(char *), "Arg vector"); + buf = (char *)MmapOrDie(ARG_MAX, "Arg space"); + size = ARG_MAX; + mib[3] = m; + if (internal_sysctl(mib, 4, buf, &size, NULL, 0) == -1) { + Printf("sysctl KERN_PROC_{ARGV,ENV} failed\n"); + Die(); + } + bp = buf; + ap = v; + endp = bp + size; + + while (bp < endp) { + *ap++ = bp; + bp += internal_strlen(bp) + 1; + } + *ap = NULL; + return v; +} +#endif + static void GetArgsAndEnv(char ***argv, char ***envp) { #if SANITIZER_FREEBSD // On FreeBSD, retrieving the argument and environment arrays is done via the @@ -685,8 +724,8 @@ *argv = pss->ps_argvstr; *envp = pss->ps_envstr; #elif SANITIZER_NETBSD - *argv = __ps_strings->ps_argvstr; - *envp = __ps_strings->ps_envstr; + *argv = load_vector(KERN_PROC_ARGV); + *envp = load_vector(KERN_PROC_ENV); #else // SANITIZER_FREEBSD #if !SANITIZER_GO if (&__libc_stack_end) { @@ -1900,12 +1939,15 @@ #if SANITIZER_LINUX && defined(__aarch64__) // Android headers in the older NDK releases miss this definition. +#if SANITIZER_LINUX struct __sanitizer_esr_context { struct _aarch64_ctx head; uint64_t esr; }; +#endif static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) { +#if SANITIZER_LINUX static const u32 kEsrMagic = 0x45535201; u8 *aux = reinterpret_cast(ucontext->uc_mcontext.__reserved); while (true) { @@ -1917,10 +1959,11 @@ } aux += ctx->size; } +#endif return false; } -#elif SANITIZER_FREEBSD && defined(__aarch64__) -// FreeBSD doesn't provide ESR in the ucontext. +#elif (SANITIZER_FREEBSD || SANITIZER_NETBSD) && defined(__aarch64__) +// FreeBSD/NetBSD don't provide ESR in the ucontext. static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) { return false; } @@ -1948,7 +1991,12 @@ uint32_t faulty_instruction; uint32_t op_code; +#if SANITIZER_NETBSD + ucontext_t *nucontext = (ucontext_t *)ucontext; + exception_source = (uint32_t *)_UC_MACHINE_PC(nucontext); +#else exception_source = (uint32_t *)ucontext->uc_mcontext.pc; +#endif faulty_instruction = (uint32_t)(*exception_source); op_code = (faulty_instruction >> 26) & 0x3f; @@ -1992,7 +2040,7 @@ #endif } return SignalContext::Unknown; -#elif defined(__arm__) +#elif defined(__arm__) && !SANITIZER_NETBSD static const uptr FSR_WRITE = 1U << 11; uptr fsr = ucontext->uc_mcontext.error_code; return fsr & FSR_WRITE ? Write : Read; @@ -2013,6 +2061,8 @@ // From OpenSolaris $SRC/uts/sun4/os/trap.c (get_accesstype). #if SANITIZER_SOLARIS uptr pc = ucontext->uc_mcontext.gregs[REG_PC]; +#elif SANITIZER_NETBSD + uptr pc = ucontext->uc_mcontext.__gregs[_REG_PC]; #else // Historical BSDism here. struct sigcontext *scontext = (struct sigcontext *)context; @@ -2027,6 +2077,8 @@ #elif defined(__riscv) #if SANITIZER_FREEBSD unsigned long pc = ucontext->uc_mcontext.mc_gpregs.gp_sepc; +#elif SANITIZER_NETBSD + uptr pc = ucontext->uc_mcontext.__gregs[_REG_PC]; #else unsigned long pc = ucontext->uc_mcontext.__gregs[REG_PC]; #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp 2025-11-14 01:50:21 @@ -29,10 +29,6 @@ #include "sanitizer_procmaps.h" #include "sanitizer_solaris.h" -#if SANITIZER_NETBSD -#define _RTLD_SOURCE // for __lwp_gettcb_fast() / __lwp_getprivate_fast() -#endif - #include // for dlsym() #include #include @@ -60,6 +56,8 @@ #include #include #include +// for __lwp_gettcb_fast() / __lwp_getprivate_fast() +#include #endif #if SANITIZER_SOLARIS diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_mutex.h dist/libsanitizer/sanitizer_common/sanitizer_mutex.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_mutex.h 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_mutex.h 2025-11-14 01:50:21 @@ -41,7 +41,13 @@ } void CheckLocked() const SANITIZER_CHECK_LOCKED() { - CHECK_EQ(atomic_load(&state_, memory_order_relaxed), 1); + // __sync_lock_test_and_set (as used under the hood of the bespoke + // atomic_exchange here) does not always store the value we asked + // to store -- it just stores some nonzero value. On sparc, this + // is 0xff. On vax, this is whatever was there before but with the + // low-order bit set. So test for a nonzero value, rather than for + // the specific value 1. + CHECK_NE(atomic_load(&state_, memory_order_relaxed), 0); } private: diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc dist/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc 2025-11-14 01:50:21 @@ -18,7 +18,7 @@ using namespace __sanitizer; #if SANITIZER_NETBSD -#define sigaction_symname __sigaction14 +#define sigaction_symname __sigaction_siginfo #else #define sigaction_symname sigaction #endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp dist/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp 2025-11-14 01:50:21 @@ -58,7 +58,7 @@ #endif uptr Unwind_GetIP(struct _Unwind_Context *ctx) { -#if defined(__arm__) && !SANITIZER_APPLE +#if defined(__arm__) && !SANITIZER_APPLE && !SANITIZER_NETBSD uptr val; _Unwind_VRS_Result res = _Unwind_VRS_Get(ctx, _UVRSC_CORE, 15 /* r15 = PC */, _UVRSD_UINT32, &val); diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_dense_alloc.h dist/libsanitizer/tsan/tsan_dense_alloc.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_dense_alloc.h 2025-05-23 13:02:08 +++ dist/libsanitizer/tsan/tsan_dense_alloc.h 2025-11-14 01:50:21 @@ -162,7 +162,7 @@ u64 cmp = atomic_load(&freelist_, memory_order_acquire); do { head->next = static_cast(cmp); - xchg = head_idx | (cmp & kCounterMask) + kCounterInc; + xchg = head_idx | ((cmp & kCounterMask) + kCounterInc); } while (!atomic_compare_exchange_weak(&freelist_, &cmp, xchg, memory_order_acq_rel)); } diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_interceptors_posix.cpp dist/libsanitizer/tsan/tsan_interceptors_posix.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_interceptors_posix.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/tsan/tsan_interceptors_posix.cpp 2025-11-14 01:50:21 @@ -480,8 +480,12 @@ // due to atexit_mu held on exit from the calloc interceptor. ScopedIgnoreInterceptors ignore; +#if !SANITIZER_NETBSD res = REAL(__cxa_atexit)((void (*)(void *a))at_exit_callback_installed_at, 0, 0); +#else + res = REAL(atexit)((void (*)())at_exit_callback_installed_at); +#endif // Push AtExitCtx on the top of the stack of callback functions if (!res) { interceptor_ctx()->AtExitStack.PushBack(ctx); @@ -1103,7 +1107,7 @@ { SCOPED_INTERCEPTOR_RAW(pthread_exit, retval); #if !SANITIZER_APPLE && !SANITIZER_ANDROID - CHECK_EQ(thr, &cur_thread_placeholder); + CHECK_EQ(thr, reinterpret_cast((reinterpret_cast(cur_thread_placeholder) + SANITIZER_CACHE_LINE_SIZE - 1) & ~static_cast(SANITIZER_CACHE_LINE_SIZE - 1))); #endif } REAL(pthread_exit)(retval); @@ -2828,7 +2832,7 @@ Die(); } -#if !SANITIZER_APPLE && !SANITIZER_ANDROID +#if !SANITIZER_APPLE && !SANITIZER_ANDROID && !SANITIZER_NETBSD static void unreachable() { Report("FATAL: ThreadSanitizer: unreachable called\n"); Die(); @@ -2990,6 +2994,9 @@ TSAN_MAYBE_INTERCEPT_ON_EXIT; TSAN_INTERCEPT(__cxa_atexit); TSAN_INTERCEPT(_exit); +#ifdef SANITIZER_NETBSD + TSAN_INTERCEPT(atexit); +#endif #ifdef NEED_TLS_GET_ADDR #if !SANITIZER_S390 @@ -3003,13 +3010,18 @@ TSAN_MAYBE_INTERCEPT__LWP_EXIT; TSAN_MAYBE_INTERCEPT_THR_EXIT; -#if !SANITIZER_APPLE && !SANITIZER_ANDROID +#if !SANITIZER_APPLE && !SANITIZER_ANDROID && !SANITIZER_NETBSD // Need to setup it, because interceptors check that the function is resolved. // But atexit is emitted directly into the module, so can't be resolved. REAL(atexit) = (int(*)(void(*)()))unreachable; #endif - if (REAL(__cxa_atexit)(&finalize, 0, 0)) { +#if !SANITIZER_NETBSD + if (REAL(__cxa_atexit)(&finalize, 0, 0)) +#else + if (REAL(atexit)((void (*)())&finalize)) +#endif + { Printf("ThreadSanitizer: failed to setup atexit callback\n"); Die(); } diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_platform_linux.cpp dist/libsanitizer/tsan/tsan_platform_linux.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_platform_linux.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/tsan/tsan_platform_linux.cpp 2025-11-14 01:50:21 @@ -423,6 +423,8 @@ #if SANITIZER_NETBSD # ifdef __x86_64__ # define LONG_JMP_SP_ENV_SLOT 6 +# elifdef __aarch64__ +# define LONG_JMP_SP_ENV_SLOT 1 # else # error unsupported # endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_rtl.cpp dist/libsanitizer/tsan/tsan_rtl.cpp --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_rtl.cpp 2025-05-23 13:02:08 +++ dist/libsanitizer/tsan/tsan_rtl.cpp 2025-11-14 01:50:21 @@ -45,12 +45,16 @@ int (*on_finalize)(int); #endif +// XXX PR lib/58349 (https://gnats.NetBSD.org/58349): NetBSD ld.elf_so +// doesn't support TLS alignment beyond void *, so we have to buffer +// some extra space and do the alignment ourselves at all the reference +// sites. #if !SANITIZER_GO && !SANITIZER_APPLE __attribute__((tls_model("initial-exec"))) -THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState)] ALIGNED( +THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState) + SANITIZER_CACHE_LINE_SIZE - 1] ALIGNED( SANITIZER_CACHE_LINE_SIZE); #endif -static char ctx_placeholder[sizeof(Context)] ALIGNED(SANITIZER_CACHE_LINE_SIZE); +static char ctx_placeholder[sizeof(Context) + SANITIZER_CACHE_LINE_SIZE - 1] ALIGNED(SANITIZER_CACHE_LINE_SIZE); Context *ctx; // Can be overriden by a front-end. @@ -688,7 +692,7 @@ // Install tool-specific callbacks in sanitizer_common. SetCheckUnwindCallback(CheckUnwind); - ctx = new(ctx_placeholder) Context; + ctx = new(reinterpret_cast((reinterpret_cast(ctx_placeholder) + SANITIZER_CACHE_LINE_SIZE - 1) & ~static_cast(SANITIZER_CACHE_LINE_SIZE - 1))) Context; const char *env_name = SANITIZER_GO ? "GORACE" : "TSAN_OPTIONS"; const char *options = GetEnv(env_name); CacheBinaryName(); diff -Nru /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_rtl.h dist/libsanitizer/tsan/tsan_rtl.h --- /Users/io/Downloads/gcc-14.3.0/libsanitizer/tsan/tsan_rtl.h 2025-05-23 13:02:08 +++ dist/libsanitizer/tsan/tsan_rtl.h 2025-11-14 01:50:21 @@ -157,7 +157,7 @@ // This struct is stored in TLS. struct ThreadState { - FastState fast_state; + FastState fast_state ALIGNED(SANITIZER_CACHE_LINE_SIZE); int ignore_sync; #if !SANITIZER_GO int ignore_interceptors; @@ -246,16 +246,16 @@ __attribute__((tls_model("initial-exec"))) extern THREADLOCAL char cur_thread_placeholder[]; inline ThreadState *cur_thread() { - return reinterpret_cast(cur_thread_placeholder)->current; + return reinterpret_cast((reinterpret_cast(cur_thread_placeholder) + SANITIZER_CACHE_LINE_SIZE - 1) & ~static_cast(SANITIZER_CACHE_LINE_SIZE - 1))->current; } inline ThreadState *cur_thread_init() { - ThreadState *thr = reinterpret_cast(cur_thread_placeholder); + ThreadState *thr = reinterpret_cast((reinterpret_cast(cur_thread_placeholder) + SANITIZER_CACHE_LINE_SIZE - 1) & ~static_cast(SANITIZER_CACHE_LINE_SIZE - 1)); if (UNLIKELY(!thr->current)) thr->current = thr; return thr->current; } inline void set_cur_thread(ThreadState *thr) { - reinterpret_cast(cur_thread_placeholder)->current = thr; + reinterpret_cast((reinterpret_cast(cur_thread_placeholder) + SANITIZER_CACHE_LINE_SIZE - 1) & ~static_cast(SANITIZER_CACHE_LINE_SIZE - 1))->current = thr; } inline void cur_thread_finalize() { } # endif // SANITIZER_APPLE || SANITIZER_ANDROID diff -Nru /Users/io/Downloads/gcc-14.3.0/libssp/configure dist/libssp/configure --- /Users/io/Downloads/gcc-14.3.0/libssp/configure 2025-05-23 13:02:08 +++ dist/libssp/configure 2025-11-14 01:50:22 @@ -2291,15 +2291,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/acinclude.m4 dist/libstdc++-v3/acinclude.m4 --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/acinclude.m4 2025-05-23 13:02:08 +++ dist/libstdc++-v3/acinclude.m4 2025-11-14 01:50:22 @@ -2804,7 +2804,7 @@ vxworks*) enable_clocale_flag=vxworks ;; - dragonfly* | freebsd*) + dragonfly* | freebsd* | netbsd*) enable_clocale_flag=dragonfly ;; openbsd*) @@ -2915,7 +2915,7 @@ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h ;; dragonfly) - AC_MSG_RESULT(dragonfly or freebsd) + AC_MSG_RESULT(dragonfly or freebsd or netbsd) CLOCALE_H=config/locale/dragonfly/c_locale.h CLOCALE_CC=config/locale/dragonfly/c_locale.cc diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/abi/pre/gnu.ver dist/libstdc++-v3/config/abi/pre/gnu.ver --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/abi/pre/gnu.ver 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/abi/pre/gnu.ver 2025-11-14 01:50:22 @@ -1068,7 +1068,10 @@ #ifdef HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT # GLIBCXX_ABI compatibility only. # std::string + # XXXMRG this causes dupe symbols on netbsd +#if 0 _ZNKSs11_M_disjunctEPKc; +#endif _ZNKSs15_M_check_lengthE[jmy][jmy]PKc; _ZNSs4_Rep26_M_set_length_and_sharableE*; _ZNSs7_M_copyEPcPKc[jmy]; @@ -1076,7 +1079,10 @@ _ZNSs9_M_assignEPc[jmy]c; # std::wstring + # XXXMRG this causes dupe symbols on netbsd +#if 0 _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw; +#endif _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthE[jmy][jmy]PKc; _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableE*; _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKw[jmy]; diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/io/basic_file_stdio.cc dist/libstdc++-v3/config/io/basic_file_stdio.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/io/basic_file_stdio.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/io/basic_file_stdio.cc 2025-11-14 01:50:22 @@ -211,7 +211,7 @@ { this->close(); } __basic_file* - __basic_file::sys_open(__c_file* __file, ios_base::openmode) + __basic_file::sys_open(__c_file* __file, ios_base::openmode __mode) { __basic_file* __ret = NULL; if (!this->is_open() && __file) @@ -220,7 +220,7 @@ // POSIX guarantees that fflush sets errno on error, but C doesn't. errno = 0; do - __err = fflush(__file); + __err = (__mode == std::ios_base::in ? 0 : fflush(__file)); while (__err && errno == EINTR); errno = __save_errno; if (!__err) diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/c_locale.cc dist/libstdc++-v3/config/locale/dragonfly/c_locale.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/c_locale.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/c_locale.cc 2025-11-14 01:50:22 @@ -28,13 +28,17 @@ // Written by Benjamin Kosnik // Modified for DragonFly by John Marino +// Modified for NetBSD by Christos Zoulas and +// matthew green #include #include #include #include #include +#ifndef __NetBSD__ #include +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -188,6 +192,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const char* const* const locale::_S_categories = __gnu_cxx::category_names; + +#ifdef __NetBSD__ + int + __convert_from_v(const __c_locale& __cloc, char* __out, + const int __size __attribute__ ((__unused__)), + const char* __fmt, ...) + { + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + + const int __ret = vsnprintf_l(__out, __size, (struct _locale *)__cloc, + __fmt, __args); + + __builtin_va_end(__args); + + return __ret; + } +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/c_locale.h dist/libstdc++-v3/config/locale/dragonfly/c_locale.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/c_locale.h 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/c_locale.h 2025-11-14 01:50:22 @@ -33,6 +33,8 @@ // Written by Benjamin Kosnik // Modified for DragonFly by John Marino +// Modified for NetBSD by Christos Zoulas and +// matthew green #ifndef _GLIBCXX_CXX_LOCALE_H #define _GLIBCXX_CXX_LOCALE_H 1 @@ -40,7 +42,9 @@ #pragma GCC system_header #include +#ifndef __NetBSD__ #include +#endif #define _GLIBCXX_NUM_CATEGORIES 0 @@ -50,6 +54,7 @@ typedef int* __c_locale; +#ifndef __NetBSD__ // Convert numeric value of type double and long double to string and // return length of string. If vsnprintf is available use it, otherwise // fall back to the unsafe vsprintf which, in general, can be dangerous @@ -75,6 +80,15 @@ uselocale((locale_t)__old); return __ret; } +#else + // NetBSD backend requires vasprintf_l() which may not be visible in + // all complation environments (eg, _XOPEN_SOURCE=600) so the backend + // lives in the library code, instead of this header. + int + __convert_from_v(const __c_locale& __cloc, char* __out, + const int __size __attribute__ ((__unused__)), + const char* __fmt, ...); +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc 2025-11-14 01:50:22 @@ -34,6 +34,8 @@ #include // For MB_CUR_MAX #include // For MB_LEN_MAX +#include "xlocale_port.h" + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -50,8 +52,6 @@ result __ret = ok; state_type __tmp_state(__state); - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_codecvt); - // wcsnrtombs is *very* fast but stops if encounters NUL characters: // in case we fall back to wcrtomb and then continue, in a loop. // NB: wcsnrtombs is a GNU extension @@ -65,16 +65,18 @@ __from_chunk_end = __from_end; __from = __from_next; - const size_t __conv = wcsnrtombs(__to_next, &__from_next, + const size_t __conv = wcsnrtombs_l(__to_next, &__from_next, __from_chunk_end - __from_next, - __to_end - __to_next, &__state); + __to_end - __to_next, &__state, + (locale_t)_M_c_locale_codecvt); if (__conv == static_cast(-1)) { // In case of error, in order to stop at the exact place we // have to start again from the beginning with a series of // wcrtomb. for (; __from < __from_next; ++__from) - __to_next += wcrtomb(__to_next, *__from, &__tmp_state); + __to_next += wcrtomb_l(__to_next, *__from, &__tmp_state, + (locale_t)_M_c_locale_codecvt); __state = __tmp_state; __ret = error; } @@ -93,7 +95,8 @@ { extern_type __buf[MB_LEN_MAX]; __tmp_state = __state; - const size_t __conv2 = wcrtomb(__buf, *__from_next, &__tmp_state); + const size_t __conv2 = wcrtomb_l(__buf, *__from_next, &__tmp_state, + (locale_t)_M_c_locale_codecvt); if (__conv2 > static_cast(__to_end - __to_next)) __ret = partial; else @@ -106,8 +109,6 @@ } } - uselocale((locale_t)__old); - return __ret; } @@ -121,8 +122,6 @@ result __ret = ok; state_type __tmp_state(__state); - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_codecvt); - // mbsnrtowcs is *very* fast but stops if encounters NUL characters: // in case we store a L'\0' and then continue, in a loop. // NB: mbsnrtowcs is a GNU extension @@ -138,9 +137,10 @@ __from_chunk_end = __from_end; __from = __from_next; - size_t __conv = mbsnrtowcs(__to_next, &__from_next, + size_t __conv = mbsnrtowcs_l(__to_next, &__from_next, __from_chunk_end - __from_next, - __to_end - __to_next, &__state); + __to_end - __to_next, &__state, + (locale_t)_M_c_locale_codecvt); if (__conv == static_cast(-1)) { // In case of error, in order to stop at the exact place we @@ -148,8 +148,8 @@ // mbrtowc. for (;; ++__to_next, __from += __conv) { - __conv = mbrtowc(__to_next, __from, __from_end - __from, - &__tmp_state); + __conv = mbrtowc_l(__to_next, __from, __from_end - __from, + &__tmp_state, (locale_t)_M_c_locale_codecvt); if (__conv == static_cast(-1) || __conv == static_cast(-2)) break; @@ -184,8 +184,6 @@ } } - uselocale((locale_t)__old); - return __ret; } @@ -195,23 +193,15 @@ { // XXX This implementation assumes that the encoding is // stateless and is either single-byte or variable-width. - int __ret = 0; - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_codecvt); - if (MB_CUR_MAX == 1) - __ret = 1; - uselocale((locale_t)__old); - return __ret; + return MB_CUR_MAX_L((locale_t)_M_c_locale_codecvt) == 1 ? 1 : 0; } int codecvt:: do_max_length() const throw() { - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_codecvt); // XXX Probably wrong for stateful encodings. - int __ret = MB_CUR_MAX; - uselocale((locale_t)__old); - return __ret; + return MB_CUR_MAX_L((locale_t)_M_c_locale_codecvt); } int @@ -222,8 +212,6 @@ int __ret = 0; state_type __tmp_state(__state); - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_codecvt); - // mbsnrtowcs is *very* fast but stops if encounters NUL characters: // in case we advance past it and then continue, in a loop. // NB: mbsnrtowcs is a GNU extension @@ -242,9 +230,10 @@ __from_chunk_end = __end; const extern_type* __tmp_from = __from; - size_t __conv = mbsnrtowcs(__to, &__from, + size_t __conv = mbsnrtowcs_l(__to, &__from, __from_chunk_end - __from, - __max, &__state); + __max, &__state, + (locale_t)_M_c_locale_codecvt); if (__conv == static_cast(-1)) { // In case of error, in order to stop at the exact place we @@ -252,8 +241,8 @@ // mbrtowc. for (__from = __tmp_from;; __from += __conv) { - __conv = mbrtowc(0, __from, __end - __from, - &__tmp_state); + __conv = mbrtowc_l(0, __from, __end - __from, + &__tmp_state, (locale_t)_M_c_locale_codecvt); if (__conv == static_cast(-1) || __conv == static_cast(-2)) break; @@ -277,8 +266,6 @@ --__max; } } - - uselocale((locale_t)__old); return __ret; } diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/ctype_members.cc dist/libstdc++-v3/config/locale/dragonfly/ctype_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/ctype_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/ctype_members.cc 2025-11-14 01:50:22 @@ -33,6 +33,8 @@ #include #include +#include "xlocale_port.h" + #ifndef _ISbit #define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8)) #endif @@ -96,9 +98,11 @@ case graph: __ret = wctype_l("graph", (locale_t)_M_c_locale_ctype); break; +#ifndef __NetBSD__ case blank: __ret = wctype_l("blank", (locale_t)_M_c_locale_ctype); break; +#endif default: __ret = __wmask_type(); } @@ -135,6 +139,60 @@ return __hi; } + bool + ctype:: + do_is(mask __m, char_type __c) const + { + bool __ret = false; + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (__m & _M_bit[__bitcur] + && iswctype(__c, _M_wmask[__bitcur])) + { + __ret = true; + break; + } + return __ret; + } + + const wchar_t* + ctype:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const + { + for (;__lo < __hi; ++__vec, ++__lo) + { + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + mask __m = 0; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (iswctype(*__lo, _M_wmask[__bitcur])) + __m |= _M_bit[__bitcur]; + *__vec = __m; + } + return __hi; + } + + const wchar_t* + ctype:: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi && !this->do_is(__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype:: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { + while (__lo < __hi && this->do_is(__m, *__lo) != 0) + ++__lo; + return __lo; + } + wchar_t ctype:: do_widen(char __c) const @@ -159,9 +217,7 @@ { if (__wc >= 0 && __wc < 128 && _M_narrow_ok) return _M_narrow[__wc]; - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_ctype); - const int __c = wctob(__wc); - uselocale((locale_t)__old); + const int __c = wctob_l(__wc, (locale_t)_M_c_locale_ctype); return (__c == EOF ? __dfault : static_cast(__c)); } @@ -170,7 +226,6 @@ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, char* __dest) const { - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_ctype); if (_M_narrow_ok) while (__lo < __hi) { @@ -178,7 +233,7 @@ *__dest = _M_narrow[*__lo]; else { - const int __c = wctob(*__lo); + const int __c = wctob_l(*__lo, (locale_t)_M_c_locale_ctype); *__dest = (__c == EOF ? __dfault : static_cast(__c)); } ++__lo; @@ -187,23 +242,21 @@ else while (__lo < __hi) { - const int __c = wctob(*__lo); + const int __c = wctob_l(*__lo, (locale_t)_M_c_locale_ctype); *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++__lo; ++__dest; } - uselocale((locale_t)__old); return __hi; } void ctype::_M_initialize_ctype() throw() { - __c_locale __old = (__c_locale)uselocale((locale_t)_M_c_locale_ctype); wint_t __i; for (__i = 0; __i < 128; ++__i) { - const int __c = wctob(__i); + const int __c = wctob_l(__i, (locale_t)_M_c_locale_ctype); if (__c == EOF) break; else @@ -222,7 +275,6 @@ _M_bit[__k] = static_cast(_ISbit(__k)); _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); } - uselocale((locale_t)__old); } #endif // _GLIBCXX_USE_WCHAR_T diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/monetary_members.cc dist/libstdc++-v3/config/locale/dragonfly/monetary_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/monetary_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/monetary_members.cc 2025-11-14 01:50:22 @@ -31,8 +31,9 @@ #include #include -#include +#include "xlocale_port.h" + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -581,7 +582,6 @@ } else { - __c_locale __old = (__c_locale)uselocale((locale_t)__cloc); // Named locale. lconv* lc = localeconv_l((locale_t) __cloc); @@ -647,7 +647,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); __wcs_ps = new wchar_t[__len + 1]; - mbsrtowcs(__wcs_ps, &__cpossign, __len + 1, &__state); + mbsrtowcs_l(__wcs_ps, &__cpossign, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_positive_sign = __wcs_ps; } else @@ -662,7 +663,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); __wcs_ns = new wchar_t[__len + 1]; - mbsrtowcs(__wcs_ns, &__cnegsign, __len + 1, &__state); + mbsrtowcs_l(__wcs_ps, &__cpossign, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_negative_sign = __wcs_ns; } else @@ -676,7 +678,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); wchar_t* __wcs = new wchar_t[__len + 1]; - mbsrtowcs(__wcs, &__ccurr, __len + 1, &__state); + mbsrtowcs_l(__wcs, &__ccurr, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_curr_symbol = __wcs; } else @@ -690,7 +693,6 @@ delete [] __group; delete [] __wcs_ps; delete [] __wcs_ns; - uselocale((locale_t)__old); __throw_exception_again; } @@ -703,8 +705,6 @@ char __nspace = lc->int_n_sep_by_space; _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); - - uselocale((locale_t)__old); } } @@ -741,7 +741,6 @@ } else { - __c_locale __old = (__c_locale)uselocale((locale_t)__cloc); // Named locale. lconv* lc = localeconv_l((locale_t) __cloc); @@ -807,7 +806,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); __wcs_ps = new wchar_t[__len + 1]; - mbsrtowcs(__wcs_ps, &__cpossign, __len + 1, &__state); + mbsrtowcs_l(__wcs_ps, &__cpossign, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_positive_sign = __wcs_ps; } else @@ -822,7 +822,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); __wcs_ns = new wchar_t[__len + 1]; - mbsrtowcs(__wcs_ns, &__cnegsign, __len + 1, &__state); + mbsrtowcs_l(__wcs_ns, &__cnegsign, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_negative_sign = __wcs_ns; } else @@ -836,7 +837,8 @@ { memset(&__state, 0, sizeof(mbstate_t)); wchar_t* __wcs = new wchar_t[__len + 1]; - mbsrtowcs(__wcs, &__ccurr, __len + 1, &__state); + mbsrtowcs_l(__wcs, &__ccurr, __len + 1, &__state, + (locale_t)__cloc); _M_data->_M_curr_symbol = __wcs; } else @@ -850,7 +852,6 @@ delete [] __group; delete [] __wcs_ps; delete [] __wcs_ns; - uselocale((locale_t)__old); __throw_exception_again; } @@ -863,8 +864,6 @@ char __nspace = lc->n_sep_by_space; _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); - - uselocale((locale_t)__old); } } diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/numeric_members.cc dist/libstdc++-v3/config/locale/dragonfly/numeric_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/numeric_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/numeric_members.cc 2025-11-14 01:50:22 @@ -31,7 +31,8 @@ #include #include -#include + +#include "xlocale_port.h" namespace std _GLIBCXX_VISIBILITY(default) { diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/time_members.cc dist/libstdc++-v3/config/locale/dragonfly/time_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/time_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/dragonfly/time_members.cc 2025-11-14 01:50:22 @@ -35,7 +35,8 @@ #include #include #include -#include + +#include "xlocale_port.h" namespace std _GLIBCXX_VISIBILITY(default) { diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/xlocale_port.h dist/libstdc++-v3/config/locale/dragonfly/xlocale_port.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/dragonfly/xlocale_port.h 1970-01-01 01:00:00 +++ dist/libstdc++-v3/config/locale/dragonfly/xlocale_port.h 2025-11-14 01:50:22 @@ -0,0 +1,70 @@ +#ifndef __NetBSD__ +#include + +static __inline int +MB_CUR_MAX_L(locale_t __l) { + locale_t __old = uselocale(__l); + size_t __rv = MB_CUR_MAX; + (void)uselocale(__old); + return __rv; +} + +static __inline size_t +wcsnrtombs_l(char * __restrict __to, const wchar_t ** __restrict __from, + size_t __nwc, size_t __len, mbstate_t * __restrict __st, locale_t __l) +{ + locale_t __old = uselocale(__l); + size_t __rv = wcsnrtombs(__to, __from, __nwc, __len, __st); + (void)uselocale(__old); + return __rv; +} + +static __inline size_t +mbsnrtowcs_l(wchar_t * __restrict __to, const char ** __restrict __from, + size_t __nms, size_t __len, mbstate_t * __restrict __st, locale_t __l) +{ + locale_t __old = uselocale(__l); + size_t __rv = mbsnrtowcs(__to, __from, __nms, __len, __st); + (void)uselocale(__old); + return __rv; +} + +static __inline size_t +wcrtomb_l(char * __restrict __to, wchar_t __from, + mbstate_t * __restrict __st, locale_t __l) +{ + locale_t __old = uselocale(__l); + size_t __rv = wcrtomb(__to, __from, __st); + (void)uselocale(__old); + return __rv; +} + +static __inline size_t +mbrtowc_l(wchar_t * __restrict __to, const char * __restrict __from, + size_t __len, mbstate_t * __restrict __st, locale_t __l) +{ + locale_t __old = uselocale(__l); + size_t __rv = mbrtowc(__to, __from, __len, __st); + (void)uselocale(__old); + return __rv; +} + +static __inline size_t +mbsrtowcs_l(wchar_t * __restrict __to, const char ** __restrict __from, + size_t __len, mbstate_t * __restrict __st, locale_t __l) +{ + locale_t __old = uselocale(__l); + size_t __rv = mbsrtowcs(__to, __from, __len, __st); + (void)uselocale(__old); + return __rv; +} + +static __inline int +wctob_l(wint_t __wc, locale_t __l) +{ + locale_t __old = uselocale(__l); + int __rv = wctob(__wc); + (void)uselocale(__old); + return __rv; +} +#endif diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/generic/time_members.cc dist/libstdc++-v3/config/locale/generic/time_members.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/config/locale/generic/time_members.cc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/config/locale/generic/time_members.cc 2025-11-14 01:50:22 @@ -205,6 +205,10 @@ _M_data->_M_amonth11 = L"Nov"; _M_data->_M_amonth12 = L"Dec"; } + template<> + __timepunct::~__timepunct() + { + } #endif _GLIBCXX_END_NAMESPACE_VERSION diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure dist/libstdc++-v3/configure --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure 2025-05-23 13:03:15 +++ dist/libstdc++-v3/configure 2025-11-14 01:50:22 @@ -3153,15 +3153,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done @@ -3298,6 +3298,9 @@ # We are being configured with some form of cross compiler. GLIBCXX_IS_NATIVE=false case "$host","$target" in + *-*-netbsd*,*-*-netbsd*) + GLIBCXX_IS_NATIVE=true + ;; # Darwin crosses can use the host system's libraries and headers, # because of the fat library support. Of course, it must be the # same version of Darwin on both sides. Allow the user to @@ -16676,7 +16679,7 @@ vxworks*) enable_clocale_flag=vxworks ;; - dragonfly* | freebsd*) + dragonfly* | freebsd* | netbsd*) enable_clocale_flag=dragonfly ;; openbsd*) @@ -16841,8 +16844,8 @@ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h ;; dragonfly) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly or freebsd" >&5 -$as_echo "dragonfly or freebsd" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly or freebsd or netbsd" >&5 +$as_echo "dragonfly or freebsd or netbsd" >&6; } CLOCALE_H=config/locale/dragonfly/c_locale.h CLOCALE_CC=config/locale/dragonfly/c_locale.cc diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure.ac dist/libstdc++-v3/configure.ac --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure.ac 2025-05-23 13:02:08 +++ dist/libstdc++-v3/configure.ac 2025-11-14 01:50:22 @@ -37,6 +37,9 @@ # We are being configured with some form of cross compiler. GLIBCXX_IS_NATIVE=false case "$host","$target" in + *-*-netbsd*,*-*-netbsd*) + GLIBCXX_IS_NATIVE=true + ;; # Darwin crosses can use the host system's libraries and headers, # because of the fat library support. Of course, it must be the # same version of Darwin on both sides. Allow the user to diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure.host dist/libstdc++-v3/configure.host --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/configure.host 2025-05-23 13:02:08 +++ dist/libstdc++-v3/configure.host 2025-11-14 01:50:22 @@ -173,7 +173,10 @@ # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS. # THIS TABLE IS SORTED. KEEP IT THAT WAY. if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then +# The sh atomicity.h is unusable +if test ${cpu_include_dir} != "cpu/sh"; then atomicity_dir=$cpu_include_dir +fi fi diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/crossconfig.m4 dist/libstdc++-v3/crossconfig.m4 --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/crossconfig.m4 2025-05-23 13:02:08 +++ dist/libstdc++-v3/crossconfig.m4 2025-11-14 01:50:22 @@ -202,14 +202,51 @@ SECTION_FLAGS='-ffunction-sections -fdata-sections' AC_SUBST(SECTION_FLAGS) GLIBCXX_CHECK_LINKER_FEATURES + + AC_DEFINE(HAVE_ICONV) + AC_DEFINE(HAVE_ICONV_CLOSE) + AC_DEFINE(HAVE_ICONV_OPEN) + AC_DEFINE(HAVE_LC_MESSAGES) + + AC_DEFINE(HAVE_MMAP) + AC_DEFINE(HAVE_GETPAGESIZE) + AC_DEFINE(HAVE_SETENV) + AC_DEFINE(HAVE_SIGSETJMP) + AC_DEFINE(HAVE_FINITEF) AC_DEFINE(HAVE_FINITE) AC_DEFINE(HAVE_FREXPF) + AC_DEFINE(HAVE_HYPOT) AC_DEFINE(HAVE_HYPOTF) AC_DEFINE(HAVE_ISINF) AC_DEFINE(HAVE_ISINFF) AC_DEFINE(HAVE_ISNAN) AC_DEFINE(HAVE_ISNANF) + AC_DEFINE(HAVE_ACOSF) + AC_DEFINE(HAVE_ASINF) + AC_DEFINE(HAVE_ATAN2F) + AC_DEFINE(HAVE_ATANF) + AC_DEFINE(HAVE_CEILF) + AC_DEFINE(HAVE_COSF) + AC_DEFINE(HAVE_COSHF) + AC_DEFINE(HAVE_EXPF) + AC_DEFINE(HAVE_FABSF) + AC_DEFINE(HAVE_FLOORF) + AC_DEFINE(HAVE_FMODF) + AC_DEFINE(HAVE_FREXPF) + AC_DEFINE(HAVE_LDEXPF) + AC_DEFINE(HAVE_LOG10F) + AC_DEFINE(HAVE_LOGF) + AC_DEFINE(HAVE_MODF) + AC_DEFINE(HAVE_MODFF) + AC_DEFINE(HAVE_POWF) + AC_DEFINE(HAVE_SINF) + AC_DEFINE(HAVE_SINHF) + AC_DEFINE(HAVE_SQRTF) + AC_DEFINE(HAVE_STRTOF) + AC_DEFINE(HAVE_STRTOLD) + AC_DEFINE(HAVE_TANF) + AC_DEFINE(HAVE_TANHF) if test x"long_double_math_on_this_cpu" = x"yes"; then AC_DEFINE(HAVE_FINITEL) AC_DEFINE(HAVE_ISINFL) diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/boost_concept_check.h dist/libstdc++-v3/include/bits/boost_concept_check.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/boost_concept_check.h 2025-05-23 13:02:08 +++ dist/libstdc++-v3/include/bits/boost_concept_check.h 2025-11-14 01:50:22 @@ -129,7 +129,7 @@ struct _SameTypeConcept { void __constraints() { - typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required; + typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required _IsUnused; } }; @@ -459,11 +459,11 @@ void __constraints() { __function_requires< _TrivialIteratorConcept<_Tp> >(); // require iterator_traits typedef's - typedef typename std::iterator_traits<_Tp>::difference_type _Diff; + typedef typename std::iterator_traits<_Tp>::difference_type _Diff _IsUnused; // __function_requires< _SignedIntegerConcept<_Diff> >(); - typedef typename std::iterator_traits<_Tp>::reference _Ref; - typedef typename std::iterator_traits<_Tp>::pointer _Pt; - typedef typename std::iterator_traits<_Tp>::iterator_category _Cat; + typedef typename std::iterator_traits<_Tp>::reference _Ref _IsUnused; + typedef typename std::iterator_traits<_Tp>::pointer _Pt _IsUnused; + typedef typename std::iterator_traits<_Tp>::iterator_category _Cat _IsUnused; __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::input_iterator_tag> >(); @@ -619,7 +619,7 @@ __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::random_access_iterator_tag> >(); - typedef typename std::iterator_traits<_Tp>::reference _Ref; + typedef typename std::iterator_traits<_Tp>::reference _Ref _IsUnused; _Tp& __j = __i += __n; // require assignment addition operator __i = __i + __n; __i = __n + __i; // require addition with difference type diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/charconv.h dist/libstdc++-v3/include/bits/charconv.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/charconv.h 2025-05-23 13:02:08 +++ dist/libstdc++-v3/include/bits/charconv.h 2025-11-14 01:50:22 @@ -46,7 +46,7 @@ // This accepts 128-bit integers even in strict mode. template constexpr bool __integer_to_chars_is_unsigned - = ! __gnu_cxx::__int_traits<_Tp>::__is_signed; + = ! __gnu_cxx::__int_traits<_Tp>::__is_signed_val; #endif // Generic implementation for arbitrary bases. diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/locale_facets.tcc dist/libstdc++-v3/include/bits/locale_facets.tcc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/locale_facets.tcc 2025-05-23 13:02:08 +++ dist/libstdc++-v3/include/bits/locale_facets.tcc 2025-11-14 01:50:22 @@ -470,7 +470,7 @@ bool __testfail = false; bool __testoverflow = false; const __unsigned_type __max = - (__negative && __num_traits::__is_signed) + (__negative && __num_traits::__is_signed_val) ? -static_cast<__unsigned_type>(__num_traits::__min) : __num_traits::__max; const __unsigned_type __smax = __max / __base; @@ -573,7 +573,7 @@ } else if (__testoverflow) { - if (__negative && __num_traits::__is_signed) + if (__negative && __num_traits::__is_signed_val) __v = __num_traits::__min; else __v = __num_traits::__max; @@ -917,7 +917,7 @@ if (__v >= 0) { if (bool(__flags & ios_base::showpos) - && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) + && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed_val) *--__cs = __lit[__num_base::_S_oplus], ++__len; } else diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/locale_facets_nonio.h dist/libstdc++-v3/include/bits/locale_facets_nonio.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/locale_facets_nonio.h 2025-05-23 13:02:08 +++ dist/libstdc++-v3/include/bits/locale_facets_nonio.h 2025-11-14 01:50:22 @@ -336,6 +336,8 @@ #ifdef _GLIBCXX_USE_WCHAR_T template<> + __timepunct::~__timepunct(); + template<> void __timepunct::_M_initialize_timepunct(__c_locale __cloc); diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/stl_algo.h dist/libstdc++-v3/include/bits/stl_algo.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/stl_algo.h 2025-05-23 13:02:08 +++ dist/libstdc++-v3/include/bits/stl_algo.h 2025-11-14 01:50:22 @@ -1665,9 +1665,9 @@ { #ifdef _GLIBCXX_CONCEPT_CHECKS typedef typename iterator_traits<_InputIterator>::value_type - _InputValueType; + _InputValueType __attribute__((__unused__)); typedef typename iterator_traits<_RandomAccessIterator>::value_type - _OutputValueType; + _OutputValueType __attribute__((__unused__)); #endif // concept requirements @@ -1717,9 +1717,9 @@ { #ifdef _GLIBCXX_CONCEPT_CHECKS typedef typename iterator_traits<_InputIterator>::value_type - _InputValueType; + _InputValueType __attribute__((__unused__)); typedef typename iterator_traits<_RandomAccessIterator>::value_type - _OutputValueType; + _OutputValueType __attribute__((__unused__)); #endif // concept requirements diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/uniform_int_dist.h dist/libstdc++-v3/include/bits/uniform_int_dist.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/bits/uniform_int_dist.h 2025-05-23 13:02:09 +++ dist/libstdc++-v3/include/bits/uniform_int_dist.h 2025-11-14 01:50:22 @@ -258,8 +258,8 @@ { using _Up_traits = __gnu_cxx::__int_traits<_Up>; using _Wp_traits = __gnu_cxx::__int_traits<_Wp>; - static_assert(!_Up_traits::__is_signed, "U must be unsigned"); - static_assert(!_Wp_traits::__is_signed, "W must be unsigned"); + static_assert(!_Up_traits::__is_signed_val, "U must be unsigned"); + static_assert(!_Wp_traits::__is_signed_val, "W must be unsigned"); static_assert(_Wp_traits::__digits == (2 * _Up_traits::__digits), "W must be twice as wide as U"); diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/ext/numeric_traits.h dist/libstdc++-v3/include/ext/numeric_traits.h --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/ext/numeric_traits.h 2025-05-23 13:02:09 +++ dist/libstdc++-v3/include/ext/numeric_traits.h 2025-11-14 01:50:22 @@ -67,15 +67,15 @@ // NB: these two are also available in std::numeric_limits as compile // time constants, but is big and we can avoid including it. - static const bool __is_signed = (_Value)(-1) < 0; + static const bool __is_signed_val = (_Value)(-1) < 0; static const int __digits - = __is_integer_nonstrict<_Value>::__width - __is_signed; + = __is_integer_nonstrict<_Value>::__width - __is_signed_val; // The initializers must be constants so that __max and __min are too. - static const _Value __max = __is_signed + static const _Value __max = __is_signed_val ? (((((_Value)1 << (__digits - 1)) - 1) << 1) + 1) : ~(_Value)0; - static const _Value __min = __is_signed ? -__max - 1 : (_Value)0; + static const _Value __min = __is_signed_val ? -__max - 1 : (_Value)0; }; template @@ -85,7 +85,7 @@ const _Value __numeric_traits_integer<_Value>::__max; template - const bool __numeric_traits_integer<_Value>::__is_signed; + const bool __numeric_traits_integer<_Value>::__is_signed_val; template const int __numeric_traits_integer<_Value>::__digits; @@ -161,7 +161,7 @@ static const int __max_digits10 = __glibcxx_max_digits10(_Value); // See above comment... - static const bool __is_signed = true; + static const bool __is_signed_val = true; static const int __digits10 = __glibcxx_digits10(_Value); static const int __max_exponent10 = __glibcxx_max_exponent10(_Value); }; @@ -170,7 +170,7 @@ const int __numeric_traits_floating<_Value>::__max_digits10; template - const bool __numeric_traits_floating<_Value>::__is_signed; + const bool __numeric_traits_floating<_Value>::__is_signed_val; template const int __numeric_traits_floating<_Value>::__digits10; @@ -210,7 +210,7 @@ struct __numeric_traits_floating<__ibm128> { static const int __max_digits10 = 33; - static const bool __is_signed = true; + static const bool __is_signed_val = true; static const int __digits10 = 31; static const int __max_exponent10 = 308; }; @@ -224,7 +224,7 @@ struct __numeric_traits_floating<__ieee128> { static const int __max_digits10 = 36; - static const bool __is_signed = true; + static const bool __is_signed_val = true; static const int __digits10 = 33; static const int __max_exponent10 = 4932; }; diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/std/complex dist/libstdc++-v3/include/std/complex --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/include/std/complex 2025-05-23 13:02:09 +++ dist/libstdc++-v3/include/std/complex 2025-11-14 01:50:22 @@ -44,6 +44,16 @@ #include #include +#if _GLIBCXX_USE_C99_COMPLEX +// This is disgusting; we can't include ccomplex because that requires c++11 +// and we can't use the builtins because those point to the wrong +// ABI-wise cabs/cabsf so we manually declare those here and use +// them directly. +extern "C" float __c99_cabsf(_Complex float); +extern "C" double __c99_cabs(_Complex double); +extern "C" long double __c99_cabsl(_Complex long double); +#endif + // Get rid of a macro possibly defined in #undef complex @@ -877,15 +887,16 @@ } #if _GLIBCXX_USE_C99_COMPLEX + // XXX: We can't use __builtin_cabs* because they are broken inline float - __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } + __complex_abs(__complex__ float __z) { return __c99_cabsf(__z); } inline double - __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } + __complex_abs(__complex__ double __z) { return __c99_cabs(__z); } inline long double __complex_abs(const __complex__ long double& __z) - { return __builtin_cabsl(__z); } + { return __c99_cabsl(__z); } template inline _Tp diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/libsupc++/atexit_arm.cc dist/libstdc++-v3/libsupc++/atexit_arm.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/libsupc++/atexit_arm.cc 2025-05-23 13:02:09 +++ dist/libstdc++-v3/libsupc++/atexit_arm.cc 2025-11-14 01:50:22 @@ -23,7 +23,7 @@ #include -#if defined(__arm__) && defined(__ARM_EABI__) +#if defined(__arm__) && defined(__ARM_EABI__) && !defined(__NetBSD__) namespace __aeabiv1 { diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++11/ctype.cc dist/libstdc++-v3/src/c++11/ctype.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++11/ctype.cc 2025-05-23 13:02:09 +++ dist/libstdc++-v3/src/c++11/ctype.cc 2025-11-14 01:50:22 @@ -53,7 +53,11 @@ ctype::~ctype() { +#if 0 + // There is no constructor for the char specialization, and + // _M_c_locale_ctype is uninitialized, found by jemalloc _S_destroy_c_locale(_M_c_locale_ctype); +#endif if (_M_del) delete[] this->table(); } diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++11/random.cc dist/libstdc++-v3/src/c++11/random.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++11/random.cc 2025-05-23 13:02:09 +++ dist/libstdc++-v3/src/c++11/random.cc 2025-11-14 01:50:22 @@ -100,7 +100,10 @@ #if USE_RDRAND unsigned int + __attribute__ ((noinline)) +# ifndef __clang__ __attribute__ ((target("rdrnd"))) +# endif __x86_rdrand(void*) { unsigned int retries = 100; @@ -116,7 +119,10 @@ #if USE_RDSEED unsigned int + __attribute__ ((noinline)) +# ifndef __clang__ __attribute__ ((target("rdseed"))) +# endif __x86_rdseed(void* fallback) { unsigned int retries = 100; diff -Nru /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++98/compatibility.cc dist/libstdc++-v3/src/c++98/compatibility.cc --- /Users/io/Downloads/gcc-14.3.0/libstdc++-v3/src/c++98/compatibility.cc 2025-05-23 13:02:09 +++ dist/libstdc++-v3/src/c++98/compatibility.cc 2025-11-14 01:50:22 @@ -397,11 +397,11 @@ asm (".symver " #cur "," #old "@@" #version); #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER -#include +#include #undef _GLIBCXX_APPLY_SYMVER #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER -#include +#include #undef _GLIBCXX_APPLY_SYMVER diff -Nru /Users/io/Downloads/gcc-14.3.0/lto-plugin/configure dist/lto-plugin/configure --- /Users/io/Downloads/gcc-14.3.0/lto-plugin/configure 2025-05-23 13:02:09 +++ dist/lto-plugin/configure 2025-11-14 01:50:22 @@ -2379,15 +2379,15 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" + ac_install_sh="$SHELL $ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" + ac_install_sh="$SHELL $ac_aux_dir/shtool install -c" break fi done