aboutsummaryrefslogtreecommitdiffstats
path: root/main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch')
-rw-r--r--main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch84
1 files changed, 0 insertions, 84 deletions
diff --git a/main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch b/main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
deleted file mode 100644
index 4eadde5a152..00000000000
--- a/main/gcc/0041-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 2d924c522dde7426afbb8096d9301b17d0e73121 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
-Date: Sun, 28 Nov 2021 00:54:37 +0100
-Subject: [PATCH] libgo: Recognize off64_t and loff_t definitions of musl libc
-
-Without this patch, both off64_t and loff_t are not recognized by
--fdump-go-spec which causes a variety Go-related compilation errors on
-musl libc since the gcc-go frontend expects both off64_t and loff_t to
-be present.
-
-Also make sure that autoconf recognizes support for loff_t on musl, by
-compiling the relevant feature test code with -D_GNU_SOURCE and making
-it include fcntl.h which defines loff_t on musl.
----
- libgo/configure | 4 +++-
- libgo/configure.ac | 4 +++-
- libgo/sysinfo.c | 21 +++++++++++++++++++++
- 3 files changed, 27 insertions(+), 2 deletions(-)
-
-diff --git a/libgo/configure b/libgo/configure
-index 70f64c974fd..69d15839e8c 100755
---- a/libgo/configure
-+++ b/libgo/configure
-@@ -15546,7 +15546,9 @@ _ACEOF
-
- fi
-
--ac_fn_c_check_type "$LINENO" "loff_t" "ac_cv_type_loff_t" "$ac_includes_default"
-+CFLAGS_hold=$CFLAGS
-+CFLAGS="$CFLAGS -D_GNU_SOURCE"
-+ac_fn_c_check_type "$LINENO" "loff_t" "ac_cv_type_loff_t" "#include <fcntl.h>"
- if test "x$ac_cv_type_loff_t" = xyes; then :
-
- cat >>confdefs.h <<_ACEOF
-diff --git a/libgo/configure.ac b/libgo/configure.ac
-index ebab9d9de3e..a3d9d309aba 100644
---- a/libgo/configure.ac
-+++ b/libgo/configure.ac
-@@ -602,7 +602,9 @@ 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="$CFLAGS -D_GNU_SOURCE" # musl does not define loff_t without this
-+AC_CHECK_TYPES([loff_t], [], [], [[#include <fcntl.h>]])
-
- LIBS_hold="$LIBS"
- LIBS="$LIBS -lm"
-diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
-index 8ce061e2f5f..b85add15a7b 100644
---- a/libgo/sysinfo.c
-+++ b/libgo/sysinfo.c
-@@ -343,6 +343,27 @@ enum {
- #endif
- };
-
-+// musl libc has both off64_t and loff_t. However, both of these types
-+// are defined as CPP macros, not as C typedefs. Unfortunately, the GCC
-+// -fdump-go-spec option, which is responsible for generating type
-+// definitions for Go based on this file, only recognizes types defined
-+// through typedefs.
-+//
-+// For this reason, we check here if either off64_t or loff_t are
-+// defined as CPP macros and if so, we redefine them using a C typedef.
-+#if defined(HAVE_OFF64_T) && defined(off64_t)
-+typedef off64_t __musl_off64_t;
-+#undef off64_t
-+typedef __musl_off64_t off64_t;
-+#endif
-+
-+// See comment regarding musl libc above.
-+#if defined(HAVE_LOFF_T) && defined(loff_t)
-+typedef loff_t __musl_loff_t;
-+#undef loff_t
-+typedef __musl_loff_t loff_t;
-+#endif
-+
- // SIOCGIFMTU can't be added in the above enum as it might
- // be signed in some OSes.
- #ifdef SIOCGIFMTU
---
-2.35.1
-