From 8b91d5a2da18e1a8092570adfc7d0221124b7817 Mon Sep 17 00:00:00 2001 From: Yn0ga Date: Thu, 5 Oct 2023 19:58:27 +0000 Subject: [PATCH] Update PPC toolchain, should fix #18474 (due to https://github.com/gcc-mirror/gcc/commit/62045234757dbe0e3c44eef4cc952e773eea784e) Change-Id: I5d070da18160b26bab1d29454f1c2c7799b6dcab Reviewed-on: https://review.haiku-os.org/c/buildtools/+/6984 Reviewed-by: Niels Sascha Reedijk Reviewed-by: Adrien Destugues --- gcc/gcc/config.gcc | 2 +- gcc/gcc/config/haiku.h | 1 + gcc/gcc/config/rs6000/haiku.h | 21 ++++++++++++++++++++- gcc/libgcc/config.host | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc index 4bf2366c75..b8d3fbef9c 100644 --- a/gcc/gcc/config.gcc +++ b/gcc/gcc/config.gcc @@ -3010,7 +3010,7 @@ powerpc-*-eabi*) ;; powerpc-*-haiku*) tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppcos rs6000/t-ppccomm t-haiku" - tm_file="${tm_file} elfos.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku.h haiku-stdint.h" + tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku.h haiku-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt" ;; powerpc-*-rtems*) diff --git a/gcc/gcc/config/haiku.h b/gcc/gcc/config/haiku.h index 88adc25772..b768dfdf1c 100644 --- a/gcc/gcc/config/haiku.h +++ b/gcc/gcc/config/haiku.h @@ -59,6 +59,7 @@ Boston, MA 02111-1307, USA. */ #undef CC1PLUS_SPEC #define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}" +#undef SUBTARGET_OVERRIDE_OPTIONS #define SUBTARGET_OVERRIDE_OPTIONS \ do { \ haiku_override_options (); \ diff --git a/gcc/gcc/config/rs6000/haiku.h b/gcc/gcc/config/rs6000/haiku.h index 8c2e8054b8..59be0b821e 100644 --- a/gcc/gcc/config/rs6000/haiku.h +++ b/gcc/gcc/config/rs6000/haiku.h @@ -28,6 +28,10 @@ Boston, MA 02111-1307, USA. */ #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128*/ +/* Undef gnu-user.h macros we don't want. */ +#undef CPLUSPLUS_CPP_SPEC +#undef LINK_GCC_C_SEQUENCE_SPEC + #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do \ @@ -35,7 +39,7 @@ Boston, MA 02111-1307, USA. */ builtin_define ("__HAIKU__"); \ builtin_define ("__POWERPC__"); \ builtin_define ("__powerpc__"); \ - builtin_define ("__STDC_ISO_10646__=201103L"); \ + builtin_define ("__STDC_ISO_10646__=201103L"); \ builtin_assert ("system=haiku"); \ builtin_assert ("cpu=powerpc"); \ builtin_assert ("machine=powerpc"); \ @@ -52,3 +56,18 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SPEC #define LINK_SPEC "-m elf32ppchaiku %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" + +/* override options from sysv4.h */ +#undef SUBTARGET_OVERRIDE_OPTIONS +#define SUBTARGET_OVERRIDE_OPTIONS \ + do { \ + rs6000_abi_name = "sysv"; \ + rs6000_current_abi = ABI_V4; \ + rs6000_sdata = SDATA_DATA; \ + rs6000_sdata_name = "data"; \ + /*secure_plt = true;*/ \ + rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \ + TARGET_NO_FP_IN_TOC = 1; \ + haiku_override_options (); \ + } + while (0) diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host index 662bc116ec..d096a0bf16 100644 --- a/gcc/libgcc/config.host +++ b/gcc/libgcc/config.host @@ -1221,6 +1221,7 @@ powerpc*-*-freebsd*) esac ;; powerpc-*-haiku*) + tmake_file="$tmake_file rs6000/t-ppccomm rs6000/t-savresfpgr rs6000/t-crtstuff rs6000/t-crtstuff-pic t-fdpbit" ;; powerpc-*-netbsd*) tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff"