diff --git a/1001-gcc-10-compatibility.patch b/1001-gcc-10-compatibility.patch new file mode 100644 index 0000000000000000000000000000000000000000..3bc49a37efe63e8e193c15115e60888e9e2ecc88 --- /dev/null +++ b/1001-gcc-10-compatibility.patch @@ -0,0 +1,94 @@ +From: Lukas Schwaighofer +Date: Wed, 22 Jul 2020 15:54:20 +0200 +Subject: GCC-10 compatibility patch + +* Add `-fcommon` to most gcc invocations to allow duplicate definitions +* __builtin_strlen seems to fall back to calling strlen if the string in + question is not const and cannot be evaluated at compile time. Work + around the issue by supplying an inline function. The strlen function + was copied from com32/lib/strlen.c. +--- + dos/string.h | 11 ++++++++++- + mk/efi.mk | 1 + + mk/elf.mk | 1 + + mk/embedded.mk | 2 +- + mk/lib.mk | 2 +- + 5 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/dos/string.h b/dos/string.h +index f648de2..c4649f5 100644 +--- a/dos/string.h ++++ b/dos/string.h +@@ -5,12 +5,21 @@ + #ifndef _STRING_H + #define _STRING_H + ++#include ++ + /* Standard routines */ + #define memcpy(a,b,c) __builtin_memcpy(a,b,c) + #define memmove(a,b,c) __builtin_memmove(a,b,c) + #define memset(a,b,c) __builtin_memset(a,b,c) + #define strcpy(a,b) __builtin_strcpy(a,b) +-#define strlen(a) __builtin_strlen(a) ++ ++static inline size_t strlen(const char *s) ++{ ++ const char *ss = s; ++ while (*ss) ++ ss++; ++ return ss - s; ++} + + /* This only returns true or false */ + static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) +diff --git a/mk/efi.mk b/mk/efi.mk +index dc2b708..f1399e5 100644 +--- a/mk/efi.mk ++++ b/mk/efi.mk +@@ -32,6 +32,7 @@ FORMAT=efi-app-$(EFI_SUBARCH) + + CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \ + -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ ++ -fcommon \ + -Wall -I$(com32)/include -I$(com32)/include/sys \ + -I$(core)/include -I$(core)/ $(ARCHOPT) \ + -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \ +diff --git a/mk/elf.mk b/mk/elf.mk +index b46dbd0..dc265ce 100644 +--- a/mk/elf.mk ++++ b/mk/elf.mk +@@ -55,6 +55,7 @@ GPLINCLUDE = + endif + + CFLAGS = $(GCCOPT) $(GCCWARN) -W -Wall \ ++ -fcommon \ + -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -DDYNAMIC_MODULE \ + -nostdinc -iwithprefix include \ + -I$(com32)/libutil/include -I$(com32)/include \ +diff --git a/mk/embedded.mk b/mk/embedded.mk +index 488dc0f..fae13e2 100644 +--- a/mk/embedded.mk ++++ b/mk/embedded.mk +@@ -57,7 +57,7 @@ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + LD += -m elf_$(ARCH) + + # Note: use += for CFLAGS and SFLAGS in case something is set in MCONFIG.local +-CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) ++CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare -fcommon $(OPTFLAGS) $(INCLUDES) + SFLAGS += $(CFLAGS) -D__ASSEMBLY__ + + .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss +diff --git a/mk/lib.mk b/mk/lib.mk +index f3fb07c..2ffea2d 100644 +--- a/mk/lib.mk ++++ b/mk/lib.mk +@@ -49,7 +49,7 @@ OPTFLAGS = -Os -march=$(MARCH) -falign-functions=0 -falign-jumps=0 \ + -falign-labels=0 -ffast-math -fomit-frame-pointer + WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline + +-CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS) ++CFLAGS = $(OPTFLAGS) $(REQFLAGS) -fcommon $(WARNFLAGS) $(LIBFLAGS) + + ifeq ($(FWCLASS),EFI) + CFLAGS += -mno-red-zone diff --git a/syslinux.spec b/syslinux.spec index 22a15a99839d08bf38f524e10543c8367272fd6d..2cd8f66ca7d9685c5fd4b199b4e42b8f9431e3a8 100644 --- a/syslinux.spec +++ b/syslinux.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 %global buildarches %{ix86} x86_64 %ifnarch %{buildarches} %global debug_package %{nil} @@ -18,6 +18,11 @@ Patch0002: 0002-ext4-64bit-feature.patch Patch0003: 0003-extlinux-fix-missing-include-for-major-minor.patch Patch0004: 0004-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch +# Begin: Anolis customized patches +# Backport from debian to fix FTBFS on gcc10 +Patch1001: 1001-gcc-10-compatibility.patch +# End: Anolis customized patches + # this is to keep rpmbuild from thinking the .c32 / .com / .0 / memdisk files # in noarch packages are a reason to stop the build. %define _binaries_in_noarch_packages_terminate_build 0 @@ -267,6 +272,9 @@ fi %endif %changelog +* Mon Dec 13 2021 Weitao Zhou - 6.04-5.0.2 +- Fix gcc10 -fno-common compile issue for compatible with gcc10 build + * Wed Jun 17 2021 Liwei Ge - 6.04-5.0.1 - Enable nonlinux for x86 build