[1/5] gcc: Fix build with glibc 2.31

Message ID 20200205114547.16047-1-michael.tremer@ipfire.org
State New
Headers show
Series [1/5] gcc: Fix build with glibc 2.31 | expand

Commit Message

Michael Tremer Feb. 5, 2020, 11:45 a.m. UTC
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 lfs/gcc                                       |  2 +
 ...c-9.2.0-fix-build-against-glibc-2.31.patch | 46 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch

Comments

Michael Tremer Feb. 5, 2020, 11:46 a.m. UTC | #1
Hello,

I forgot to add that this patchset needs dropping cyrus-imapd and squid 4.10 in order to build.

Best,
-Michael

> On 5 Feb 2020, at 11:45, Michael Tremer <michael.tremer@ipfire.org> wrote:
> 
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
> lfs/gcc                                       |  2 +
> ...c-9.2.0-fix-build-against-glibc-2.31.patch | 46 +++++++++++++++++++
> 2 files changed, 48 insertions(+)
> create mode 100644 src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
> 
> diff --git a/lfs/gcc b/lfs/gcc
> index 224a94bc7..d4bb1aebe 100644
> --- a/lfs/gcc
> +++ b/lfs/gcc
> @@ -224,6 +224,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> 	@rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
> 	@mkdir $(DIR_SRC)/gcc-build
> 
> +	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
> +
> 	cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
> 	cd $(DIR_APP) && sed -i gcc/Makefile.in \
> 		-e 's@\./fixinc\.sh@-c true@' \
> diff --git a/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch b/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
> new file mode 100644
> index 000000000..dd2b11c66
> --- /dev/null
> +++ b/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
> @@ -0,0 +1,46 @@
> +diff -Nur gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
> +--- gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2020-02-03 17:34:44.375766043 +0000
> ++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2020-02-03 17:36:04.054223577 +0000
> +@@ -1156,8 +1156,9 @@
> + CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
> + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
> + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
> +-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
> +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
> ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
> ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
> ++   on many architectures.  */
> + CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
> + #endif
> + 
> +diff -Nur gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
> +--- gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2020-02-03 17:34:44.375766043 +0000
> ++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2020-02-03 17:36:04.054223577 +0000
> +@@ -211,26 +211,13 @@
> +     u64 __unused1;
> +     u64 __unused2;
> + #elif defined(__sparc__)
> +-#if defined(__arch64__)
> +     unsigned mode;
> +-    unsigned short __pad1;
> +-#else
> +-    unsigned short __pad1;
> +-    unsigned short mode;
> +     unsigned short __pad2;
> +-#endif
> +     unsigned short __seq;
> +     unsigned long long __unused1;
> +     unsigned long long __unused2;
> +-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
> +-    unsigned int mode;
> +-    unsigned short __seq;
> +-    unsigned short __pad1;
> +-    unsigned long __unused1;
> +-    unsigned long __unused2;
> + #else
> +-    unsigned short mode;
> +-    unsigned short __pad1;
> ++    unsigned int mode;
> +     unsigned short __seq;
> +     unsigned short __pad2;
> + #if defined(__x86_64__) && !defined(_LP64)
> -- 
> 2.20.1
>

Patch

diff --git a/lfs/gcc b/lfs/gcc
index 224a94bc7..d4bb1aebe 100644
--- a/lfs/gcc
+++ b/lfs/gcc
@@ -224,6 +224,8 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
 	@mkdir $(DIR_SRC)/gcc-build
 
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
+
 	cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
 	cd $(DIR_APP) && sed -i gcc/Makefile.in \
 		-e 's@\./fixinc\.sh@-c true@' \
diff --git a/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch b/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
new file mode 100644
index 000000000..dd2b11c66
--- /dev/null
+++ b/src/patches/gcc-9.2.0-fix-build-against-glibc-2.31.patch
@@ -0,0 +1,46 @@ 
+diff -Nur gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2020-02-03 17:34:44.375766043 +0000
++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2020-02-03 17:36:04.054223577 +0000
+@@ -1156,8 +1156,9 @@
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff -Nur gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+--- gcc-9.2.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2020-02-03 17:34:44.375766043 +0000
++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2020-02-03 17:36:04.054223577 +0000
+@@ -211,26 +211,13 @@
+     u64 __unused1;
+     u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-#else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-#endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+-    unsigned int mode;
+-    unsigned short __seq;
+-    unsigned short __pad1;
+-    unsigned long __unused1;
+-    unsigned long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)