From de507584b8e6bfb0de5f8083395c7e9ff8f663a2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 06 Dec 2021 14:57:24 -0500 Subject: [PATCH] Merge changes from HaikuPorts patches. --- gcc/config.rpath | 4 ++-- gcc/configure | 5 ++++- gcc/configure.ac | 10 ++++++++-- gcc/libtool.m4 | 9 +++------ gcc/gcc/Makefile.in | 2 +- gcc/gcc/config.gcc | 40 +++++++++++++++++++++++----------------- gcc/gcc/configure | 17 +++++++---------- gcc/libatomic/configure | 37 +++++++++++++++++++++++++++++-------- gcc/libatomic/configure.ac | 24 +++++++++++++++--------- gcc/libatomic/configure.tgt | 2 +- gcc/libgcc/config.host | 25 ++++++++++++++----------- gcc/libgcc/crtstuff.c | 2 ++ gcc/libgomp/configure | 44 +++++++++++++++++++++++++++++++++----------- gcc/libgomp/configure.ac | 16 +++++++++++----- gcc/libstdc++-v3/acinclude.m4 | 3 +++ gcc/libstdc++-v3/configure | 17 +++++++++-------- gcc/gcc/config/haiku-protos.h | 21 +++++++++++++++++++++ gcc/gcc/config/haiku-spec.h | 38 -------------------------------------- gcc/gcc/config/haiku.c | 32 ++++++++++++++++++++++++++++++++ gcc/gcc/config/haiku.h | 15 ++++++++------- gcc/gcc/config/t-haiku | 7 ++++++- gcc/gcc/ginclude/stdarg.h | 2 +- gcc/gcc/ginclude/stddef.h | 10 +++++----- gcc/libstdc++-v3/libsupc++/tinfo.cc | 9 +++++++++ gcc/gcc/config/i386/haiku64.h | 2 +- gcc/libstdc++-v3/config/os/haiku/ctype_inline.h | 9 +++++++-- 26 files changed, 248 insertions(+), 154 deletions(-) diff --git a/gcc/config.rpath b/gcc/config.rpath index 7f4f578..5bcc5be 100755 --- a/gcc/config.rpath +++ b/gcc/config.rpath @@ -161,8 +161,8 @@ ;; netbsd*) ;; - haiku*) - ;; + haiku*) + ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no diff --git a/gcc/configure b/gcc/configure index c345046..ae35c0c 100755 --- a/gcc/configure +++ b/gcc/configure @@ -3161,7 +3161,7 @@ ;; *-*-solaris2* | *-*-hpux11*) ;; - *-*-darwin* | *-*-aix*) + *-*-darwin* | *-*-aix* | *-*-haiku*) ;; nvptx*-*-*) ;; @@ -3380,6 +3380,9 @@ ;; *-*-darwin*) noconfigdirs="$noconfigdirs target-libffi" + ;; + *-*-haiku*) + noconfigdirs="$noconfigdirs ${libgcj}" ;; *-*-netware*) noconfigdirs="$noconfigdirs target-libffi" diff --git a/gcc/configure.ac b/gcc/configure.ac index 9486a10..e50f9a4 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -513,7 +513,7 @@ ;; *-*-solaris2* | *-*-hpux11*) ;; - *-*-darwin* | *-*-aix*) + *-*-darwin* | *-*-aix* | *-*-haiku*) ;; nvptx*-*-*) ;; @@ -712,6 +712,9 @@ *-*-darwin*) noconfigdirs="$noconfigdirs target-libffi" ;; + *-*-haiku*) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; *-*-netware*) noconfigdirs="$noconfigdirs target-libffi" ;; @@ -878,7 +881,7 @@ *-*-aix*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; - *-*-haiku*) + *-*-beos*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; *-*-chorusos) @@ -888,6 +891,9 @@ noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; *-*-freebsd*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; + *-*-haiku*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) diff --git a/gcc/libtool.m4 b/gcc/libtool.m4 index 615cd59..64f5446 100644 --- a/gcc/libtool.m4 +++ b/gcc/libtool.m4 @@ -2342,8 +2342,9 @@ 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*) @@ -3626,8 +3627,6 @@ ;; 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. @@ -3937,8 +3936,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) diff --git a/gcc/gcc/Makefile.in b/gcc/gcc/Makefile.in index cdd916f..74d3ef4 100644 --- a/gcc/gcc/Makefile.in +++ b/gcc/gcc/Makefile.in @@ -2819,7 +2819,7 @@ genprog = $(genprogerr) check checksum condmd match # These programs need libs over and above what they get from the above list. -build/genautomata$(build_exeext) : BUILD_LIBS += -lm +build/genautomata$(build_exeext) : BUILD_LIBS += @build_math_library@ build/genrecog$(build_exeext) : build/hash-table.o build/inchash.o build/gencfn-macros$(build_exeext) : build/hash-table.o build/vec.o \ diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc index ea61f2b..244440c 100644 --- a/gcc/gcc/config.gcc +++ b/gcc/gcc/config.gcc @@ -759,6 +759,8 @@ "" | 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) extra_options="$extra_options gnu-user.opt" @@ -1151,15 +1153,15 @@ target_cpu_cname="arm6" ;; arm*-*-haiku*) - tmake_file="${tmake_file} t-haiku arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-haiku" - tm_file="dbxelf.h elfos.h haiku.h arm/elf.h arm/bpabi.h arm/haiku.h haiku-stdint.h" - # The BPABI long long divmod functions return a 128-bit value in - # registers r0-r3. Correctly modeling that requires the use of - # TImode. - need_64bit_hwint=yes - default_use_cxa_atexit=yes - tm_file="${tm_file} arm/aout.h arm/arm.h" - ;; + tmake_file="${tmake_file} t-haiku arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-haiku" + tm_file="dbxelf.h elfos.h haiku.h arm/elf.h arm/bpabi.h arm/haiku.h haiku-stdint.h" + # The BPABI long long divmod functions return a 128-bit value in + # registers r0-r3. Correctly modeling that requires the use of + # TImode. + need_64bit_hwint=yes + default_use_cxa_atexit=yes + tm_file="${tm_file} arm/aout.h arm/arm.h" + ;; arm*-*-linux-*) # ARM GNU/Linux with ELF 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" @@ -2047,12 +2049,12 @@ tm_defines="${tm_defines} MOTOROLA=1" ;; m68k-*-haiku*) - 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 haiku-stdint.h" - tm_defines="${tm_defines} MOTOROLA=1" - ;; + 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_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 @@ -2181,10 +2183,10 @@ gas=yes ;; mipsel-*-haiku*) - target_cpu_default="MASK_ABICALLS" - tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h haiku-stdint.h" - tmake_file="${tmake_file} mips/t-elf t-haiku" - ;; + target_cpu_default="MASK_ABICALLS" + tm_file="elfos.h ${tm_file} haiku.h mips/haiku.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" diff --git a/gcc/gcc/configure b/gcc/gcc/configure index f43e876..59cdd16 100755 --- a/gcc/gcc/configure +++ b/gcc/gcc/configure @@ -15565,8 +15565,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= ;; hpux*) @@ -17678,8 +17676,9 @@ 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*) @@ -18196,7 +18195,7 @@ lt_cv_dlopen_libs= case $host_os in - beos* | haiku*) + beos* | haiku* ) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes @@ -20394,7 +20393,6 @@ ;; esac ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; @@ -20416,8 +20414,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. @@ -21338,8 +21334,9 @@ 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/libatomic/configure b/gcc/libatomic/configure index b902e2c..37044e8 100755 --- a/gcc/libatomic/configure +++ b/gcc/libatomic/configure @@ -8211,8 +8211,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= ;; hpux*) @@ -10324,8 +10322,9 @@ 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*) @@ -10842,7 +10841,7 @@ 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 @@ -11120,7 +11119,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11123 "configure" +#line 11122 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11226,7 +11225,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11229 "configure" +#line 11228 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14609,11 +14608,26 @@ case " $config_path " in *" posix "*) XPCFLAGS="" - 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 : + +else + CFLAGS="$CFLAGS -pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void *g(void *d) { return NULL; } int main () { @@ -14626,10 +14640,10 @@ 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 () { @@ -14642,6 +14656,9 @@ else as_fn_error "Pthreads are required to build libatomic" "$LINENO" 5 +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 diff --git a/gcc/libatomic/configure.ac b/gcc/libatomic/configure.ac index d9cdc8e..abbb751 100644 --- a/gcc/libatomic/configure.ac +++ b/gcc/libatomic/configure.ac @@ -209,21 +209,27 @@ case " $config_path " in *" posix "*) XPCFLAGS="" - CFLAGS="$CFLAGS -pthread" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include void *g(void *d) { return NULL; }], [pthread_t t; pthread_create(&t,NULL,g,NULL);])], - [XPCFLAGS=" -pthread"], - [CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS" + [], + [CFLAGS="$CFLAGS -pthread" AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include - void *g(void *d) { return NULL; }], - [pthread_t t; pthread_create(&t,NULL,g,NULL);])], - [], - [AC_MSG_ERROR([Pthreads are required to build libatomic])])]) + [AC_LANG_PROGRAM( + [#include + void *g(void *d) { return NULL; }], + [pthread_t t; pthread_create(&t,NULL,g,NULL);])], + [XPCFLAGS=" -pthread"], + [CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include + void *g(void *d) { return NULL; }], + [pthread_t t; pthread_create(&t,NULL,g,NULL);])], + [], + [AC_MSG_ERROR([Pthreads are required to build libatomic])])])]) CFLAGS="$save_CFLAGS $XPCFLAGS" ;; esac diff --git a/gcc/libatomic/configure.tgt b/gcc/libatomic/configure.tgt index ea8c34f..dc3b106 100644 --- a/gcc/libatomic/configure.tgt +++ b/gcc/libatomic/configure.tgt @@ -137,7 +137,7 @@ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \ | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \ | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \ - | *-*-darwin* | *-*-aix* | *-*-cygwin*) + | *-*-darwin* | *-*-aix* | *-*-cygwin* | *-*-haiku*) # POSIX system. The OS is supported. config_path="${config_path} posix" ;; diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host index 0c8d424..e7f75a9 100644 --- a/gcc/libgcc/config.host +++ b/gcc/libgcc/config.host @@ -231,13 +231,17 @@ ;; esac ;; -*-*-haiku*) - tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-slibgcc-nolc-override t-haiku" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - ;; *-*-fuchsia*) 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" + ;; +*-*-haiku*) + # This is the generic ELF configuration of Haiku. Later + # 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-libgcc t-slibgcc-nolc-override" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) 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" @@ -417,13 +421,6 @@ arm*-*-freebsd*) # ARM FreeBSD EABI tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix arm/t-elf" tmake_file="${tmake_file} arm/t-bpabi arm/t-freebsd" - tm_file="${tm_file} arm/bpabi-lib.h" - unwind_header=config/arm/unwind-arm.h - tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" - ;; -arm*-*-haiku*) - tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix arm/t-elf" - tmake_file="${tmake_file} arm/t-bpabi" tm_file="${tm_file} arm/bpabi-lib.h" unwind_header=config/arm/unwind-arm.h tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" @@ -436,6 +433,12 @@ ;; arm*-*-netbsdelf*) tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover" + ;; +arm-*-haiku*) + tmake_file="${tmake_file} arm/t-arm arm/t-elf arm/t-bpabi" + tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" + tm_file="${tm_file} arm/bpabi-lib.h" + unwind_header=config/arm/unwind-arm.h ;; arm*-*-linux*) # ARM GNU/Linux with ELF tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm" diff --git a/gcc/libgcc/crtstuff.c b/gcc/libgcc/crtstuff.c index 5e89445..41b8583 100644 --- a/gcc/libgcc/crtstuff.c +++ b/gcc/libgcc/crtstuff.c @@ -108,7 +108,9 @@ && defined(HAVE_LD_EH_FRAME_HDR) \ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ && defined(__GLIBC__) && __GLIBC__ >= 2 +#ifndef __HAIKU__ #include +#endif /* 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/gcc/libgomp/configure b/gcc/libgomp/configure index ced7606..10c98d0 100755 --- a/gcc/libgomp/configure +++ b/gcc/libgomp/configure @@ -8248,8 +8248,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= ;; hpux*) @@ -10361,8 +10359,9 @@ 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*) @@ -10879,7 +10878,7 @@ 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 @@ -11157,7 +11156,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11160 "configure" +#line 11159 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11263,7 +11262,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11266 "configure" +#line 11265 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12123,8 +12122,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_FC= ;; hpux*) @@ -14001,8 +13998,9 @@ 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*) @@ -15086,7 +15084,6 @@ *) # 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 @@ -15100,13 +15097,29 @@ } _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 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=" -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 () { @@ -15119,6 +15132,9 @@ else as_fn_error "Pthreads are required to build libgomp" "$LINENO" 5 +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 diff --git a/gcc/libgomp/configure.ac b/gcc/libgomp/configure.ac index 4e0bc81..f6503ef 100644 --- a/gcc/libgomp/configure.ac +++ b/gcc/libgomp/configure.ac @@ -188,21 +188,27 @@ *) # 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" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include void *g(void *d) { return NULL; }], [pthread_t t; pthread_create(&t,NULL,g,NULL);])], - [XPCFLAGS=" -Wc,-pthread"], - [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" + [], + [CFLAGS="$CFLAGS -pthread" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include void *g(void *d) { return NULL; }], [pthread_t t; pthread_create(&t,NULL,g,NULL);])], - [], - [AC_MSG_ERROR([Pthreads are required to build libgomp])])]) + [XPCFLAGS=" -Wc,-pthread"], + [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include + void *g(void *d) { return NULL; }], + [pthread_t t; pthread_create(&t,NULL,g,NULL);])], + [], + [AC_MSG_ERROR([Pthreads are required to build libgomp])])])]) esac if test x$libgomp_use_pthreads != xno; then diff --git a/gcc/libstdc++-v3/acinclude.m4 b/gcc/libstdc++-v3/acinclude.m4 index 4f37b6a..7d8fd79 100644 --- a/gcc/libstdc++-v3/acinclude.m4 +++ b/gcc/libstdc++-v3/acinclude.m4 @@ -4299,6 +4299,9 @@ solaris*) enable_libstdcxx_filesystem_ts=yes ;; + haiku*) + enable_libstdcxx_filesystem_ts=yes + ;; *) enable_libstdcxx_filesystem_ts=no ;; diff --git a/gcc/libstdc++-v3/configure b/gcc/libstdc++-v3/configure index c8b2bef..c32ddb3 100755 --- a/gcc/libstdc++-v3/configure +++ b/gcc/libstdc++-v3/configure @@ -8672,8 +8672,6 @@ haiku*) # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= ;; hpux*) @@ -10794,8 +10792,9 @@ 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*) @@ -13556,8 +13555,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. @@ -14478,8 +14475,9 @@ 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*) @@ -80142,6 +80140,9 @@ enable_libstdcxx_filesystem_ts=yes ;; solaris*) + enable_libstdcxx_filesystem_ts=yes + ;; + haiku*) enable_libstdcxx_filesystem_ts=yes ;; *) diff --git a/gcc/gcc/config/haiku-protos.h b/gcc/gcc/config/haiku-protos.h new file mode 100644 index 0000000..22d8e59 100644 --- /dev/null +++ b/gcc/gcc/config/haiku-protos.h @@ -1,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/gcc/config/haiku-spec.h b/gcc/gcc/config/haiku-spec.h deleted file mode 100644 index 5ca8985..0000000 100644 --- a/gcc/gcc/config/haiku-spec.h +++ /dev/null @@ -1,38 +1,0 @@ -#define HAIKU_TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__HAIKU__"); \ - builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ - builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ - 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"); \ - HAIKU_TARGET_CPU_CPP_BUILTINS(); \ - } \ - while (0) - -/* Define the default Haiku-specific per-CPU hook code. */ -#define HAIKU_TARGET_CPU_CPP_BUILTINS() do {} while (0) - -/* Provide a CPP_SPEC appropriate for Haiku. We just deal with the GCC - option `-posix', and PIC issues. */ - -#define HAIKU_CPP_SPEC " \ - %(cpp_cpu) \ - %(cpp_arch) \ - %{posix:-D_POSIX_SOURCE}" - -#define HAIKU_STARTFILE_SPEC \ - "crti.o%s crtbeginS.o%s %{!shared:%{!nostart:start_dyn.o%s}} init_term_dyn.o%s" - -#define HAIKU_ENDFILE_SPEC \ - "crtendS.o%s crtn.o%s" - -#define HAIKU_LIB_SPEC \ - "-lroot" - -#define HAIKU_DYNAMIC_LINKER \ - "/system/runtime_loader" diff --git a/gcc/gcc/config/haiku.c b/gcc/gcc/config/haiku.c new file mode 100644 index 0000000..bf62ad5 100644 --- /dev/null +++ b/gcc/gcc/config/haiku.c @@ -1,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/gcc/config/haiku.h b/gcc/gcc/config/haiku.h index e3a9c7e..ebb29ab 100644 --- a/gcc/gcc/config/haiku.h +++ b/gcc/gcc/config/haiku.h @@ -53,6 +53,11 @@ #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" @@ -204,14 +209,10 @@ /* 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 -/* Do not use JCR_SECTION_NAME default definition for Haiku */ -#define TARGET_NO_JCR_SECTION_NAME 1 +#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/gcc/config/t-haiku b/gcc/gcc/config/t-haiku index 587d1fb..ba1f7f5 100644 --- a/gcc/gcc/config/t-haiku +++ b/gcc/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 ]+LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/posix/limits.h ] + +# Haiku-specific attributes +haiku.o: $(srcdir)/config/haiku.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/gcc/ginclude/stdarg.h b/gcc/gcc/ginclude/stdarg.h index e4c73fd..cc73248 100644 --- a/gcc/gcc/ginclude/stdarg.h +++ b/gcc/gcc/ginclude/stdarg.h @@ -94,7 +94,7 @@ #ifndef _VA_LIST /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ #ifndef _VA_LIST_T_H -/* The macro __va_list__ is used by BeOS. */ +/* The macro __va_list__ is used by BeOS and Haiku. */ #ifndef __va_list__ typedef __gnuc_va_list va_list; #endif /* not __va_list__ */ diff --git a/gcc/gcc/ginclude/stddef.h b/gcc/gcc/ginclude/stddef.h index 31b96a7..ca20f4d 100644 --- a/gcc/gcc/ginclude/stddef.h +++ b/gcc/gcc/ginclude/stddef.h @@ -167,7 +167,7 @@ /* Define this type if we are doing the whole job, or if we want this type in particular. */ #if defined (_STDDEF_H) || defined (__need_size_t) -#ifndef __size_t__ /* BeOS */ +#ifndef __size_t__ /* BeOS, Haiku */ #ifndef __SIZE_T__ /* Cray Unicos/Mk */ #ifndef _SIZE_T /* in case has defined it. */ #ifndef _SYS_SIZE_T_H @@ -184,7 +184,7 @@ #ifndef _GCC_SIZE_T #ifndef _SIZET_ #ifndef __size_t -#define __size_t__ /* BeOS */ +#define __size_t__ /* BeOS, Haiku */ #define __SIZE_T__ /* Cray Unicos/Mk */ #define _SIZE_T #define _SYS_SIZE_T_H @@ -214,7 +214,7 @@ #endif #if !(defined (__GNUG__) && defined (size_t)) typedef __SIZE_TYPE__ size_t; -#ifdef __BEOS__ +#if defined(__BEOS__) typedef long ssize_t; #endif /* __BEOS__ */ #endif /* !(defined (__GNUG__) && defined (size_t)) */ @@ -247,7 +247,7 @@ /* Define this type if we are doing the whole job, or if we want this type in particular. */ #if defined (_STDDEF_H) || defined (__need_wchar_t) -#ifndef __wchar_t__ /* BeOS */ +#ifndef __wchar_t__ /* BeOS, Haiku */ #ifndef __WCHAR_T__ /* Cray Unicos/Mk */ #ifndef _WCHAR_T #ifndef _T_WCHAR_ @@ -264,7 +264,7 @@ #ifndef ___int_wchar_t_h #ifndef __INT_WCHAR_T_H #ifndef _GCC_WCHAR_T -#define __wchar_t__ /* BeOS */ +#define __wchar_t__ /* BeOS, Haiku */ #define __WCHAR_T__ /* Cray Unicos/Mk */ #define _WCHAR_T #define _T_WCHAR_ diff --git a/gcc/libstdc++-v3/libsupc++/tinfo.cc b/gcc/libstdc++-v3/libsupc++/tinfo.cc index 16097de..72447b1 100644 --- a/gcc/libstdc++-v3/libsupc++/tinfo.cc +++ b/gcc/libstdc++-v3/libsupc++/tinfo.cc @@ -30,6 +30,15 @@ ~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/gcc/gcc/config/i386/haiku64.h b/gcc/gcc/config/i386/haiku64.h index 8c43498..e2fa55a 100644 --- a/gcc/gcc/config/i386/haiku64.h +++ b/gcc/gcc/config/i386/haiku64.h @@ -113,7 +113,7 @@ %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64}" #undef ASM_OUTPUT_ALIGNED_DECL_COMMON -#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); diff --git a/gcc/libstdc++-v3/config/os/haiku/ctype_inline.h b/gcc/libstdc++-v3/config/os/haiku/ctype_inline.h index 0419139..5b5cc56 100644 --- a/gcc/libstdc++-v3/config/os/haiku/ctype_inline.h +++ b/gcc/libstdc++-v3/config/os/haiku/ctype_inline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000-2013 Free Software Foundation, Inc. +// Copyright (C) 2000-2015 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 @@ -97,6 +97,11 @@ case graph: __testis = isgraph(__c); break; +#if __cplusplus >= 201103L + case blank: + __testis = isblank(__c); + break; +#endif default: __testis = false; break; @@ -117,7 +122,7 @@ *__vec++ = _M_table[static_cast(*__low++)]; else { - // Highest bitmask in ctype_base == 10. + // Highest bitmask in ctype_base == 11. const size_t __bitmasksize = 15; for (;__low < __high; ++__vec, ++__low) { -- gitore 0.2.2