From patchwork Tue May 26 21:27:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1298453 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WnBN1w53z9sRY for ; Wed, 27 May 2020 07:28:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3EC3487CED; Tue, 26 May 2020 21:28:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7IxThD+LilbK; Tue, 26 May 2020 21:28:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 6C93187779; Tue, 26 May 2020 21:28:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 981301BF335 for ; Tue, 26 May 2020 21:28:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8FD7D84921 for ; Tue, 26 May 2020 21:28:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pI6IxcL1SQvu for ; Tue, 26 May 2020 21:28:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 707DD84808 for ; Tue, 26 May 2020 21:28:02 +0000 (UTC) X-Originating-IP: 86.210.146.109 Received: from localhost (lfbn-tou-1-915-109.w86-210.abo.wanadoo.fr [86.210.146.109]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 282E5C0008; Tue, 26 May 2020 21:27:58 +0000 (UTC) From: Thomas Petazzoni To: Buildroot List Date: Tue, 26 May 2020 23:27:54 +0200 Message-Id: <20200526212754.112805-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/gnupg: fix build with gcc 10 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Thiery , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This commit backports an upstream patch made for gnupg2 into gnupg, in order to fix build failures with gcc 10 due to the use of -fno-common. Due to the code differences between upstream gnupg2 and the old gnupg 1.x, the backport is in fact more a rewrite than an actual backport. Fixes: http://autobuild.buildroot.net/results/496a18833505dc589f7ae58f2c7e5fe80fe9af79/ Signed-off-by: Thomas Petazzoni --- ...se-EXTERN_UNLESS_MAIN_MODULE-pattern.patch | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 package/gnupg/0001-build-Always-use-EXTERN_UNLESS_MAIN_MODULE-pattern.patch diff --git a/package/gnupg/0001-build-Always-use-EXTERN_UNLESS_MAIN_MODULE-pattern.patch b/package/gnupg/0001-build-Always-use-EXTERN_UNLESS_MAIN_MODULE-pattern.patch new file mode 100644 index 0000000000..9f0ba1b01e --- /dev/null +++ b/package/gnupg/0001-build-Always-use-EXTERN_UNLESS_MAIN_MODULE-pattern.patch @@ -0,0 +1,156 @@ +From 45ef4455a60929932d1499cf718c1c9f59af9f26 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 26 May 2020 22:57:05 +0200 +Subject: [PATCH] build: Always use EXTERN_UNLESS_MAIN_MODULE pattern + +This patch is loosely based on upstream commit +6aff8a132815a84bab69401c1e7de96ec549fbf2 ("build: Always use +EXTERN_UNLESS_MAIN_MODULE pattern."). However, this upstream commit +applies to gnupg2, and the code base has changed quite significantly +compared to gnupg 1.x, so upstream's patch cannot be applied +as-is. The goal of the patch is to make sure each variable is only +defined once, ass gcc 10 now default to -fno-common. + +Essentially, this patch mainly fixes the EXTERN_UNLESS_MAIN_MODULE +define so that it really expands to "extern" when +INCLUDED_BY_MAIN_MODULE is not defined, even on non-RiscOS +systems. Contrary to upstream's patch we however do not factorize the +multiple EXTERN_UNLESS_MAIN_MODULE definitions into a single place as +it requires too many changes: instead we simply fix the few +definitions of this macro. + +Once the macro is fixed, two places need to define +INCLUDED_BY_MAIN_MODULE: tools/bftest.c and tools/mpicalc.c so that +when they include the common headers, their variables are at least +defined once. + +The iobuf.{c,h} case is handled differently: iobuf.h gains an +unconditional "extern", with the variable being added to iobuf.c. This +is identical to what upstream's +6aff8a132815a84bab69401c1e7de96ec549fbf2 is doing. + +Signed-off-by: Thomas Petazzoni +--- + g10/options.h | 3 +-- + include/cipher.h | 2 +- + include/iobuf.h | 9 +-------- + include/memory.h | 2 +- + include/mpi.h | 2 +- + tools/bftest.c | 1 + + tools/mpicalc.c | 1 + + util/iobuf.c | 2 ++ + 8 files changed, 9 insertions(+), 13 deletions(-) + +diff --git a/g10/options.h b/g10/options.h +index 0ac6e7755..bae19e9e3 100644 +--- a/g10/options.h ++++ b/g10/options.h +@@ -26,8 +26,7 @@ + #include "packet.h" + + #ifndef EXTERN_UNLESS_MAIN_MODULE +-/* Norcraft can't cope with common symbols */ +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) ++#if !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE +diff --git a/include/cipher.h b/include/cipher.h +index dd4af18cb..6ef6e6829 100644 +--- a/include/cipher.h ++++ b/include/cipher.h +@@ -115,7 +115,7 @@ struct gcry_md_context { + typedef struct gcry_md_context *MD_HANDLE; + + #ifndef EXTERN_UNLESS_MAIN_MODULE +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) ++#if !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE +diff --git a/include/iobuf.h b/include/iobuf.h +index 030f8c8e9..b4d26b7e1 100644 +--- a/include/iobuf.h ++++ b/include/iobuf.h +@@ -69,14 +69,7 @@ struct iobuf_struct { + } unget; + }; + +-#ifndef EXTERN_UNLESS_MAIN_MODULE +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +-#define EXTERN_UNLESS_MAIN_MODULE extern +-#else +-#define EXTERN_UNLESS_MAIN_MODULE +-#endif +-#endif +-EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; ++extern int iobuf_debug_mode; + + void iobuf_enable_special_filenames ( int yes ); + int iobuf_is_pipe_filename (const char *fname); +diff --git a/include/memory.h b/include/memory.h +index d414a9b2e..6698337e3 100644 +--- a/include/memory.h ++++ b/include/memory.h +@@ -91,7 +91,7 @@ unsigned secmem_get_flags(void); + #define DBG_MEMSTAT memory_stat_debug_mode + + #ifndef EXTERN_UNLESS_MAIN_MODULE +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) ++#if !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE +diff --git a/include/mpi.h b/include/mpi.h +index a4c16f5af..7a45ff805 100644 +--- a/include/mpi.h ++++ b/include/mpi.h +@@ -36,7 +36,7 @@ + #include "memory.h" + + #ifndef EXTERN_UNLESS_MAIN_MODULE +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) ++#if !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE +diff --git a/tools/bftest.c b/tools/bftest.c +index 8a1572c2b..5afd7e125 100644 +--- a/tools/bftest.c ++++ b/tools/bftest.c +@@ -26,6 +26,7 @@ + #include + #endif + ++#define INCLUDED_BY_MAIN_MODULE + #include "util.h" + #include "cipher.h" + #include "i18n.h" +diff --git a/tools/mpicalc.c b/tools/mpicalc.c +index 46e5fc824..31acd82a4 100644 +--- a/tools/mpicalc.c ++++ b/tools/mpicalc.c +@@ -31,6 +31,7 @@ + #include + #include + ++#define INCLUDED_BY_MAIN_MODULE + #include "util.h" + #include "mpi.h" + #include "i18n.h" +diff --git a/util/iobuf.c b/util/iobuf.c +index c8442929a..0d9ee4cec 100644 +--- a/util/iobuf.c ++++ b/util/iobuf.c +@@ -113,6 +113,8 @@ typedef struct { + static CLOSE_CACHE close_cache; + #endif + ++int iobuf_debug_mode; ++ + #ifdef _WIN32 + typedef struct { + int sock; +-- +2.26.2 +