From patchwork Sun Aug 16 10:29:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 3343 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4BTtkt4qy3z3x0m for ; Sun, 16 Aug 2020 10:31:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4BTtjm2fwdzyd; Sun, 16 Aug 2020 10:30:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4BTtjd1SrLz30Yw; Sun, 16 Aug 2020 10:30:29 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4BTtjb1VdHz30Wc for ; Sun, 16 Aug 2020 10:30:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4BTtjZ1wCmzv3; Sun, 16 Aug 2020 10:30:26 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1597573826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FelSjODXH2XjjQe8qa2UlxOvnj3/QZniipJP8ze6bOs=; b=Sewi3z+i4jt7KwOeoh6oke9pt24m3rfq5sIT810GwTNWw9OJRYEmJa0gPFAE8QodWp1Hzt AEBOZMueFzmrkJBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1597573826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FelSjODXH2XjjQe8qa2UlxOvnj3/QZniipJP8ze6bOs=; b=Wbeh2kZOXiZ0mCu3W6tb22Gw6tu3Z6c5CtjO6kJl64G3xf9KPc1acXRbniXxyWBl4rMUOo XjT2fIcJL4HzNoW/qJfqJ2Rxdv2T690Xfs3RCrUjBWnBQE6ZDrtVFodmxoZmNv0DL9S4N7 yhurRODIDqGJzuXlJsv6jSYKaRRaYr3xwtLv0m7S4xx2HjkP1uCckagfuY3+AOwert/Iey lpONGoB5nNJHkTAel8GzNMuHibvSd+r/13YgBJWwmRRJlHr+9svJVu/r9hSpY7hxcn7Buy 1IORI9WcPxudJ8epEENxH9UaT5IwBhboqkYo6VNisK2zkA4MCzklDmzwV+E4oQ== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 37/62] syslinux: Fix build with GCC 10 Date: Sun, 16 Aug 2020 10:29:28 +0000 Message-Id: <20200816102953.3881-37-michael.tremer@ipfire.org> In-Reply-To: <20200816102953.3881-1-michael.tremer@ipfire.org> References: <20200816102953.3881-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- lfs/syslinux | 2 + src/patches/syslinux-6.04_pre1-fcommon.patch | 54 +++++++++++++++++++ ...strlen-that-appears-to-get-optimized.patch | 28 ++++++++++ 3 files changed, 84 insertions(+) create mode 100644 src/patches/syslinux-6.04_pre1-fcommon.patch create mode 100644 src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch diff --git a/lfs/syslinux b/lfs/syslinux index 1670da27e..b2eec0d5b 100644 --- a/lfs/syslinux +++ b/lfs/syslinux @@ -77,6 +77,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # Apply patches cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.03-sysmacros.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04_pre1-fcommon.patch # Build cd $(DIR_APP) && make bios $(MAKETUNING) diff --git a/src/patches/syslinux-6.04_pre1-fcommon.patch b/src/patches/syslinux-6.04_pre1-fcommon.patch new file mode 100644 index 000000000..7d061db26 --- /dev/null +++ b/src/patches/syslinux-6.04_pre1-fcommon.patch @@ -0,0 +1,54 @@ +https://bugs.gentoo.org/705730 + +gcc-10 enabled f-no-common by default. Broke syslinux linking. +--- a/mk/com32.mk ++++ b/mk/com32.mk +@@ -47,6 +47,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0) + GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) + GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0) + GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0) ++GCCOPT += $(call gcc_ok,-fcommon) + + ifeq ($(FWCLASS),EFI) + GCCOPT += -mno-red-zone +--- a/mk/elf.mk ++++ b/mk/elf.mk +@@ -42,6 +42,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0) + GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) + GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0) + GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0) ++GCCOPT += $(call gcc_ok,-fcommon) + + com32 = $(topdir)/com32 + core = $(topdir)/core +--- a/mk/embedded.mk ++++ b/mk/embedded.mk +@@ -51,6 +51,7 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) + GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0) + GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0) + GCCOPT += $(call gcc_ok,-fvisibility=hidden) ++GCCOPT += $(call gcc_ok,-fcommon) + + LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + +--- a/mk/lib.mk ++++ b/mk/lib.mk +@@ -28,6 +28,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0) + GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) + GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0) + GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0) ++GCCOPT += $(call gcc_ok,-fcommon) + + INCLUDE = -I$(SRC) + STRIP = strip --strip-all -R .comment -R .note +--- a/mk/efi.mk ++++ b/mk/efi.mk +@@ -7,7 +7,7 @@ core = $(topdir)/core + # Set up architecture specifics; for cross compilation, set ARCH as apt + # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories + # set up the LIBDIR and EFIINC for building for the appropriate architecture +-GCCOPT := $(call gcc_ok,-fno-stack-protector,) ++GCCOPT := $(call gcc_ok,-fno-stack-protector,) $(call gcc_ok,-fcommon) + EFIINC = $(objdir)/include/efi + LIBDIR = $(objdir)/lib + diff --git a/src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch b/src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch new file mode 100644 index 000000000..c70769fce --- /dev/null +++ b/src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch @@ -0,0 +1,28 @@ +diff --git a/dos/string.h b/dos/string.h +index f648de2d..407d0233 100644 +--- a/dos/string.h ++++ b/dos/string.h +@@ -5,12 +5,22 @@ + #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) ++#define strlen(a) inline_strlen(a) ++ ++/* replacement for builtin strlen that appears to get optimized away */ ++static inline size_t inline_strlen(const char *str) ++{ ++ size_t l; ++ for (l = 0; *str++; l++); ++ return l; ++} + + /* This only returns true or false */ + static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)