diff --git a/cross-aarch64-gcc.spec b/cross-aarch64-gcc.spec index 15e7f85..f94f09e 100644 --- a/cross-aarch64-gcc.spec +++ b/cross-aarch64-gcc.spec @@ -191,6 +191,7 @@ Patch15: gcc10-pr96939-3.patch Patch16: gcc10-reproducible-builds.patch Patch17: gcc10-reproducible-builds-buildid-for-checksum.patch Patch18: gcc10-compiler-correct-condition-for-calling-memclrHasPoin.patch +Patch19: gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch BuildRequires: binutils >= 2.31 BuildRequires: glibc-static @@ -550,7 +551,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch16 -p0 -b .reproducible-builds~ %patch17 -p1 -b .reproducible-builds-buildid-for-checksum~ %patch18 -p1 -b .correct-condition-for-calling-memclrHasPointers~ - +%patch19 -p1 -b .off_t-macros~ echo 'Sailfish OS gcc %{version}-%{gcc_release}' > gcc/DEV-PHASE diff --git a/cross-armv7hl-gcc.spec b/cross-armv7hl-gcc.spec index 7027171..9c3368c 100644 --- a/cross-armv7hl-gcc.spec +++ b/cross-armv7hl-gcc.spec @@ -191,6 +191,7 @@ Patch15: gcc10-pr96939-3.patch Patch16: gcc10-reproducible-builds.patch Patch17: gcc10-reproducible-builds-buildid-for-checksum.patch Patch18: gcc10-compiler-correct-condition-for-calling-memclrHasPoin.patch +Patch19: gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch BuildRequires: binutils >= 2.31 BuildRequires: glibc-static @@ -550,7 +551,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch16 -p0 -b .reproducible-builds~ %patch17 -p1 -b .reproducible-builds-buildid-for-checksum~ %patch18 -p1 -b .correct-condition-for-calling-memclrHasPointers~ - +%patch19 -p1 -b .off_t-macros~ echo 'Sailfish OS gcc %{version}-%{gcc_release}' > gcc/DEV-PHASE diff --git a/cross-i486-gcc.spec b/cross-i486-gcc.spec index 25aaf4f..af98fb3 100644 --- a/cross-i486-gcc.spec +++ b/cross-i486-gcc.spec @@ -191,6 +191,7 @@ Patch15: gcc10-pr96939-3.patch Patch16: gcc10-reproducible-builds.patch Patch17: gcc10-reproducible-builds-buildid-for-checksum.patch Patch18: gcc10-compiler-correct-condition-for-calling-memclrHasPoin.patch +Patch19: gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch BuildRequires: binutils >= 2.31 BuildRequires: glibc-static @@ -550,7 +551,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch16 -p0 -b .reproducible-builds~ %patch17 -p1 -b .reproducible-builds-buildid-for-checksum~ %patch18 -p1 -b .correct-condition-for-calling-memclrHasPointers~ - +%patch19 -p1 -b .off_t-macros~ echo 'Sailfish OS gcc %{version}-%{gcc_release}' > gcc/DEV-PHASE diff --git a/cross-x86_64-gcc.spec b/cross-x86_64-gcc.spec index 64498a5..15a3328 100644 --- a/cross-x86_64-gcc.spec +++ b/cross-x86_64-gcc.spec @@ -191,6 +191,7 @@ Patch15: gcc10-pr96939-3.patch Patch16: gcc10-reproducible-builds.patch Patch17: gcc10-reproducible-builds-buildid-for-checksum.patch Patch18: gcc10-compiler-correct-condition-for-calling-memclrHasPoin.patch +Patch19: gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch BuildRequires: binutils >= 2.31 BuildRequires: glibc-static @@ -550,7 +551,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch16 -p0 -b .reproducible-builds~ %patch17 -p1 -b .reproducible-builds-buildid-for-checksum~ %patch18 -p1 -b .correct-condition-for-calling-memclrHasPointers~ - +%patch19 -p1 -b .off_t-macros~ echo 'Sailfish OS gcc %{version}-%{gcc_release}' > gcc/DEV-PHASE diff --git a/gcc.spec b/gcc.spec index 0c743b1..50d73f9 100644 --- a/gcc.spec +++ b/gcc.spec @@ -190,6 +190,7 @@ Patch15: gcc10-pr96939-3.patch Patch16: gcc10-reproducible-builds.patch Patch17: gcc10-reproducible-builds-buildid-for-checksum.patch Patch18: gcc10-compiler-correct-condition-for-calling-memclrHasPoin.patch +Patch19: gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch BuildRequires: binutils >= 2.31 BuildRequires: glibc-static @@ -549,7 +550,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch16 -p0 -b .reproducible-builds~ %patch17 -p1 -b .reproducible-builds-buildid-for-checksum~ %patch18 -p1 -b .correct-condition-for-calling-memclrHasPointers~ - +%patch19 -p1 -b .off_t-macros~ echo 'Sailfish OS gcc %{version}-%{gcc_release}' > gcc/DEV-PHASE diff --git a/gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch b/gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch new file mode 100644 index 0000000..befe79a --- /dev/null +++ b/gcc10-libgo-permit-loff_t-and-off_t-to-be-macros.patch @@ -0,0 +1,167 @@ +diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE +index 0cda305c648..4b75dd37355 100644 +--- a/gcc/go/gofrontend/MERGE ++++ b/gcc/go/gofrontend/MERGE +@@ -1,4 +1,4 @@ +-8db6b78110f84e22c409f334aeaefb80a8b39917 ++a409e049737ec9a358a19233e017d957db3d6d2a + + The first line of this file holds the git revision number of the last + merge done from the gofrontend repository. +diff --git a/libgo/config.h.in b/libgo/config.h.in +index 25b8ab8f9ee..2c3c7469675 100644 +--- a/libgo/config.h.in ++++ b/libgo/config.h.in +@@ -70,6 +70,9 @@ + /* Define to 1 if you have the `fchownat' function. */ + #undef HAVE_FCHOWNAT + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_FCNTL_H ++ + /* Define to 1 if you have the `futimesat' function. */ + #undef HAVE_FUTIMESAT + +diff --git a/libgo/configure b/libgo/configure +index ffe17c9be55..b7ff9b32867 100755 +--- a/libgo/configure ++++ b/libgo/configure +@@ -15249,7 +15249,7 @@ $as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h + fi + + +-for ac_header in port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/sysctl.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/bpf.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h lwp.h ++for ac_header in fcntl.h port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/sysctl.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/bpf.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h lwp.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` + ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +@@ -15546,7 +15546,11 @@ _ACEOF + + fi + +-ac_fn_c_check_type "$LINENO" "loff_t" "ac_cv_type_loff_t" "$ac_includes_default" ++ ++CFLAGS_hold="$CFLAGS" ++CFLAGS="$OSCFLAGS $CFLAGS" ++ac_fn_c_check_type "$LINENO" "loff_t" "ac_cv_type_loff_t" "#include ++" + if test "x$ac_cv_type_loff_t" = xyes; then : + + cat >>confdefs.h <<_ACEOF +@@ -15556,6 +15560,7 @@ _ACEOF + + fi + ++CFLAGS="$CFLAGS_hold" + + LIBS_hold="$LIBS" + LIBS="$LIBS -lm" +diff --git a/libgo/configure.ac b/libgo/configure.ac +index 7e2b98ba67c..bac58b07b41 100644 +--- a/libgo/configure.ac ++++ b/libgo/configure.ac +@@ -579,7 +579,7 @@ AC_C_BIGENDIAN + + GCC_CHECK_UNWIND_GETIPINFO + +-AC_CHECK_HEADERS(port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/sysctl.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/bpf.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h lwp.h) ++AC_CHECK_HEADERS(fcntl.h port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/sysctl.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/bpf.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h lwp.h) + + AC_CHECK_HEADERS([netinet/icmp6.h], [], [], + [#include +@@ -601,7 +601,11 @@ AC_STRUCT_DIRENT_D_TYPE + + AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice syscall tee unlinkat unshare utimensat) + AC_TYPE_OFF_T +-AC_CHECK_TYPES([loff_t]) ++ ++CFLAGS_hold="$CFLAGS" ++CFLAGS="$OSCFLAGS $CFLAGS" ++AC_CHECK_TYPES([loff_t], [], [], [[#include ]]) ++CFLAGS="$CFLAGS_hold" + + LIBS_hold="$LIBS" + LIBS="$LIBS -lm" +diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go +index 7bec2fbaeb5..19ae4393cf1 100644 +--- a/libgo/go/syscall/libcall_linux.go ++++ b/libgo/go/syscall/libcall_linux.go +@@ -210,20 +210,20 @@ func Gettid() (tid int) { + //sys Setxattr(path string, attr string, data []byte, flags int) (err error) + //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int + +-//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) +-//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t ++//sys splice(rfd int, roff *_libgo_loff_t_type, wfd int, woff *_libgo_loff_t_type, len int, flags int) (n int64, err error) ++//splice(rfd _C_int, roff *_libgo_loff_t_type, wfd _C_int, woff *_libgo_loff_t_type, len Size_t, flags _C_uint) Ssize_t + + func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { +- var lroff _loff_t +- var plroff *_loff_t ++ var lroff _libgo_loff_t_type ++ var plroff *_libgo_loff_t_type + if roff != nil { +- lroff = _loff_t(*roff) ++ lroff = _libgo_loff_t_type(*roff) + plroff = &lroff + } +- var lwoff _loff_t +- var plwoff *_loff_t ++ var lwoff _libgo_loff_t_type ++ var plwoff *_libgo_loff_t_type + if woff != nil { +- lwoff = _loff_t(*woff) ++ lwoff = _libgo_loff_t_type(*woff) + plwoff = &lwoff + } + n, err = splice(rfd, plroff, wfd, plwoff, len, flags) +diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh +index 0c52ea5d71a..5aa309155c3 100755 +--- a/libgo/mksysinfo.sh ++++ b/libgo/mksysinfo.sh +@@ -403,11 +403,7 @@ fi + # Some basic types. + echo 'type Size_t _size_t' >> ${OUT} + echo "type Ssize_t _ssize_t" >> ${OUT} +-if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then +- echo "type Offset_t _off64_t" >> ${OUT} +-else +- echo "type Offset_t _off_t" >> ${OUT} +-fi ++echo "type Offset_t _libgo_off_t_type" >> ${OUT} + echo "type Mode_t _mode_t" >> ${OUT} + echo "type Pid_t _pid_t" >> ${OUT} + echo "type Uid_t _uid_t" >> ${OUT} +diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c +index 8ce061e2f5f..a4259c02ded 100644 +--- a/libgo/sysinfo.c ++++ b/libgo/sysinfo.c +@@ -357,6 +357,18 @@ enum { + }; + #endif + ++#if defined(HAVE_LOFF_T) ++// loff_t can be defined as a macro; for -fgo-dump-spec make sure we ++// see a typedef. ++typedef loff_t libgo_loff_t_type; ++#endif ++ ++#if defined(HAVE_OFF64_T) ++typedef off64_t libgo_off_t_type; ++#else ++typedef off_t libgo_off_t_type; ++#endif ++ + // The following section introduces explicit references to types and + // constants of interest to support bootstrapping libgo using a + // compiler that doesn't support -fdump-go-spec (e.g., clang), via +@@ -537,7 +549,8 @@ SREF(timex); + // From sys/types.h + TREF(pid_t); + TREF(off_t); +-TREF(loff_t); ++TREF(libgo_loff_t_type); ++TREF(libgo_off_t_type); + TREF(size_t); + TREF(ssize_t); + TREF(mode_t);