From 6aff8a132815a84bab69401c1e7de96ec549fbf2 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 10 Feb 2020 16:37:34 +0100 Subject: build: Always use EXTERN_UNLESS_MAIN_MODULE pattern. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * common/util.h (EXTERN_UNLESS_MAIN_MODULE): Add the definion only here but now without the Norcroft-C. Change all other places where it gets defined. * common/iobuf.h (iobuf_debug_mode): Declare unconditionally as extern. * common/iobuf.c (iobuf_debug_mode): Define it here. * agent/gpg-agent.c (INCLUDED_BY_MAIN_MODULE): Define here and also in all main modules of all other programs. * g10/main.h: Put util.h before the local header files. -- This change is required for use with gcc/ld's LTO feature which does not allow common blocks. Further gcc 10 will make -fno-common the default and thus this chnage is always needed. What a pitty. Co-authored-by: Tomáš Mráz GnuPG-bug-id: 4831 Signed-off-by: Werner Koch (cherry picked from commit 21d9bd8b87a9f793a106095e3838eb71825189d7) - Applied respective chnages also to gpg-card and keyboxd. Signed-off-by: Werner Koch --- g13/g13-common.h | 2 +- g13/g13-syshelp.c | 1 + g13/g13.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'g13') diff --git a/g13/g13-common.h b/g13/g13-common.h index acf25b843..42b8deebd 100644 --- a/g13/g13-common.h +++ b/g13/g13-common.h @@ -32,7 +32,6 @@ #include "../common/session-env.h" #include "../common/strlist.h" - /* Debug values and macros. */ #define DBG_MOUNT_VALUE 1 /* Debug mount or device stuff. */ #define DBG_CRYPTO_VALUE 4 /* Debug low level crypto. */ @@ -48,6 +47,7 @@ /* A large struct named "opt" to keep global flags. Note that this struct is used by g13 and g13-syshelp and thus some fields may only make sense for one of them. */ +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* Debug flags (DBG_foo_VALUE). */ diff --git a/g13/g13-syshelp.c b/g13/g13-syshelp.c index bf71ac20f..4ce74ee4c 100644 --- a/g13/g13-syshelp.c +++ b/g13/g13-syshelp.c @@ -31,6 +31,7 @@ #endif #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "g13-syshelp.h" #include diff --git a/g13/g13.c b/g13/g13.c index 4b925ed59..6265b9f24 100644 --- a/g13/g13.c +++ b/g13/g13.c @@ -27,6 +27,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "g13.h" #include -- cgit v1.2.3