diff --git a/sys-devel/gcc/gcc-11.2.0_2021_07_28.recipe b/sys-devel/gcc/gcc-11.2.0_2021_07_28.recipe index f39b8349e..6c5ba8647 100644 --- a/sys-devel/gcc/gcc-11.2.0_2021_07_28.recipe +++ b/sys-devel/gcc/gcc-11.2.0_2021_07_28.recipe @@ -5,7 +5,7 @@ HOMEPAGE="https://gcc.gnu.org/" COPYRIGHT="1988-2021 Free Software Foundation, Inc." LICENSE="GNU GPL v3 GNU LGPL v3" -REVISION="5" +REVISION="6" gccVersion="${portVersion%%_*}" SOURCE_URI="https://ftpmirror.gnu.org/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.xz https://ftp.gnu.org/gnu/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.xz" diff --git a/sys-devel/gcc/patches/gcc-11.2.0_2021_07_28.patchset b/sys-devel/gcc/patches/gcc-11.2.0_2021_07_28.patchset index a70a8fa07..80e006694 100644 --- a/sys-devel/gcc/patches/gcc-11.2.0_2021_07_28.patchset +++ b/sys-devel/gcc/patches/gcc-11.2.0_2021_07_28.patchset @@ -1,14 +1,90 @@ -From 195e64f760c95cd5e66aa4f0b3bd2b076a51f69a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= -Date: Sun, 19 Jul 2015 18:55:34 +0200 -Subject: Haiku patch +From 964833714fdbe47fbaaaa2cf6394ee2f5f344591 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Fri, 18 Mar 2022 10:25:16 -0500 +Subject: [PATCH 1/3] gcc: Complete gcc 11.2.0 port for Haiku +--- + config.rpath | 2 + + configure | 28 +- + configure.ac | 14 +- + gcc/Makefile.in | 20 +- + gcc/config.gcc | 70 ++++- + gcc/config.host | 10 +- + gcc/config/aarch64/aarch64-haiku.h | 73 +++++ + gcc/config/aarch64/t-aarch64-haiku | 21 ++ + gcc/config/arm/haiku.h | 73 +++++ + gcc/config/arm/t-haiku | 21 ++ + gcc/config/haiku-protos.h | 21 ++ + gcc/config/haiku-stdint.h | 55 ++++ + gcc/config/haiku.c | 32 +++ + gcc/config/haiku.h | 218 ++++++++++++++ + gcc/config/i386/haiku.h | 77 +++++ + gcc/config/i386/haiku64.h | 135 +++++++++ + gcc/config/i386/t-haiku64 | 16 ++ + gcc/config/m68k/haiku.h | 268 ++++++++++++++++++ + gcc/config/mips/haiku.h | 44 +++ + gcc/config/riscv/haiku.h | 57 ++++ + gcc/config/riscv/t-haiku | 4 + + gcc/config/rs6000/haiku.h | 56 ++++ + gcc/config/sparc/haiku.h | 93 ++++++ + gcc/config/sparc/t-haiku | 5 + + gcc/config/t-haiku | 9 + + gcc/configure | 36 ++- + gcc/configure.ac | 20 +- + gcc/ginclude/stdarg.h | 2 +- + gcc/ginclude/stddef.h | 10 +- + include/filenames.h | 4 + + libatomic/configure | 33 ++- + libatomic/configure.ac | 24 +- + libatomic/configure.tgt | 2 +- + libcody/configure | 2 +- + libgcc/config.host | 37 ++- + libgcc/config/aarch64/haiku-unwind.h | 51 ++++ + libgcc/config/t-haiku | 3 + + libgcc/crtstuff.c | 2 + + libgomp/configure | 40 ++- + libgomp/configure.ac | 16 +- + libstdc++-v3/acinclude.m4 | 3 + + libstdc++-v3/config/os/haiku/ctype_base.h | 61 ++++ + .../config/os/haiku/ctype_configure_char.cc | 99 +++++++ + libstdc++-v3/config/os/haiku/ctype_inline.h | 173 +++++++++++ + .../config/os/haiku/error_constants.h | 178 ++++++++++++ + libstdc++-v3/config/os/haiku/os_defines.h | 48 ++++ + libstdc++-v3/configure | 102 ++++++- + libstdc++-v3/configure.host | 5 +- + libstdc++-v3/crossconfig.m4 | 44 ++- + libstdc++-v3/libsupc++/tinfo.cc | 9 + + libtool.m4 | 11 +- + 51 files changed, 2355 insertions(+), 82 deletions(-) + create mode 100644 gcc/config/aarch64/aarch64-haiku.h + create mode 100644 gcc/config/aarch64/t-aarch64-haiku + create mode 100644 gcc/config/arm/haiku.h + create mode 100644 gcc/config/arm/t-haiku + create mode 100644 gcc/config/haiku-protos.h + create mode 100644 gcc/config/haiku-stdint.h + create mode 100644 gcc/config/haiku.c + create mode 100644 gcc/config/haiku.h + create mode 100644 gcc/config/i386/haiku.h + create mode 100644 gcc/config/i386/haiku64.h + create mode 100644 gcc/config/i386/t-haiku64 + create mode 100644 gcc/config/m68k/haiku.h + create mode 100644 gcc/config/mips/haiku.h + create mode 100644 gcc/config/riscv/haiku.h + create mode 100644 gcc/config/riscv/t-haiku + create mode 100644 gcc/config/rs6000/haiku.h + create mode 100644 gcc/config/sparc/haiku.h + create mode 100644 gcc/config/sparc/t-haiku + create mode 100644 gcc/config/t-haiku + create mode 100644 libgcc/config/aarch64/haiku-unwind.h + create mode 100644 libgcc/config/t-haiku + create mode 100644 libstdc++-v3/config/os/haiku/ctype_base.h + create mode 100644 libstdc++-v3/config/os/haiku/ctype_configure_char.cc + create mode 100644 libstdc++-v3/config/os/haiku/ctype_inline.h + create mode 100644 libstdc++-v3/config/os/haiku/error_constants.h + create mode 100644 libstdc++-v3/config/os/haiku/os_defines.h -diff --git a/compile b/compile -old mode 100755 -new mode 100644 diff --git a/config.rpath b/config.rpath -index 4dea759..5bcc5be 100755 +index 4dea75957..5bcc5be17 100755 --- a/config.rpath +++ b/config.rpath @@ -161,6 +161,8 @@ if test "$with_gnu_ld" = yes; then @@ -20,58 +96,110 @@ index 4dea759..5bcc5be 100755 solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no -diff --git a/config/acx.m4 b/config/acx.m4 -index 87c1b5e..d9d53ca 100644 ---- a/config/acx.m4 -+++ b/config/acx.m4 -@@ -428,24 +428,30 @@ dnl for the parameter format "cmp file1 file2 skip1 skip2" which is - dnl accepted by cmp on some systems. - AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL], - [AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip, --[ echo abfoo >t1 -- echo cdfoo >t2 -- gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' -- if cmp t1 t2 2 2 > /dev/null 2>&1; then -- if cmp t1 t2 1 1 > /dev/null 2>&1; then -- : -- else -- gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' -+[# comparing object files via cmp doesn't work on haiku (files will seemingly -+ # always differ), so we disassemble both files and compare the results: -+ if uname -o | grep -iq haiku; then -+ gcc_cv_prog_cmp_skip='objdump -Dz $$f1 | tail +6 >tmp-foo1; objdump -Dz $$f2 | tail +6 >tmp-foo2; cmp tmp-foo1 tmp-foo2' -+ else -+ echo abfoo >t1 -+ echo cdfoo >t2 -+ gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' -+ if cmp t1 t2 2 2 > /dev/null 2>&1; then -+ if cmp t1 t2 1 1 > /dev/null 2>&1; then -+ : -+ else -+ gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' -+ fi +diff --git a/configure b/configure +index 504f64102..97a67b203 100755 +--- a/configure ++++ b/configure +@@ -756,6 +756,7 @@ infodir + docdir + oldincludedir + includedir ++runstatedir + localstatedir + sharedstatedir + sysconfdir +@@ -922,6 +923,7 @@ datadir='${datarootdir}' + sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' ++runstatedir='${localstatedir}/run' + includedir='${prefix}/include' + oldincludedir='/usr/include' + docdir='${datarootdir}/doc/${PACKAGE}' +@@ -1174,6 +1176,15 @@ do + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + ++ -runstatedir | --runstatedir | --runstatedi | --runstated \ ++ | --runstate | --runstat | --runsta | --runst | --runs \ ++ | --run | --ru | --r) ++ ac_prev=runstatedir ;; ++ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ ++ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ ++ | --run=* | --ru=* | --r=*) ++ runstatedir=$ac_optarg ;; ++ + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ +@@ -1311,7 +1322,7 @@ fi + for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ +- libdir localedir mandir ++ libdir localedir mandir runstatedir + do + eval ac_val=\$$ac_var + # Remove trailing slashes. +@@ -1471,6 +1482,7 @@ Fine tuning of the installation directories: + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] ++ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] +@@ -3108,6 +3120,9 @@ case "${host}" in + i[3456789]86-*-msdosdjgpp*) + noconfigdirs="$noconfigdirs tcl tk itcl" + ;; ++ *-*-haiku*) ++ noconfigdirs="$noconfigdirs tk itcl libgui gdb" ++ ;; + esac + + +@@ -3213,7 +3228,7 @@ if test x$enable_libgomp = x ; then + ;; + *-*-solaris2* | *-*-hpux11*) + ;; +- *-*-darwin* | *-*-aix*) ++ *-*-darwin* | *-*-aix* | *-*-haiku*) + ;; + nvptx*-*-* | amdgcn*-*-*) + ;; +@@ -3493,6 +3508,9 @@ case "${target}" in + *-*-darwin*) + noconfigdirs="$noconfigdirs target-libffi" + ;; ++ *-*-haiku*) ++ noconfigdirs="$noconfigdirs ${libgcj}" ++ ;; + *-*-netware*) + noconfigdirs="$noconfigdirs target-libffi" + ;; +@@ -3702,6 +3720,9 @@ case "${target}" in + *-*-freebsd*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; ++ *-*-haiku*) ++ noconfigdirs="$noconfigdirs target-newlib target-libgloss" ++ ;; + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; +@@ -3766,6 +3787,9 @@ case "${target}" in + with_gmp=/usr/local fi -- fi -- if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then -- if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then -- : -- else -- gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' -+ if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then -+ if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then -+ : -+ else -+ gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' -+ fi - fi -+ rm t1 t2 - fi -- rm t1 t2 - ]) - do_compare="$gcc_cv_prog_cmp_skip" - AC_SUBST(do_compare) + ;; ++ *-*-haiku*) ++ noconfigdirs="$noconfigdirs gdb target-libiberty" ++ ;; + *-*-kaos*) + # Remove unsupported stuff on all kaOS configurations. + noconfigdirs="$noconfigdirs target-libgloss" diff --git a/configure.ac b/configure.ac -index 088e735..57861b2 100644 +index 088e735c5..57861b29f 100644 --- a/configure.ac +++ b/configure.ac @@ -420,6 +420,9 @@ case "${host}" in @@ -124,7 +252,7 @@ index 088e735..57861b2 100644 # Remove unsupported stuff on all kaOS configurations. noconfigdirs="$noconfigdirs target-libgloss" diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index 8a5fb3f..00da7f9 100644 +index 8a5fb3fd9..11a1e63ab 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -106,6 +106,8 @@ build_objdir := $(toplevel_builddir)/$(build_subdir) @@ -136,17 +264,39 @@ index 8a5fb3f..00da7f9 100644 # -------- # Defined vpaths # -------- -@@ -2292,6 +2294,10 @@ DRIVER_DEFINES = \ +@@ -271,7 +273,7 @@ NO_PIE_CFLAGS = @NO_PIE_CFLAGS@ + NO_PIE_FLAG = @NO_PIE_FLAG@ + + # We don't want to compile the compilers with -fPIE, it make PCH fail. +-COMPILER += $(NO_PIE_CFLAGS) ++#COMPILER += $(NO_PIE_CFLAGS) + + # Link with -no-pie since we compile the compiler with -fno-PIE. + LINKER += $(NO_PIE_FLAG) +@@ -802,9 +804,9 @@ NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@ + NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@ + BUILD_CFLAGS= @BUILD_CFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE + BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE +-BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@ +-BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS) +-BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS) ++#BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@ ++#BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS) ++#BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS) + + # Native compiler that we use. This may be C++ some day. + COMPILER_FOR_BUILD = $(CXX_FOR_BUILD) +@@ -2291,6 +2293,10 @@ DRIVER_DEFINES = \ + -DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\"" \ -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\" - ++ +ifneq ($(HYBRID_SECONDARY),) +DRIVER_DEFINES += -DHYBRID_SECONDARY="\"$(HYBRID_SECONDARY)\"" +endif -+ + CFLAGS-gcc.o += $(DRIVER_DEFINES) -DBASEVER=$(BASEVER_s) gcc.o: $(BASEVER) - @@ -2935,7 +2941,7 @@ $(genprogerr:%=build/gen%$(build_exeext)): $(BUILD_ERRORS) genprog = $(genprogerr) check checksum match @@ -168,10 +318,19 @@ index 8a5fb3f..00da7f9 100644 cppbuiltin.o: $(BASEVER) diff --git a/gcc/config.gcc b/gcc/config.gcc -index 357b0be..d397d87 100644 +index 357b0bed0..98128be40 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -825,6 +825,19 @@ case ${target} in +@@ -180,7 +180,7 @@ + # the --with-sysroot configure option or the + # --sysroot command line option is used this + # will be relative to the sysroot. +-# target_type_format_char ++# target_type_format_char + # The default character to be used for formatting + # the attribute in a + # .type symbol_name, ${t_t_f_c} +@@ -825,6 +825,21 @@ case ${target} in *-*-fuchsia*) native_system_header_dir=/include ;; @@ -187,11 +346,26 @@ index 357b0be..d397d87 100644 + "" | yes | posix) thread_file='posix' ;; + esac + default_use_cxa_atexit=yes ++ tm_p_file="${tm_p_file} haiku-protos.h" ++ extra_objs="${extra_objs} haiku.o" + ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) extra_options="$extra_options gnu-user.opt" gas=yes -@@ -1303,6 +1316,16 @@ arm*-*-netbsdelf*) +@@ -1133,6 +1148,12 @@ aarch64*-*-netbsd*) + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; ++aarch64*-*-haiku*) ++ gcc_cv_initfini_array=yes ++ tm_file="${tm_file} dbxelf.h elfos.h haiku.h haiku-stdint.h" ++ tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-haiku.h" ++ tmake_file="${tmake_file} t-haiku aarch64/t-aarch64 aarch64/t-aarch64-haiku" ++ ;; + aarch64*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-linux.h" +@@ -1303,6 +1324,16 @@ arm*-*-netbsdelf*) armv7*) target_cpu_cname="generic-armv7-a";; esac ;; @@ -208,7 +382,7 @@ index 357b0be..d397d87 100644 arm*-*-linux-* | arm*-*-uclinuxfdpiceabi) tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" extra_options="${extra_options} linux-android.opt" -@@ -1923,6 +1946,14 @@ i[34567]86-*-freebsd*) +@@ -1923,6 +1954,14 @@ i[34567]86-*-freebsd*) x86_64-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" ;; @@ -223,7 +397,7 @@ index 357b0be..d397d87 100644 i[34567]86-*-netbsdelf*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" -@@ -2415,6 +2446,13 @@ m68k-*-rtems*) +@@ -2415,6 +2454,13 @@ m68k-*-rtems*) tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h" tm_defines="${tm_defines} MOTOROLA=1" ;; @@ -231,40 +405,75 @@ index 357b0be..d397d87 100644 + default_m68k_cpu=68020 + default_cf_cpu=5206 + tmake_file="${tmake_file} m68k/t-m68kbare m68k/t-crtstuff t-haiku" #?? -+ tm_file="${tm_file} dbxelf.h elfos.h haiku.h m68k/haiku.h" ++ tm_file="${tm_file} dbxelf.h elfos.h haiku.h m68k/haiku.h haiku-stdint.h" + tm_defines="${tm_defines} MOTOROLA=1" + ;; mcore-*-elf) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h" tmake_file=mcore/t-mcore -@@ -2552,6 +2590,11 @@ mips*-mti-linux*) +@@ -2466,6 +2512,13 @@ microblaze*-*-elf) + cxx_target_objs="${cxx_target_objs} microblaze-c.o" + tmake_file="${tmake_file} microblaze/t-microblaze" + ;; ++riscv*-*-haiku*) ++ gcc_cv_initfini_array=yes ++ tm_file="elfos.h haiku.h ${tm_file} riscv/haiku.h haiku-stdint.h" ++ tmake_file="${tmake_file} t-haiku riscv/t-riscv riscv/t-haiku" ++ gnu_ld=yes ++ gas=yes ++ ;; + riscv*-*-linux*) + tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h" + case "x${enable_multilib}" in +@@ -2552,6 +2605,11 @@ mips*-mti-linux*) gnu_ld=yes gas=yes ;; +mipsel-*-haiku*) + target_cpu_default="MASK_ABICALLS" -+ tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h" ++ tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h haiku-stdint.h" + tmake_file="${tmake_file} mips/t-elf t-haiku" + ;; mips*-*-linux*) # Linux MIPS, either endian. tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h" extra_options="${extra_options} linux-android.opt" -@@ -2977,6 +3020,11 @@ powerpc-*-eabi*) +@@ -2977,6 +3035,11 @@ powerpc-*-eabi*) tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" use_gcc_stdint=wrap ;; +powerpc-*-haiku*) + tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppcos rs6000/t-ppccomm t-haiku" -+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku.h" ++ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku.h haiku-stdint.h" + extra_options="${extra_options} rs6000/sysv4.opt" + ;; powerpc-*-rtems*) tm_file="rs6000/biarch64.h ${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/rtems.h rtems.h" extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt" +@@ -3429,6 +3492,11 @@ sparc64-*-rtems*) + extra_options="${extra_options}" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64" + ;; ++sparc64-*-haiku*) ++ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h haiku.h sparc/haiku.h haiku-stdint.h" ++ extra_options="${extra_options}" ++ tmake_file="${tmake_file} t-haiku sparc/t-sparc sparc/t-haiku" ++ ;; + sparc64-*-linux*) + tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default64.h sparc/linux64.h sparc/tso.h" + extra_options="${extra_options} sparc/long-double-switch.opt" diff --git a/gcc/config.host b/gcc/config.host -index 0a02c33..72d0a79 100644 +index 0a02c33cc..4ab7ae647 100644 --- a/gcc/config.host +++ b/gcc/config.host +@@ -99,7 +99,7 @@ case ${host} in + esac + + case ${host} in +- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) ++ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* | aarch64*-*-haiku*) + case ${target} in + aarch64*-*-*) + host_extra_gcc_objs="driver-aarch64.o" @@ -107,7 +107,7 @@ case ${host} in ;; esac @@ -280,20 +489,126 @@ index 0a02c33..72d0a79 100644 ;; - mips*-*-linux*) + mips*-*-linux* \ -+ | mips*-*-haiku* ) ++ | mips*-*-haiku*) case ${target} in - mips*-*-linux*) + mips*-*-linux* \ -+ | mips*-*-haiku* ) ++ | mips*-*-haiku*) host_extra_gcc_objs="driver-native.o" host_xmake_file="${host_xmake_file} mips/x-native" ;; +diff --git a/gcc/config/aarch64/aarch64-haiku.h b/gcc/config/aarch64/aarch64-haiku.h +new file mode 100644 +index 000000000..2305a5575 +--- /dev/null ++++ b/gcc/config/aarch64/aarch64-haiku.h +@@ -0,0 +1,73 @@ ++/* Machine description for AArch64 architecture. ++ Copyright (C) 2009-2018 Free Software Foundation, Inc. ++ Contributed by ARM Ltd. ++ Updated for Haiku by Jaroslaw Pelczar ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ GCC is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++ ++#ifndef GCC_AARCH64_HAIKU_H ++#define GCC_AARCH64_HAIKU_H ++ ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ builtin_define ("__HAIKU__"); \ ++ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ ++ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ ++ builtin_define ("__STDC_ISO_10646__=201103L"); \ ++ builtin_assert ("system=haiku"); \ ++ } \ ++ while (0) ++ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_LINKER_EMULATION "aarch64haikub" ++#else ++#define TARGET_LINKER_EMULATION "aarch64haiku" ++#endif ++ ++#if TARGET_FIX_ERR_A53_835769_DEFAULT ++#define CA53_ERR_835769_SPEC \ ++ " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" ++#else ++#define CA53_ERR_835769_SPEC \ ++ " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" ++#endif ++ ++#if TARGET_FIX_ERR_A53_843419_DEFAULT ++#define CA53_ERR_843419_SPEC \ ++ " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" ++#else ++#define CA53_ERR_843419_SPEC \ ++ " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" ++#endif ++ ++ ++/* Uninitialized common symbols in non-PIE executables, even with ++ strong definitions in dependent shared libraries, will resolve ++ to COPY relocated symbol in the executable. See PR65780. */ ++#undef TARGET_BINDS_LOCAL_P ++#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 ++ ++/* Define this to be nonzero if static stack checking is supported. */ ++#define STACK_CHECK_STATIC_BUILTIN 1 ++ ++ ++#undef LINK_SPEC ++#define LINK_SPEC "-m " TARGET_LINKER_EMULATION " %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}\ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL} " CA53_ERR_835769_SPEC " " CA53_ERR_843419_SPEC " -X" ++ ++#endif /* GCC_AARCH64_HAIKU_H */ +diff --git a/gcc/config/aarch64/t-aarch64-haiku b/gcc/config/aarch64/t-aarch64-haiku +new file mode 100644 +index 000000000..99d3dea36 +--- /dev/null ++++ b/gcc/config/aarch64/t-aarch64-haiku +@@ -0,0 +1,21 @@ ++# Machine description for AArch64 architecture. ++# Copyright (C) 2016-2018 Free Software Foundation, Inc. ++# ++# This file is part of GCC. ++# ++# GCC is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3, or (at your option) ++# any later version. ++# ++# GCC is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING3. If not see ++# . ++ ++LIB1ASMSRC = aarch64/lib1funcs.asm ++LIB1ASMFUNCS = _aarch64_sync_cache_range diff --git a/gcc/config/arm/haiku.h b/gcc/config/arm/haiku.h new file mode 100644 -index 0000000..f0c0d63 +index 000000000..e0e56cd2d --- /dev/null +++ b/gcc/config/arm/haiku.h -@@ -0,0 +1,80 @@ +@@ -0,0 +1,73 @@ +/* Definitions for ARM running Haiku systems using ELF + Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. @@ -341,7 +656,6 @@ index 0000000..f0c0d63 +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +/* Now we define the strings used to build the spec file. */ -+/* interestingly, bpabi defines __GXX_TYPEINFO_EQUALITY_INLINE=0 too as we do. */ + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ @@ -354,12 +668,6 @@ index 0000000..f0c0d63 + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_define ("__STDC_ISO_10646__=201103L"); \ + builtin_assert ("system=haiku"); \ -+ /* Haiku apparently doesn't support merging of symbols across shared \ -+ object boundaries. Hence we need to explicitly specify that \ -+ type_infos are not merged, so that they get compared by name \ -+ instead of by pointer. */ \ -+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ -+ /*builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); done in bpabi: */\ + TARGET_BPABI_CPP_BUILTINS(); \ + } \ + while (0) @@ -371,12 +679,12 @@ index 0000000..f0c0d63 +/* If ELF is the default format, we should not use /lib/elf. */ + +#undef LINK_SPEC -+#define LINK_SPEC "%{!o*:-o %b} -m armelf %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}\ ++#define LINK_SPEC "-m armelf_haiku %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}\ + %{mbig-endian:-EB} %{mlittle-endian:-EL} -X" + diff --git a/gcc/config/arm/t-haiku b/gcc/config/arm/t-haiku new file mode 100644 -index 0000000..3f7f488 +index 000000000..3f7f488fe --- /dev/null +++ b/gcc/config/arm/t-haiku @@ -0,0 +1,21 @@ @@ -401,14 +709,41 @@ index 0000000..3f7f488 +#LIBGCC = stmp-multilib +#INSTALL_LIBGCC = install-multilib +#TARGET_LIBGCC2_CFLAGS = +diff --git a/gcc/config/haiku-protos.h b/gcc/config/haiku-protos.h +new file mode 100644 +index 000000000..22d8e5922 +--- /dev/null ++++ b/gcc/config/haiku-protos.h +@@ -0,0 +1,21 @@ ++/* Operating system specific prototypes to be used when targeting GCC for Haiku. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++/* In haiku.c. */ ++extern void haiku_override_options (void); diff --git a/gcc/config/haiku-stdint.h b/gcc/config/haiku-stdint.h new file mode 100644 -index 0000000..8f702d0 +index 000000000..19f141296 --- /dev/null +++ b/gcc/config/haiku-stdint.h @@ -0,0 +1,55 @@ +/* Definitions for types on Haiku. -+ Copyright (C) 2014 Paweł Dziepak. ++ Copyright (C) 2014 Free Software Foundation, Inc. + +This file is part of GCC. + @@ -462,12 +797,50 @@ index 0000000..8f702d0 + +#define INTPTR_TYPE "long int" +#define UINTPTR_TYPE "long unsigned int" +diff --git a/gcc/config/haiku.c b/gcc/config/haiku.c +new file mode 100644 +index 000000000..bf62ad5f0 +--- /dev/null ++++ b/gcc/config/haiku.c +@@ -0,0 +1,32 @@ ++/* General Haiku system support. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "target.h" ++ ++void ++haiku_override_options (void) ++{ ++ if (!global_options_set.x_dwarf_strict) ++ dwarf_strict = 1; ++ if (!global_options_set.x_dwarf_version) ++ dwarf_version = 4; ++} diff --git a/gcc/config/haiku.h b/gcc/config/haiku.h new file mode 100644 -index 0000000..faa34be +index 000000000..316d38469 --- /dev/null +++ b/gcc/config/haiku.h -@@ -0,0 +1,214 @@ +@@ -0,0 +1,218 @@ +/* Definitions of target machine for GCC. + Common Haiku definitions for all architectures. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 @@ -523,6 +896,11 @@ index 0000000..faa34be +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}" + ++#define SUBTARGET_OVERRIDE_OPTIONS \ ++ do { \ ++ haiku_override_options (); \ ++ } while (0) ++ +/* LIB_SPEC for Haiku */ +#undef LIB_SPEC +#define LIB_SPEC "-lroot" @@ -675,16 +1053,15 @@ index 0000000..faa34be +/* Haiku headers are C++-aware (and often use C++). */ +/* #define NO_IMPLICIT_EXTERN_C */ + -+/* Only allow -lssp for SSP, as -lssp_nonshared is problematic in Haiku */ -+#ifndef TARGET_LIBC_PROVIDES_SSP -+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp}" -+#endif ++#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ ++ "|fstack-protector-strong|fstack-protector-explicit" \ ++ ":-lssp_nonshared}" + +/* Do not use TM clone registry in Haiku for now */ +#define USE_TM_CLONE_REGISTRY 0 diff --git a/gcc/config/i386/haiku.h b/gcc/config/i386/haiku.h new file mode 100644 -index 0000000..3379e19 +index 000000000..3379e19f5 --- /dev/null +++ b/gcc/config/i386/haiku.h @@ -0,0 +1,77 @@ @@ -767,7 +1144,7 @@ index 0000000..3379e19 +#endif diff --git a/gcc/config/i386/haiku64.h b/gcc/config/i386/haiku64.h new file mode 100644 -index 0000000..76ba48e +index 000000000..e2fa55a34 --- /dev/null +++ b/gcc/config/i386/haiku64.h @@ -0,0 +1,135 @@ @@ -885,9 +1262,9 @@ index 0000000..76ba48e +#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \ + %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64}" + -+#undef ASM_OUTPUT_ALIGNED_COMMON -+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -+ x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); ++#undef ASM_OUTPUT_ALIGNED_DECL_COMMON ++#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ ++ x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); + + +/* i386 System V Release 4 uses DWARF debugging info. @@ -906,12 +1283,9 @@ index 0000000..76ba48e +#define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section + +#define USE_X86_64_FRAME_POINTER 1 -diff --git a/gcc/config/i386/host-cygwin.c b/gcc/config/i386/host-cygwin.c -old mode 100644 -new mode 100755 diff --git a/gcc/config/i386/t-haiku64 b/gcc/config/i386/t-haiku64 new file mode 100644 -index 0000000..9c8f8e6 +index 000000000..9c8f8e62e --- /dev/null +++ b/gcc/config/i386/t-haiku64 @@ -0,0 +1,16 @@ @@ -931,15 +1305,9 @@ index 0000000..9c8f8e6 + +# Compile libgcc2.a with pic. +TARGET_LIBGCC2_CFLAGS = -fPIC -diff --git a/gcc/config/i386/winnt-cxx.c b/gcc/config/i386/winnt-cxx.c -old mode 100644 -new mode 100755 -diff --git a/gcc/config/i386/winnt-stubs.c b/gcc/config/i386/winnt-stubs.c -old mode 100644 -new mode 100755 diff --git a/gcc/config/m68k/haiku.h b/gcc/config/m68k/haiku.h new file mode 100644 -index 0000000..358c19f +index 000000000..ce43a6665 --- /dev/null +++ b/gcc/config/m68k/haiku.h @@ -0,0 +1,268 @@ @@ -1053,7 +1421,7 @@ index 0000000..358c19f + +#undef LINK_SPEC +/*#define LINK_SPEC "%{!o*:-o %b} -m elf_m68k_haiku -shared -no-undefined %{nostart:-e 0}"*/ -+#define LINK_SPEC "%{!o*:-o %b} -m m68kelf %{!r:-shared} -no-undefined %{nostart:-e 0}" ++#define LINK_SPEC "-m m68kelf %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" + +/* XXX: not sure for the rest there... */ + @@ -1188,7 +1556,7 @@ index 0000000..358c19f +#undef FINALIZE_TRAMPOLINE +#define FINALIZE_TRAMPOLINE(TRAMP) \ + emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \ -+ LCT_NORMAL, VOIDmode, 2, TRAMP, Pmode, \ ++ LCT_NORMAL, VOIDmode, TRAMP, Pmode, \ + plus_constant (Pmode, TRAMP, TRAMPOLINE_SIZE), \ + Pmode); + @@ -1213,7 +1581,7 @@ index 0000000..358c19f +} diff --git a/gcc/config/mips/haiku.h b/gcc/config/mips/haiku.h new file mode 100644 -index 0000000..f6d2efb +index 000000000..870173d2e --- /dev/null +++ b/gcc/config/mips/haiku.h @@ -0,0 +1,44 @@ @@ -1259,11 +1627,84 @@ index 0000000..f6d2efb + while (0) + +#undef LINK_SPEC -+#define LINK_SPEC "%{!o*:-o %b} -m elf_mipsel_haiku %{!r:-shared} %{nostart:-e 0}" ++#define LINK_SPEC "-m elf_mipsel_haiku %{!r:-shared} %{nostart:-e 0}" + +diff --git a/gcc/config/riscv/haiku.h b/gcc/config/riscv/haiku.h +new file mode 100644 +index 000000000..9b31a4dc3 +--- /dev/null ++++ b/gcc/config/riscv/haiku.h +@@ -0,0 +1,57 @@ ++/* Definitions for RISC-V Haiku systems with ELF format. ++ Copyright (C) 1998-2017 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ builtin_define ("__HAIKU__"); \ ++ if (POINTER_SIZE == 64) \ ++ builtin_define ("__riscv64__"); \ ++ else \ ++ builtin_define ("__riscv32__"); \ ++ builtin_define ("__RISCV__"); \ ++ builtin_define ("__riscv__"); \ ++ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ ++ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ ++ builtin_define ("__STDC_ISO_10646__=201103L"); \ ++ builtin_assert ("system=haiku"); \ ++ } \ ++ while (0) ++ ++#define MUSL_ABI_SUFFIX \ ++ "%{mabi=ilp32:-sf}" \ ++ "%{mabi=ilp32f:-sp}" \ ++ "%{mabi=ilp32d:}" \ ++ "%{mabi=lp64:-sf}" \ ++ "%{mabi=lp64f:-sp}" \ ++ "%{mabi=lp64d:}" \ ++ ++#undef LIB_SPEC ++// Linux adds -latomic because RISC-V only has word-sized atomics ++// Not sure if we really need it though. ++#define LIB_SPEC " -lroot " ++ ++// riscv.h defines /lib and friends which breaks the sysroot ++#undef STARTFILE_PREFIX_SPEC ++ ++#define ICACHE_FLUSH_FUNC "__riscv_flush_icache" ++ ++#undef LINK_SPEC ++#define LINK_SPEC "-melf" XLEN_SPEC "lriscv %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}} -X" +diff --git a/gcc/config/riscv/t-haiku b/gcc/config/riscv/t-haiku +new file mode 100644 +index 000000000..6cccc72ae +--- /dev/null ++++ b/gcc/config/riscv/t-haiku +@@ -0,0 +1,4 @@ ++# Disable for now, only RV64 on Haiku for the moment ++# Only XLEN and ABI affect multilib dir names, e.g. /lib32/ilp32d/ ++#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) ++#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) diff --git a/gcc/config/rs6000/haiku.h b/gcc/config/rs6000/haiku.h new file mode 100644 -index 0000000..4dff89e +index 000000000..fee7c3c28 --- /dev/null +++ b/gcc/config/rs6000/haiku.h @@ -0,0 +1,56 @@ @@ -1322,20 +1763,230 @@ index 0000000..4dff89e +/* If ELF is the default format, we should not use /lib/elf. */ + +#undef LINK_SPEC -+#define LINK_SPEC "%{!o*:-o %b} -m elf32ppchaiku %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" ++#define LINK_SPEC "-m elf32ppchaiku %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" +diff --git a/gcc/config/sparc/haiku.h b/gcc/config/sparc/haiku.h +new file mode 100644 +index 000000000..8c81d7eb2 +--- /dev/null ++++ b/gcc/config/sparc/haiku.h +@@ -0,0 +1,93 @@ ++/* Definitions of target machine for GCC, for ELF on Haiku/sparc64. ++ Copyright (C) 2002-2017 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 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ builtin_define ("__HAIKU__"); \ ++ if (TARGET_ARCH64) \ ++ { \ ++ builtin_define ("__sparc64__"); \ ++ builtin_define ("__sparc_v9__"); \ ++ builtin_define ("__sparcv9"); \ ++ } \ ++ else \ ++ builtin_define ("__sparc"); \ ++ builtin_define ("__sparc__"); \ ++ } \ ++ while (0) ++ ++/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support ++ for the special GCC options -static and -shared, which allow us to ++ link things in one of these three modes by applying the appropriate ++ combinations of options at link-time. */ ++ ++#undef LINK_SPEC ++#define LINK_SPEC "-m elf64_sparc %{!r:-shared} %{nostart:-e 0} \ ++ %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" ++/* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */ ++#undef SIZE_TYPE ++#define SIZE_TYPE "long unsigned int" ++ ++#undef PTRDIFF_TYPE ++#define PTRDIFF_TYPE "long int" ++ ++/* This is the char to use for continuation (in case we need to turn ++ continuation back on). */ ++#undef DBX_CONTIN_CHAR ++#define DBX_CONTIN_CHAR '?' ++ ++#undef LOCAL_LABEL_PREFIX ++#define LOCAL_LABEL_PREFIX "." ++ ++/* This is how to store into the string LABEL ++ the symbol_ref name of an internal numbered label where ++ PREFIX is the class of label and NUM is the number within the class. ++ This is suitable for output with `assemble_name'. */ ++ ++#undef ASM_GENERATE_INTERNAL_LABEL ++#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ ++ sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) ++ ++#undef USER_LABEL_PREFIX ++#define USER_LABEL_PREFIX "" ++ ++#undef ASM_SPEC ++#define ASM_SPEC "%{" FPIE_OR_FPIC_SPEC ":-K PIC} \ ++%(asm_cpu) %(asm_arch) %(asm_relax)" ++ ++#define HAVE_ENABLE_EXECUTE_STACK ++ ++#undef TARGET_DEFAULT ++#define TARGET_DEFAULT \ ++ (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ ++ + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128) ++ ++#undef SPARC_DEFAULT_CMODEL ++#define SPARC_DEFAULT_CMODEL CM_MEDANY ++ ++/* Build a compiler that supports -m32 and -m64? */ ++ ++#undef LONG_DOUBLE_TYPE_SIZE ++#define LONG_DOUBLE_TYPE_SIZE 128 ++ ++/* We use GNU ld so undefine this so that attribute((init_priority)) works. */ ++#undef CTORS_SECTION_ASM_OP ++#undef DTORS_SECTION_ASM_OP +diff --git a/gcc/config/sparc/t-haiku b/gcc/config/sparc/t-haiku +new file mode 100644 +index 000000000..a8d212dcb +--- /dev/null ++++ b/gcc/config/sparc/t-haiku +@@ -0,0 +1,5 @@ ++# Disable multilib for now, as we don't intend to support SPARC32. ++#MULTILIB_OPTIONS = m32/m64 ++#MULTILIB_DIRNAMES = 32 64 ++#MULTILIB_MATCHES = ++ diff --git a/gcc/config/t-haiku b/gcc/config/t-haiku new file mode 100644 -index 0000000..587d1fb +index 000000000..ba1f7f517 --- /dev/null +++ b/gcc/config/t-haiku -@@ -0,0 +1,4 @@ +@@ -0,0 +1,9 @@ +# There are system headers elsewhere, but these are the ones that +# we are most likely to want to apply any fixes to. +NATIVE_SYSTEM_HEADER_DIR = /boot/system/develop/headers +LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/posix/limits.h ] -\ No newline at end of file ++ ++# Haiku-specific attributes ++haiku.o: $(srcdir)/config/haiku.c ++ $(COMPILE) $< ++ $(POSTCOMPILE) +diff --git a/gcc/configure b/gcc/configure +index 9b28369e3..c90e21134 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -798,6 +798,7 @@ NETLIBS + EXTRA_GCC_LIBS + GNAT_LIBEXC + COLLECT2_LIBS ++build_math_library + CXXDEPMODE + DEPDIR + am__leading_dot +@@ -838,6 +839,7 @@ with_float + with_cpu + enable_multiarch + enable_multilib ++HYBRID_SECONDARY + coverage_flags + valgrind_command + valgrind_path_defines +@@ -1815,6 +1817,8 @@ Optional Packages: + --with-demangler-in-ld try to use demangler in GNU ld + --with-gnu-as arrange to work with GNU as + --with-as arrange to use the specified as (full pathname) ++ --with-hybrid_secondary specify the packaging architecture for building a ++ secondary compiler for a Haiku hybrid system + --with-stabs arrange to use stabs instead of host debug format + --with-stack-clash-protection-guard-size=size + Set the default stack clash protection guard size +@@ -7559,6 +7563,17 @@ fi + # Miscenalleous configure options + # ------------------------------- + ++# handle --with-hybrid-secondary ++ ++# Check whether --with-hybrid_secondary was given. ++if test "${with_hybrid_secondary+set}" = set; then : ++ withval=$with_hybrid_secondary; HYBRID_SECONDARY=$withval ++else ++ HYBRID_SECONDARY= ++ ++fi ++ ++ + # With stabs + + # Check whether --with-stabs was given. +@@ -9692,6 +9707,15 @@ fi + # -------- + + ++# Configure -lm usage for host tools that need it ++build_math_library="-lm" ++case $build in ++ *-*-haiku*) ++ # no separate math library needed ++ build_math_library= ++ ;; ++esac ++ + # These libraries may be used by collect2. + # We may need a special search path to get them linked. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for collect2 libraries" >&5 +@@ -12593,7 +12617,7 @@ case ${enable_threads} in + # default + target_thread_file='single' + ;; +- aix | dce | lynx | mipssde | posix | rtems | \ ++ aix | dce | haiku | lynx | mipssde | posix | rtems | \ + single | tpf | vxworks | win32) + target_thread_file=${enable_threads} + ;; +@@ -18591,8 +18615,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no + ;; + + hpux9* | hpux10* | hpux11*) +@@ -22246,8 +22271,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no + ;; + + hpux9* | hpux10* | hpux11*) diff --git a/gcc/configure.ac b/gcc/configure.ac -index 162e08c..df6b36f 100644 +index 162e08cbc..a69668830 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -814,6 +814,15 @@ fi @@ -1354,10 +2005,10 @@ index 162e08c..df6b36f 100644 # With stabs AC_ARG_WITH(stabs, [AS_HELP_STRING([--with-stabs], -@@ -1296,6 +1305,16 @@ ZW_PROG_COMPILER_DEPENDENCIES([CXX]) +@@ -1295,6 +1304,15 @@ ZW_PROG_COMPILER_DEPENDENCIES([CXX]) + # UNSORTED # -------- - +# Configure -lm usage for host tools that need it +build_math_library="-lm" +case $build in @@ -1367,11 +2018,10 @@ index 162e08c..df6b36f 100644 + ;; +esac +AC_SUBST(build_math_library) -+ + # These libraries may be used by collect2. # We may need a special search path to get them linked. - AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, -@@ -1925,7 +1944,7 @@ case ${enable_threads} in +@@ -1925,7 +1943,7 @@ case ${enable_threads} in # default target_thread_file='single' ;; @@ -1381,7 +2031,7 @@ index 162e08c..df6b36f 100644 target_thread_file=${enable_threads} ;; diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h -index 7b6c632..871522c 100644 +index 7b6c63237..871522c1c 100644 --- a/gcc/ginclude/stdarg.h +++ b/gcc/ginclude/stdarg.h @@ -94,7 +94,7 @@ typedef __gnuc_va_list va_list; @@ -1394,7 +2044,7 @@ index 7b6c632..871522c 100644 typedef __gnuc_va_list va_list; #endif /* not __va_list__ */ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h -index 66619fe..68e5024 100644 +index 66619fe43..68e5024aa 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -161,7 +161,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -1443,10 +2093,20 @@ index 66619fe..68e5024 100644 #define _WCHAR_T #define _T_WCHAR_ diff --git a/include/filenames.h b/include/filenames.h -index b3b85b2..99d2151 100644 +index b3b85b243..911ac96f6 100644 --- a/include/filenames.h +++ b/include/filenames.h -@@ -45,9 +45,11 @@ extern "C" { +@@ -37,17 +37,21 @@ extern "C" { + # ifndef HAVE_DOS_BASED_FILE_SYSTEM + # define HAVE_DOS_BASED_FILE_SYSTEM 1 + # endif ++/* + # ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM + # define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 + # endif ++*/ + # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) + # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) #else /* not DOSish */ # if defined(__APPLE__) @@ -1458,8 +2118,93 @@ index b3b85b2..99d2151 100644 # endif /* __APPLE__ */ # define HAS_DRIVE_SPEC(f) (0) # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) +diff --git a/libatomic/configure b/libatomic/configure +index 5867e69ac..e14d805aa 100755 +--- a/libatomic/configure ++++ b/libatomic/configure +@@ -8476,8 +8476,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + haiku*) + # PIC is the default for Haiku. +- # The "-static" flag exists, but is broken. +- lt_prog_compiler_static= + ;; + + hpux*) +@@ -10579,8 +10577,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no + ;; + + hpux9* | hpux10* | hpux11*) +@@ -11102,7 +11101,7 @@ else + lt_cv_dlopen_libs= + + case $host_os in +- beos*) ++ beos* | haiku* ) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes +@@ -14864,7 +14863,6 @@ _ACEOF + case " $config_path " in + *" posix "*) + XPCFLAGS="" +- CFLAGS="$CFLAGS -pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include +@@ -14877,14 +14875,30 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); + return 0; + } + _ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ++else ++ CFLAGS="$CFLAGS -pthread" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++ void *g(void *d) { return NULL; } ++int ++main () ++{ ++pthread_t t; pthread_create(&t,NULL,g,NULL); ++ ; ++ return 0; ++} ++_ACEOF + if ac_fn_c_try_link "$LINENO"; then : + XPCFLAGS=" -pthread" + else + CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include +- void *g(void *d) { return NULL; } ++ void *g(void *d) { return NULL; } + int + main () + { +@@ -14901,6 +14915,9 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$save_CFLAGS $XPCFLAGS" diff --git a/libatomic/configure.ac b/libatomic/configure.ac -index 2a37187..1a6f550 100644 +index 2a371870c..1a6f550ae 100644 --- a/libatomic/configure.ac +++ b/libatomic/configure.ac @@ -217,21 +217,27 @@ LIBAT_WORDSIZE @@ -1500,7 +2245,7 @@ index 2a37187..1a6f550 100644 ;; esac diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt -index 670b0d7..8159a41 100644 +index 670b0d72c..8159a4185 100644 --- a/libatomic/configure.tgt +++ b/libatomic/configure.tgt @@ -151,7 +151,7 @@ case "${target}" in @@ -1512,31 +2257,32 @@ index 670b0d7..8159a41 100644 # POSIX system. The OS is supported. config_path="${config_path} posix" ;; -diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in -index 2c8be56..4e18e3c 100644 ---- a/libgcc/Makefile.in -+++ b/libgcc/Makefile.in -@@ -402,10 +402,16 @@ ifeq ($(enable_shared),yes) - endif - endif +diff --git a/libcody/configure b/libcody/configure +index da52a5cfc..d92e55a09 100755 +--- a/libcody/configure ++++ b/libcody/configure +@@ -2496,7 +2496,7 @@ $as_echo_n "checking whether $CXX is for C++11... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ -+ifneq ($(enable_shared),yes) -+# Maintain the same visibility as older GCC for now. Needed on Haiku -+# because the static library is included in libroot.so. -+vis_hide = -+else - # For -fvisibility=hidden. We need both a -fvisibility=hidden on - # the command line, and a #define to prevent libgcc2.h etc from - # overriding that with #pragmas. - vis_hide = @vis_hide@ -+endif - - ifneq (,$(vis_hide)) +-#if __cplusplus != 201103 ++#if __cplusplus < 201103 + #error "C++11 is required" + #endif diff --git a/libgcc/config.host b/libgcc/config.host -index 50f0006..6a497ea 100644 +index 50f000622..e7e004518 100644 --- a/libgcc/config.host +++ b/libgcc/config.host +@@ -103,7 +103,7 @@ arm*-*-*) + ;; + avr-*-*) + cpu_type=avr +- ;; ++ ;; + bfin*-*) + cpu_type=bfin + ;; @@ -245,6 +245,14 @@ case ${host} in tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia" extra_parts="crtbegin.o crtend.o" @@ -1546,13 +2292,25 @@ index 50f0006..6a497ea 100644 + # machine-specific sections may refine and add to this + # configuration. + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-haiku t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" -+ tmake_file="$tmake_file t-slibgcc-nolc-override" ++ tmake_file="$tmake_file t-slibgcc-libgcc t-slibgcc-nolc-override" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" -@@ -468,6 +476,12 @@ arm*-*-netbsdelf*) +@@ -382,6 +390,11 @@ aarch64*-*-fuchsia*) + tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" + ;; ++aarch64*-*-haiku*) ++ tmake_file="${tmake_file} ${cpu_type}/t-aarch64" ++ tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" ++ md_unwind_header=aarch64/haiku-unwind.h ++ ;; + aarch64*-*-linux*) + extra_parts="$extra_parts crtfastmath.o" + md_unwind_header=aarch64/linux-unwind.h +@@ -468,6 +481,12 @@ arm*-*-netbsdelf*) ;; esac ;; @@ -1565,7 +2323,7 @@ index 50f0006..6a497ea 100644 arm*-*-linux* | arm*-*-uclinuxfdpiceabi) tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm" tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc" -@@ -719,6 +733,12 @@ x86_64-*-freebsd*) +@@ -719,6 +738,12 @@ x86_64-*-freebsd*) tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff" md_unwind_header=i386/freebsd-unwind.h ;; @@ -1578,7 +2336,16 @@ index 50f0006..6a497ea 100644 i[34567]86-*-netbsdelf*) tmake_file="${tmake_file} i386/t-crtstuff" ;; -@@ -933,6 +953,8 @@ m32r-*-linux*) +@@ -919,7 +944,7 @@ lm32-*-rtems*) + lm32-*-uclinux*) + extra_parts="$extra_parts crtbegin.o crtendS.o crtbeginT.o" + tmake_file="lm32/t-lm32 lm32/t-uclinux t-libgcc-pic t-softfp-sfdf t-softfp" +- ;; ++ ;; + m32r-*-elf*) + tmake_file="$tmake_file m32r/t-m32r t-fdpbit" + extra_parts="$extra_parts crtinit.o crtfini.o" +@@ -933,6 +958,8 @@ m32r-*-linux*) m32rle-*-linux*) tmake_file="$tmake_file m32r/t-linux t-fdpbit" ;; @@ -1587,7 +2354,7 @@ index 50f0006..6a497ea 100644 m68k-*-elf* | fido-*-elf) tmake_file="$tmake_file m68k/t-floatlib" ;; -@@ -1003,6 +1025,8 @@ mips*-sde-elf*) +@@ -1003,6 +1030,8 @@ mips*-sde-elf*) esac extra_parts="$extra_parts crti.o crtn.o" ;; @@ -1596,7 +2363,7 @@ index 50f0006..6a497ea 100644 mipsisa32-*-elf* | mipsisa32el-*-elf* | \ mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \ mipsisa32r6-*-elf* | mipsisa32r6el-*-elf* | \ -@@ -1157,6 +1181,8 @@ powerpc*-*-freebsd*) +@@ -1157,6 +1186,8 @@ powerpc*-*-freebsd*) ;; esac ;; @@ -1605,12 +2372,75 @@ index 50f0006..6a497ea 100644 powerpc-*-netbsd*) tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff" ;; -diff --git a/libgcc/config/i386/t-cygming b/libgcc/config/i386/t-cygming -old mode 100644 -new mode 100755 +@@ -1435,6 +1466,8 @@ sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux + fi + md_unwind_header=sparc/linux-unwind.h + ;; ++sparc64-*-haiku*) ++ ;; + sparc64-*-netbsd*) + ;; + tic6x-*-uclinux) +diff --git a/libgcc/config/aarch64/haiku-unwind.h b/libgcc/config/aarch64/haiku-unwind.h +new file mode 100644 +index 000000000..3c8d33d6a +--- /dev/null ++++ b/libgcc/config/aarch64/haiku-unwind.h +@@ -0,0 +1,51 @@ ++/* DWARF2 EH unwinding support for FreeBSD/ARM64 (aarch64). ++ Copyright (C) 2017-2018 Free Software Foundation, Inc. ++ Contributed by John Marino ++ ++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 ++. */ ++ ++/* Identify a signal frame, and set the frame state data appropriately. ++ See unwind-dw2.c for the structs. */ ++ ++/* Always include AArch64 unwinder header file. */ ++#include "config/aarch64/aarch64-unwind.h" ++ ++#include ++#include ++#include ++#include ++ ++#define REG_NAME(reg) mc_gpregs.gp_## reg ++#define XREG(num) mc_gpregs.gp_x[num] ++#define DARC __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__ ++ ++#define MD_FALLBACK_FRAME_STATE_FOR aarch64_haiku_fallback_frame_state ++ ++static _Unwind_Reason_Code ++aarch64_haiku_fallback_frame_state ++(struct _Unwind_Context *context, _Unwind_FrameState *fs) ++{ ++ // For now just signal end of stack. Once the Haiku implementation ++ // for AArch64 is more mature we can consider writing something similar ++ // to Linux or FreeBSD support. ++ return _URC_END_OF_STACK; ++} diff --git a/libgcc/config/t-haiku b/libgcc/config/t-haiku new file mode 100644 -index 0000000..b4fff2d +index 000000000..b4fff2d8f --- /dev/null +++ b/libgcc/config/t-haiku @@ -0,0 +1,3 @@ @@ -1618,7 +2448,7 @@ index 0000000..b4fff2d +LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ + $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c -index 675930d..d971879 100644 +index 675930db0..d971879ef 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -108,7 +108,9 @@ call_ ## FUNC (void) \ @@ -1631,8 +2461,116 @@ index 675930d..d971879 100644 /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h. But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */ # if !defined(__UCLIBC__) \ +diff --git a/libgomp/configure b/libgomp/configure +index 1917d7e27..12bb7ebe7 100755 +--- a/libgomp/configure ++++ b/libgomp/configure +@@ -8517,8 +8517,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + haiku*) + # PIC is the default for Haiku. +- # The "-static" flag exists, but is broken. +- lt_prog_compiler_static= + ;; + + hpux*) +@@ -10620,8 +10618,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no + ;; + + hpux9* | hpux10* | hpux11*) +@@ -11143,7 +11142,7 @@ else + lt_cv_dlopen_libs= + + case $host_os in +- beos*) ++ beos* | haiku* ) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes +@@ -12392,8 +12391,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + haiku*) + # PIC is the default for Haiku. +- # The "-static" flag exists, but is broken. +- lt_prog_compiler_static_FC= + ;; + + hpux*) +@@ -14260,8 +14257,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no + ;; + + hpux9* | hpux10* | hpux11*) +@@ -14942,7 +14940,6 @@ case "$host" in + *) + # Check to see if -pthread or -lpthread is needed. Prefer the former. + # In case the pthread.h system header is not found, this test will fail. +- CFLAGS="$CFLAGS -pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include +@@ -14956,9 +14953,9 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- XPCFLAGS=" -Wc,-pthread" ++ + else +- CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" ++ CFLAGS="$CFLAGS -pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include +@@ -14971,6 +14968,22 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); + return 0; + } + _ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ XPCFLAGS=" -Wc,-pthread" ++else ++ CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++ void *g(void *d) { return NULL; } ++int ++main () ++{ ++pthread_t t; pthread_create(&t,NULL,g,NULL); ++ ; ++ return 0; ++} ++_ACEOF + if ac_fn_c_try_link "$LINENO"; then : + + else +@@ -14979,6 +14992,9 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + esac diff --git a/libgomp/configure.ac b/libgomp/configure.ac -index c23fe00..caf60d7 100644 +index c23fe004f..caf60d79f 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -194,21 +194,27 @@ case "$host" in @@ -1668,15 +2606,29 @@ index c23fe00..caf60d7 100644 esac if test x$libgomp_use_pthreads != xno; then +diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 +index 1c0a4c130..8429b1a88 100644 +--- a/libstdc++-v3/acinclude.m4 ++++ b/libstdc++-v3/acinclude.m4 +@@ -4579,6 +4579,9 @@ AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [ + solaris*) + enable_libstdcxx_filesystem_ts=yes + ;; ++ haiku*) ++ enable_libstdcxx_filesystem_ts=yes ++ ;; + mingw*) + enable_libstdcxx_filesystem_ts=yes + ;; diff --git a/libstdc++-v3/config/os/haiku/ctype_base.h b/libstdc++-v3/config/os/haiku/ctype_base.h new file mode 100644 -index 0000000..e762aaa +index 000000000..86e15cb47 --- /dev/null +++ b/libstdc++-v3/config/os/haiku/ctype_base.h @@ -0,0 +1,61 @@ +// Locale support -*- C++ -*- + -+// Copyright (C) 1997-2015 Free Software Foundation, Inc. ++// Copyright (C) 1997-2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the @@ -1729,7 +2681,7 @@ index 0000000..e762aaa + static const mask punct = 1 << 9; + static const mask alnum = (1 << 2) | (1 << 3); // alpha|digit +#if __cplusplus >= 201103L -+ static const mask blank = 1 << 10; ++ static const mask blank = 1 << 10; +#endif + }; + @@ -1737,7 +2689,7 @@ index 0000000..e762aaa +} // namespace diff --git a/libstdc++-v3/config/os/haiku/ctype_configure_char.cc b/libstdc++-v3/config/os/haiku/ctype_configure_char.cc new file mode 100644 -index 0000000..35e6b80 +index 000000000..35e6b80f0 --- /dev/null +++ b/libstdc++-v3/config/os/haiku/ctype_configure_char.cc @@ -0,0 +1,99 @@ @@ -1842,7 +2794,7 @@ index 0000000..35e6b80 +} // namespace diff --git a/libstdc++-v3/config/os/haiku/ctype_inline.h b/libstdc++-v3/config/os/haiku/ctype_inline.h new file mode 100644 -index 0000000..5b5cc56 +index 000000000..5b5cc5693 --- /dev/null +++ b/libstdc++-v3/config/os/haiku/ctype_inline.h @@ -0,0 +1,173 @@ @@ -2021,7 +2973,7 @@ index 0000000..5b5cc56 +} // namespace diff --git a/libstdc++-v3/config/os/haiku/error_constants.h b/libstdc++-v3/config/os/haiku/error_constants.h new file mode 100644 -index 0000000..fa6d889 +index 000000000..fa6d88919 --- /dev/null +++ b/libstdc++-v3/config/os/haiku/error_constants.h @@ -0,0 +1,178 @@ @@ -2205,10 +3157,10 @@ index 0000000..fa6d889 +#endif diff --git a/libstdc++-v3/config/os/haiku/os_defines.h b/libstdc++-v3/config/os/haiku/os_defines.h new file mode 100644 -index 0000000..4674f7b +index 000000000..02c869321 --- /dev/null +++ b/libstdc++-v3/config/os/haiku/os_defines.h -@@ -0,0 +1,45 @@ +@@ -0,0 +1,48 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2000-2013 Free Software Foundation, Inc. @@ -2253,729 +3205,12 @@ index 0000000..4674f7b + #define _GLIBCXX_USE_CLOCK_REALTIME 1 +#endif + -+#endif -diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host -index ec32980..fa6ca87 100644 ---- a/libstdc++-v3/configure.host -+++ b/libstdc++-v3/configure.host -@@ -267,6 +267,9 @@ case "${host_os}" in - os_include_dir="os/gnu-linux" - fi - ;; -+ haiku*) -+ os_include_dir="os/haiku" -+ ;; - hpux*) - os_include_dir="os/hpux" - ;; -diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 -index ff44d5a..a91be77 100644 ---- a/libstdc++-v3/crossconfig.m4 -+++ b/libstdc++-v3/crossconfig.m4 -@@ -141,6 +141,46 @@ case "${host}" in - AC_SUBST(SECTION_FLAGS) - ;; - -+ *-haiku*) -+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -+ machine/endian.h machine/param.h sys/machine.h sys/types.h \ -+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) -+ SECTION_FLAGS='-ffunction-sections -fdata-sections' -+ AC_SUBST(SECTION_FLAGS) -+ -+ AC_DEFINE(HAVE_INT64_T) -+ -+ AC_DEFINE(HAVE_ACOSF) -+ AC_DEFINE(HAVE_ASINF) -+ AC_DEFINE(HAVE_ATANF) -+ AC_DEFINE(HAVE_ATAN2F) -+ AC_DEFINE(HAVE_CEILF) -+ AC_DEFINE(HAVE_COSF) -+ AC_DEFINE(HAVE_COSHF) -+ AC_DEFINE(HAVE_EXPF) -+ AC_DEFINE(HAVE_FABSF) -+ AC_DEFINE(HAVE_FINITE) -+ AC_DEFINE(HAVE_FINITEF) -+ AC_DEFINE(HAVE_FLOORF) -+ AC_DEFINE(HAVE_FMODF) -+ 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_LOGF) -+ AC_DEFINE(HAVE_LOG10F) -+ AC_DEFINE(HAVE_MODFF) -+ AC_DEFINE(HAVE_SINF) -+ AC_DEFINE(HAVE_SINHF) -+ AC_DEFINE(HAVE_SQRTF) -+ AC_DEFINE(HAVE_TANF) -+ AC_DEFINE(HAVE_TANHF) -+ AC_DEFINE(HAVE_TLS) -+ ;; -+ - *-hpux*) - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) -diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc -index a620e23..ba024c3 100644 ---- a/libstdc++-v3/libsupc++/tinfo.cc -+++ b/libstdc++-v3/libsupc++/tinfo.cc -@@ -30,6 +30,15 @@ std::type_info:: - ~type_info () - { } - -+#ifdef __HAIKU__ -+#ifndef __GXX_MERGED_TYPEINFO_NAMES -+#define __GXX_MERGED_TYPEINFO_NAMES 0 -+#endif -+#ifndef __GXX_TYPEINFO_EQUALITY_INLINE -+#define __GXX_TYPEINFO_EQUALITY_INLINE 0 -+#endif -+#endif -+ - #if !__GXX_TYPEINFO_EQUALITY_INLINE - - // We can't rely on common symbols being shared between shared objects. -diff --git a/libtool.m4 b/libtool.m4 -index 17f8e5f..9c03be6 100644 ---- a/libtool.m4 -+++ b/libtool.m4 -@@ -1139,7 +1139,7 @@ fi - # Invoke $ECHO with all args, space-separated. - func_echo_all () - { -- $ECHO "$*" -+ $ECHO "$*" - } - - case "$ECHO" in -@@ -1724,7 +1724,7 @@ else - lt_cv_dlopen_libs= - - case $host_os in -- beos*) -+ beos* | haiku* ) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes -@@ -2334,8 +2334,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -@@ -3600,7 +3601,6 @@ m4_if([$1], [CXX], [ - ;; - esac - ;; -- - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; -@@ -3623,8 +3623,6 @@ m4_if([$1], [CXX], [ - ;; - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. -@@ -3934,8 +3932,6 @@ m4_if([$1], [CXX], [ - - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) --- -2.30.2 - - -From 7dfded839e9667d56b9b7d6117115f72577276fd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= -Date: Mon, 27 Jul 2015 16:32:32 +0200 -Subject: Haiku: disable -fno-PIE as this fails on x86_64. - - -diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index 00da7f9..30fba68 100644 ---- a/gcc/Makefile.in -+++ b/gcc/Makefile.in -@@ -273,7 +273,7 @@ NO_PIE_CFLAGS = @NO_PIE_CFLAGS@ - NO_PIE_FLAG = @NO_PIE_FLAG@ - - # We don't want to compile the compilers with -fPIE, it make PCH fail. --COMPILER += $(NO_PIE_CFLAGS) -+#COMPILER += $(NO_PIE_CFLAGS) - - # Link with -no-pie since we compile the compiler with -fno-PIE. - LINKER += $(NO_PIE_FLAG) -@@ -804,9 +804,9 @@ NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@ - NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@ - BUILD_CFLAGS= @BUILD_CFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE - BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE --BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@ --BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS) --BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS) -+#BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@ -+#BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS) -+#BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS) - - # Native compiler that we use. This may be C++ some day. - COMPILER_FOR_BUILD = $(CXX_FOR_BUILD) --- -2.30.2 - - -From 4b65ab73889321990069919a6f70e4dd4f4a0022 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 5 May 2016 09:03:06 +0000 -Subject: fix for libstdc++/69506 - - -diff --git a/libstdc++-v3/config/os/haiku/os_defines.h b/libstdc++-v3/config/os/haiku/os_defines.h -index 4674f7b..02c8693 100644 ---- a/libstdc++-v3/config/os/haiku/os_defines.h -+++ b/libstdc++-v3/config/os/haiku/os_defines.h -@@ -42,4 +42,7 @@ - #define _GLIBCXX_USE_CLOCK_REALTIME 1 - #endif - +// See libstdc++/69506 +#define _GLIBCXX_USE_WEAK_REF 0 + - #endif --- -2.30.2 - - -From 1c1621f9b4a75e8e0f5303a482e02213355c299e Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 5 May 2016 15:52:08 +0000 -Subject: rename x86_elf_aligned_common. - - -diff --git a/gcc/config/i386/haiku64.h b/gcc/config/i386/haiku64.h -index 76ba48e..e2fa55a 100644 ---- a/gcc/config/i386/haiku64.h -+++ b/gcc/config/i386/haiku64.h -@@ -112,9 +112,9 @@ Boston, MA 02111-1307, USA. */ - #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \ - %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64}" - --#undef ASM_OUTPUT_ALIGNED_COMMON --#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -- x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); -+#undef ASM_OUTPUT_ALIGNED_DECL_COMMON -+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ -+ x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); - - - /* i386 System V Release 4 uses DWARF debugging info. --- -2.30.2 - - -From e133e3a620bf8c6ce28f6d9dc3fa1c460173a92c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= -Date: Wed, 2 May 2018 08:37:20 +0200 -Subject: Enable libstdcxx_filesystem_ts for Haiku - - -diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 -index 1c0a4c1..8429b1a 100644 ---- a/libstdc++-v3/acinclude.m4 -+++ b/libstdc++-v3/acinclude.m4 -@@ -4579,6 +4579,9 @@ AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [ - solaris*) - enable_libstdcxx_filesystem_ts=yes - ;; -+ haiku*) -+ enable_libstdcxx_filesystem_ts=yes -+ ;; - mingw*) - enable_libstdcxx_filesystem_ts=yes - ;; --- -2.30.2 - - -From a0208687b1b48264aa91f97784c2e505a6caaf18 Mon Sep 17 00:00:00 2001 -From: Jessica Hamilton -Date: Fri, 12 Jul 2019 18:17:00 +0000 -Subject: gcc: fix build configuration for libgcc. - - -diff --git a/libgcc/config.host b/libgcc/config.host -index 6a497ea..85d9b7f 100644 ---- a/libgcc/config.host -+++ b/libgcc/config.host -@@ -250,7 +250,7 @@ case ${host} in - # machine-specific sections may refine and add to this - # configuration. - tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-haiku t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" -- tmake_file="$tmake_file t-slibgcc-nolc-override" -+ tmake_file="$tmake_file t-slibgcc-libgcc t-slibgcc-nolc-override" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - ;; - *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) --- -2.30.2 - - -From ffd4d55c33bd851e8ef1df66865edbff70acaac1 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Fri, 12 May 2017 23:49:00 +0200 -Subject: Haiku: regenerate configure. - - -diff --git a/configure b/configure -index 504f641..efdd512 100755 ---- a/configure -+++ b/configure -@@ -3108,6 +3108,9 @@ case "${host}" in - i[3456789]86-*-msdosdjgpp*) - noconfigdirs="$noconfigdirs tcl tk itcl" - ;; -+ *-*-haiku*) -+ noconfigdirs="$noconfigdirs tk itcl libgui gdb" -+ ;; - esac - - -@@ -3213,7 +3216,7 @@ if test x$enable_libgomp = x ; then - ;; - *-*-solaris2* | *-*-hpux11*) - ;; -- *-*-darwin* | *-*-aix*) -+ *-*-darwin* | *-*-aix* | *-*-haiku*) - ;; - nvptx*-*-* | amdgcn*-*-*) - ;; -@@ -3493,6 +3496,9 @@ case "${target}" in - *-*-darwin*) - noconfigdirs="$noconfigdirs target-libffi" - ;; -+ *-*-haiku*) -+ noconfigdirs="$noconfigdirs ${libgcj}" -+ ;; - *-*-netware*) - noconfigdirs="$noconfigdirs target-libffi" - ;; -@@ -3702,6 +3708,9 @@ case "${target}" in - *-*-freebsd*) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; -+ *-*-haiku*) -+ noconfigdirs="$noconfigdirs target-newlib target-libgloss" -+ ;; - *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; -@@ -3766,6 +3775,9 @@ case "${target}" in - with_gmp=/usr/local - fi - ;; -+ *-*-haiku*) -+ noconfigdirs="$noconfigdirs gdb target-libiberty" -+ ;; - *-*-kaos*) - # Remove unsupported stuff on all kaOS configurations. - noconfigdirs="$noconfigdirs target-libgloss" -@@ -5450,24 +5462,30 @@ $as_echo_n "checking how to compare bootstrapped objects... " >&6; } - if ${gcc_cv_prog_cmp_skip+:} false; then : - $as_echo_n "(cached) " >&6 - else -- echo abfoo >t1 -- echo cdfoo >t2 -- gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' -- if cmp t1 t2 2 2 > /dev/null 2>&1; then -- if cmp t1 t2 1 1 > /dev/null 2>&1; then -- : -- else -- gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' -+ # comparing object files via cmp doesn't work on haiku (files will seemingly -+ # always differ), so we disassemble both files and compare the results: -+ if uname -o | grep -iq haiku; then -+ gcc_cv_prog_cmp_skip='objdump -Dz $$f1 | tail +6 >tmp-foo1; objdump -Dz $$f2 | tail +6 >tmp-foo2; cmp tmp-foo1 tmp-foo2' -+ else -+ echo abfoo >t1 -+ echo cdfoo >t2 -+ gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' -+ if cmp t1 t2 2 2 > /dev/null 2>&1; then -+ if cmp t1 t2 1 1 > /dev/null 2>&1; then -+ : -+ else -+ gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' -+ fi - fi -- fi -- if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then -- if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then -- : -- else -- gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' -+ if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then -+ if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then -+ : -+ else -+ gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' -+ fi - fi -+ rm t1 t2 - fi -- rm t1 t2 - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_prog_cmp_skip" >&5 -diff --git a/gcc/configure b/gcc/configure -index 9b28369..94fa995 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -798,6 +798,7 @@ NETLIBS - EXTRA_GCC_LIBS - GNAT_LIBEXC - COLLECT2_LIBS -+build_math_library - CXXDEPMODE - DEPDIR - am__leading_dot -@@ -838,6 +839,7 @@ with_float - with_cpu - enable_multiarch - enable_multilib -+HYBRID_SECONDARY - coverage_flags - valgrind_command - valgrind_path_defines -@@ -955,6 +957,7 @@ enable_checking - enable_coverage - enable_gather_detailed_mem_stats - enable_valgrind_annotations -+with_hybrid_secondary - with_stabs - enable_multilib - enable_multiarch -@@ -1815,6 +1818,8 @@ Optional Packages: - --with-demangler-in-ld try to use demangler in GNU ld - --with-gnu-as arrange to work with GNU as - --with-as arrange to use the specified as (full pathname) -+ --with-hybrid_secondary specify the packaging architecture for building a -+ secondary compiler for a Haiku hybrid system - --with-stabs arrange to use stabs instead of host debug format - --with-stack-clash-protection-guard-size=size - Set the default stack clash protection guard size -@@ -7559,6 +7564,18 @@ fi - # Miscenalleous configure options - # ------------------------------- - -+# handle --with-hybrid-secondary -+ -+# Check whether --with-hybrid_secondary was given. -+if test "${with_hybrid_secondary+set}" = set; then : -+ withval=$with_hybrid_secondary; HYBRID_SECONDARY=$withval -+else -+ HYBRID_SECONDARY= -+ -+fi -+ -+ -+ - # With stabs - - # Check whether --with-stabs was given. -@@ -9692,6 +9709,16 @@ fi - # -------- - - -+# Configure -lm usage for host tools that need it -+build_math_library="-lm" -+case $build in -+ *-*-haiku*) -+ # no separate math library needed -+ build_math_library= -+ ;; -+esac -+ -+ - # These libraries may be used by collect2. - # We may need a special search path to get them linked. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for collect2 libraries" >&5 -@@ -12593,7 +12620,7 @@ case ${enable_threads} in - # default - target_thread_file='single' - ;; -- aix | dce | lynx | mipssde | posix | rtems | \ -+ aix | dce | haiku | lynx | mipssde | posix | rtems | \ - single | tpf | vxworks | win32) - target_thread_file=${enable_threads} - ;; -@@ -16488,8 +16515,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- lt_prog_compiler_static= - ;; - - hpux*) -@@ -18591,8 +18616,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -@@ -19114,7 +19140,7 @@ else - lt_cv_dlopen_libs= - - case $host_os in -- beos*) -+ beos* | haiku* ) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes -@@ -21312,7 +21338,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - ;; - esac - ;; -- - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; -@@ -21334,8 +21359,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - ;; - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- lt_prog_compiler_static_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. -@@ -22246,8 +22269,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -diff --git a/libatomic/configure b/libatomic/configure -index 5867e69..e14d805 100755 ---- a/libatomic/configure -+++ b/libatomic/configure -@@ -8476,8 +8476,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- lt_prog_compiler_static= - ;; - - hpux*) -@@ -10579,8 +10577,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -@@ -11102,7 +11101,7 @@ else - lt_cv_dlopen_libs= - - case $host_os in -- beos*) -+ beos* | haiku* ) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes -@@ -14864,7 +14863,6 @@ _ACEOF - case " $config_path " in - *" posix "*) - XPCFLAGS="" -- CFLAGS="$CFLAGS -pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #include -@@ -14877,14 +14875,30 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); - return 0; - } - _ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ -+else -+ CFLAGS="$CFLAGS -pthread" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+ void *g(void *d) { return NULL; } -+int -+main () -+{ -+pthread_t t; pthread_create(&t,NULL,g,NULL); -+ ; -+ return 0; -+} -+_ACEOF - if ac_fn_c_try_link "$LINENO"; then : - XPCFLAGS=" -pthread" - else - CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS" -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #include -- void *g(void *d) { return NULL; } -+ void *g(void *d) { return NULL; } - int - main () - { -@@ -14901,6 +14915,9 @@ fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$save_CFLAGS $XPCFLAGS" -diff --git a/libgomp/configure b/libgomp/configure -index 1917d7e..12bb7eb 100755 ---- a/libgomp/configure -+++ b/libgomp/configure -@@ -8517,8 +8517,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- lt_prog_compiler_static= - ;; - - hpux*) -@@ -10620,8 +10618,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -@@ -11143,7 +11142,7 @@ else - lt_cv_dlopen_libs= - - case $host_os in -- beos*) -+ beos* | haiku* ) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes -@@ -12392,8 +12391,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - haiku*) - # PIC is the default for Haiku. -- # The "-static" flag exists, but is broken. -- lt_prog_compiler_static_FC= - ;; - - hpux*) -@@ -14260,8 +14257,9 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -- hardcode_into_libs=yes -+ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' -+ hardcode_into_libs=no - ;; - - hpux9* | hpux10* | hpux11*) -@@ -14942,7 +14940,6 @@ case "$host" in - *) - # Check to see if -pthread or -lpthread is needed. Prefer the former. - # In case the pthread.h system header is not found, this test will fail. -- CFLAGS="$CFLAGS -pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #include -@@ -14956,9 +14953,9 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- XPCFLAGS=" -Wc,-pthread" -+ - else -- CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" -+ CFLAGS="$CFLAGS -pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #include -@@ -14971,6 +14968,22 @@ pthread_t t; pthread_create(&t,NULL,g,NULL); - return 0; - } - _ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ XPCFLAGS=" -Wc,-pthread" -+else -+ CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+ void *g(void *d) { return NULL; } -+int -+main () -+{ -+pthread_t t; pthread_create(&t,NULL,g,NULL); -+ ; -+ return 0; -+} -+_ACEOF - if ac_fn_c_try_link "$LINENO"; then : - - else -@@ -14979,6 +14992,9 @@ fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - esac ++#endif diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure -index 326a279..51c46bb 100755 +index 326a279c5..537c8653d 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -9199,8 +9199,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } @@ -3004,19 +3239,11 @@ index 326a279..51c46bb 100755 case $host_os in - beos*) -+ beos* | haiku* ) ++ beos* | haiku*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes -@@ -14056,7 +14055,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } - ;; - esac - ;; -- - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; -@@ -14078,8 +14076,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -14078,8 +14077,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ;; haiku*) # PIC is the default for Haiku. @@ -3025,7 +3252,7 @@ index 326a279..51c46bb 100755 ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. -@@ -14990,8 +14986,9 @@ haiku*) +@@ -14990,8 +14987,9 @@ haiku*) soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -3037,7 +3264,7 @@ index 326a279..51c46bb 100755 ;; hpux9* | hpux10* | hpux11*) -@@ -47527,6 +47524,89 @@ done +@@ -47522,6 +47520,89 @@ done ;; @@ -3124,10 +3351,10 @@ index 326a279..51c46bb 100755 + + ;; + - *-hpux*) + *-fuchsia*) SECTION_FLAGS='-ffunction-sections -fdata-sections' -@@ -75899,6 +75979,9 @@ $as_echo_n "checking whether to build Filesystem TS support... " >&6; } +@@ -75899,6 +75980,9 @@ $as_echo_n "checking whether to build Filesystem TS support... " >&6; } solaris*) enable_libstdcxx_filesystem_ts=yes ;; @@ -3137,159 +3364,255 @@ index 326a279..51c46bb 100755 mingw*) enable_libstdcxx_filesystem_ts=yes ;; --- -2.30.2 - - -From 068c004d09a21e772aa11e64e13e6182eb485f2d Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 6 May 2021 19:15:37 +0200 -Subject: Haiku: default to strict Dwarf4 - -Haiku Debugger doesn't support Dwarf5. - - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index d397d87..c09f7e1 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -837,6 +837,8 @@ case ${target} in - "" | yes | posix) thread_file='posix' ;; - esac - default_use_cxa_atexit=yes -+ tm_p_file="${tm_p_file} haiku-protos.h" -+ extra_objs="${extra_objs} haiku.o" +diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host +index ec32980aa..8dbe77c66 100644 +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -267,6 +267,9 @@ case "${host_os}" in + os_include_dir="os/gnu-linux" + fi + ;; ++ haiku*) ++ os_include_dir="os/haiku" ++ ;; + hpux*) + os_include_dir="os/hpux" + ;; +@@ -354,7 +357,7 @@ case "${host}" in + ;; + esac + ;; +- arm*-*-freebsd*) ++ arm*-*-freebsd* | arm*-*-haiku*) + port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" + ;; + powerpc*-*-darwin*) +diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 +index ff44d5ae0..c3a1e0c04 100644 +--- a/libstdc++-v3/crossconfig.m4 ++++ b/libstdc++-v3/crossconfig.m4 +@@ -90,7 +90,7 @@ case "${host}" in + + *-freebsd*) + SECTION_FLAGS='-ffunction-sections -fdata-sections' +- AC_SUBST(SECTION_FLAGS) ++ AC_SUBST(SECTION_FLAGS) + GLIBCXX_CHECK_LINKER_FEATURES + AC_DEFINE(HAVE_SETENV) + AC_DEFINE(HAVE_FINITEF) +@@ -136,6 +136,46 @@ case "${host}" in + AC_CHECK_FUNCS(uselocale) + ;; + ++ *-haiku*) ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ ++ AC_DEFINE(HAVE_INT64_T) ++ ++ AC_DEFINE(HAVE_ACOSF) ++ AC_DEFINE(HAVE_ASINF) ++ AC_DEFINE(HAVE_ATANF) ++ AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COSF) ++ AC_DEFINE(HAVE_COSHF) ++ AC_DEFINE(HAVE_EXPF) ++ AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++ AC_DEFINE(HAVE_FMODF) ++ 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_LOGF) ++ AC_DEFINE(HAVE_LOG10F) ++ AC_DEFINE(HAVE_MODFF) ++ AC_DEFINE(HAVE_SINF) ++ AC_DEFINE(HAVE_SINHF) ++ AC_DEFINE(HAVE_SQRTF) ++ AC_DEFINE(HAVE_TANF) ++ AC_DEFINE(HAVE_TANHF) ++ AC_DEFINE(HAVE_TLS) ++ ;; ++ + *-fuchsia*) + SECTION_FLAGS='-ffunction-sections -fdata-sections' + AC_SUBST(SECTION_FLAGS) +@@ -228,7 +268,7 @@ case "${host}" in + ;; + *-qnx6.1* | *-qnx6.2*) + SECTION_FLAGS='-ffunction-sections -fdata-sections' +- AC_SUBST(SECTION_FLAGS) ++ AC_SUBST(SECTION_FLAGS) + GLIBCXX_CHECK_LINKER_FEATURES + AC_DEFINE(HAVE_COSF) + AC_DEFINE(HAVE_COSL) +diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc +index a620e23e9..ba024c363 100644 +--- a/libstdc++-v3/libsupc++/tinfo.cc ++++ b/libstdc++-v3/libsupc++/tinfo.cc +@@ -30,6 +30,15 @@ std::type_info:: + ~type_info () + { } + ++#ifdef __HAIKU__ ++#ifndef __GXX_MERGED_TYPEINFO_NAMES ++#define __GXX_MERGED_TYPEINFO_NAMES 0 ++#endif ++#ifndef __GXX_TYPEINFO_EQUALITY_INLINE ++#define __GXX_TYPEINFO_EQUALITY_INLINE 0 ++#endif ++#endif ++ + #if !__GXX_TYPEINFO_EQUALITY_INLINE + + // We can't rely on common symbols being shared between shared objects. +diff --git a/libtool.m4 b/libtool.m4 +index 17f8e5f30..3afe21d07 100644 +--- a/libtool.m4 ++++ b/libtool.m4 +@@ -1724,7 +1724,7 @@ else + lt_cv_dlopen_libs= + + case $host_os in +- beos*) ++ beos* | haiku*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes +@@ -2334,8 +2334,9 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +- hardcode_into_libs=yes ++ sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' ++ hardcode_into_libs=no ;; - *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) - extra_options="$extra_options gnu-user.opt" -diff --git a/gcc/config/haiku-protos.h b/gcc/config/haiku-protos.h -new file mode 100644 -index 0000000..22d8e59 ---- /dev/null -+++ b/gcc/config/haiku-protos.h -@@ -0,0 +1,21 @@ -+/* Operating system specific prototypes to be used when targeting GCC for Haiku. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 3, or (at your option) -+any later version. -+ -+GCC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+/* In haiku.c. */ -+extern void haiku_override_options (void); -diff --git a/gcc/config/haiku.c b/gcc/config/haiku.c -new file mode 100644 -index 0000000..bf62ad5 ---- /dev/null -+++ b/gcc/config/haiku.c -@@ -0,0 +1,32 @@ -+/* General Haiku system support. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 3, or (at your option) -+any later version. -+ -+GCC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+#include "config.h" -+#include "system.h" -+#include "coretypes.h" -+#include "target.h" -+ -+void -+haiku_override_options (void) -+{ -+ if (!global_options_set.x_dwarf_strict) -+ dwarf_strict = 1; -+ if (!global_options_set.x_dwarf_version) -+ dwarf_version = 4; -+} -diff --git a/gcc/config/haiku.h b/gcc/config/haiku.h -index faa34be..21e0561 100644 ---- a/gcc/config/haiku.h -+++ b/gcc/config/haiku.h -@@ -53,6 +53,11 @@ Boston, MA 02111-1307, USA. */ - #undef CC1PLUS_SPEC - #define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}" -+#define SUBTARGET_OVERRIDE_OPTIONS \ -+ do { \ -+ haiku_override_options (); \ -+ } while (0) -+ - /* LIB_SPEC for Haiku */ - #undef LIB_SPEC - #define LIB_SPEC "-lroot" -diff --git a/gcc/config/t-haiku b/gcc/config/t-haiku -index 587d1fb..ba1f7f5 100644 ---- a/gcc/config/t-haiku -+++ b/gcc/config/t-haiku -@@ -1,4 +1,9 @@ - # There are system headers elsewhere, but these are the ones that - # we are most likely to want to apply any fixes to. - NATIVE_SYSTEM_HEADER_DIR = /boot/system/develop/headers --LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/posix/limits.h ] -\ No newline at end of file -+LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/posix/limits.h ] -+ -+# Haiku-specific attributes -+haiku.o: $(srcdir)/config/haiku.c -+ $(COMPILE) $< -+ $(POSTCOMPILE) + hpux9* | hpux10* | hpux11*) +@@ -3623,8 +3624,6 @@ m4_if([$1], [CXX], [ + ;; + haiku*) + # PIC is the default for Haiku. +- # The "-static" flag exists, but is broken. +- _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. +@@ -3934,8 +3933,6 @@ m4_if([$1], [CXX], [ + + haiku*) + # PIC is the default for Haiku. +- # The "-static" flag exists, but is broken. +- _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) -- -2.30.2 +2.35.1 +From c1863d9913bf359e846a5ddc4ece5bb9d49c0403 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Fri, 18 Mar 2022 10:31:12 -0500 +Subject: [PATCH 2/3] gcc: backport fix for Canadian builds -From d3ce0f4820e7ff5daeb74fa3b6d3b3561e302081 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Wed, 13 Oct 2021 23:41:37 +0200 -Subject: linking against libssp isn't needed as it's provided by libroot +* Canadian builds are broken in gcc 11.2.0 +* error: 'fenv_t' has not been declared in '::' +* https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587255.html +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017 +* https://gcc.gnu.org/g:01a70ccd723eb9a479186fe37c972b0d0f8676cf +--- + libstdc++-v3/src/c++17/Makefile.am | 2 +- + libstdc++-v3/src/c++17/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) -but building libssp is required to be able to merge libssp_nonshared -in libgcc. - - -diff --git a/gcc/config/haiku.h b/gcc/config/haiku.h -index 21e0561..316d384 100644 ---- a/gcc/config/haiku.h -+++ b/gcc/config/haiku.h -@@ -210,10 +210,9 @@ Boston, MA 02111-1307, USA. */ - /* Haiku headers are C++-aware (and often use C++). */ - /* #define NO_IMPLICIT_EXTERN_C */ - --/* Only allow -lssp for SSP, as -lssp_nonshared is problematic in Haiku */ --#ifndef TARGET_LIBC_PROVIDES_SSP --#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp}" --#endif -+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -+ "|fstack-protector-strong|fstack-protector-explicit" \ -+ ":-lssp_nonshared}" - - /* Do not use TM clone registry in Haiku for now */ - #define USE_TM_CLONE_REGISTRY 0 +diff --git a/libstdc++-v3/src/c++17/Makefile.am b/libstdc++-v3/src/c++17/Makefile.am +index cb94aff5f..2aebc6d52 100644 +--- a/libstdc++-v3/src/c++17/Makefile.am ++++ b/libstdc++-v3/src/c++17/Makefile.am +@@ -79,7 +79,7 @@ endif + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. + AM_CXXFLAGS = \ +- -std=gnu++17 \ ++ -std=gnu++17 -nostdinc++ \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ +diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in +index 63984ecd5..8c02be651 100644 +--- a/libstdc++-v3/src/c++17/Makefile.in ++++ b/libstdc++-v3/src/c++17/Makefile.in +@@ -455,7 +455,7 @@ libc__17convenience_la_SOURCES = $(sources) $(inst_sources) + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. + AM_CXXFLAGS = \ +- -std=gnu++17 \ ++ -std=gnu++17 -nostdinc++ \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ -- -2.30.2 +2.35.1 + +From f1292dd59fa71d8e548646b3508146c7f2b80861 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Przemys=C5=82aw=20Buczkowski?= +Date: Sat, 19 Mar 2022 10:01:48 -0500 +Subject: [PATCH 3/3] GCC: Patch for Apple Silicon compatibility + +This patch fixes a linker error occuring when compiling +the cross-compiler on macOS and ARM64 architecture. + +Adapted from: +https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404 +--- + gcc/config/aarch64/aarch64.h | 2 +- + gcc/config/host-darwin.c | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index bfffbcd6a..4301cbffa 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -1236,7 +1236,7 @@ extern const char *aarch64_rewrite_mcpu (int argc, const char **argv); + #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ + { "rewrite_mcpu", aarch64_rewrite_mcpu }, + +-#if defined(__aarch64__) ++#if defined(__aarch64__) && !defined(__APPLE__) + extern const char *host_detect_local_cpu (int argc, const char **argv); + #define HAVE_LOCAL_CPU_DETECT + # define EXTRA_SPEC_FUNCTIONS \ +diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c +index 14a01fe71..e87b86676 100644 +--- a/gcc/config/host-darwin.c ++++ b/gcc/config/host-darwin.c +@@ -22,6 +22,8 @@ + #include "coretypes.h" + #include "diagnostic-core.h" + #include "config/host-darwin.h" ++#include "hosthooks.h" ++#include "hosthook-def.h" + + /* Yes, this is really supposed to work. */ + /* This allows for a pagesize of 16384, which we have on Darwin20, but should +@@ -79,3 +81,5 @@ darwin_gt_pch_use_address (void *addr, size_t sz, int fd, size_t off) + + return ret; + } ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; +-- +2.35.1