Skip to contentSkip to conversation

minicom: Fix build when using -fno-common

PATCH New Khem Raj 1 participant 1 message Aug 5, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 minicom: Fix build when using -fno-common

gcc10 defaults to -fno-common which flags the multiple global variables as errors, these patches ( from fedora ) fixes the issue

---
 ...erfluous-global-variable-definitions.patch | 35 ++++++++++++++++
 ...erfluous-global-variable-definitions.patch | 37 ++++++++++++++++
 ...erfluous-global-variable-definitions.patch | 42 +++++++++++++++++++
 .../recipes-extended/minicom/minicom_2.7.1.bb |  3 ++
 4 files changed, 117 insertions(+)
 create mode 100644 meta/recipes-extended/minicom/minicom/0001-Drop-superfluous-global-variable-definitions.patch
 create mode 100644 meta/recipes-extended/minicom/minicom/0002-Drop-superfluous-global-variable-definitions.patch
 create mode 100644 meta/recipes-extended/minicom/minicom/0003-Drop-superfluous-global-variable-definitions.patch
meta/recipes-extended/minicom/minicom/0001-Drop-superfluous-global-variable-definitions.patch new file +35 -0
new file mode 100644
index 0000000000..4c6e249315
@@ -0,0 +1,35 @@
+From b65152ebc03832972115e6d98e50cb6190d01793 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <[email protected]>
+Date: Mon, 3 Feb 2020 13:18:13 +0100
+Subject: [PATCH 1/3] Drop superfluous global variable definitions
+
+The file minicom.c, by including the minicom.h header, already defines
+the global variables 'dial_user' and 'dial_pass'. The object file
+minicom.o is always linked to dial.o. Thus the definitions in dial.c
+can be dropped.
+
+This fixes linking with gcc 10 which uses -fno-common by default,
+disallowing multiple global variable definitions.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/dial.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/dial.c b/src/dial.c
+index eada5ee..d9d481f 100644
+--- a/src/dial.c
++++ b/src/dial.c
+@@ -146,8 +146,6 @@ static int newtype;
+ /* Access to ".dialdir" denied? */
+ static int dendd = 0;
+ static char *tagged;
+-char *dial_user;
+-char *dial_pass;
+ 
+ /* Change the baud rate.  Treat all characters in the given array as if
+  * they were key presses within the comm parameters dialog (C-A P) and
+-- 
+2.24.1
+
meta/recipes-extended/minicom/minicom/0002-Drop-superfluous-global-variable-definitions.patch new file +37 -0
new file mode 100644
index 0000000000..1740051e0a
@@ -0,0 +1,37 @@
+From 924bd2da3a00e030e29d82b74ef82900bd50b475 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <[email protected]>
+Date: Mon, 3 Feb 2020 13:18:33 +0100
+Subject: [PATCH 2/3] Drop superfluous global variable definitions
+
+The only place where the EXTERN macro mechanism is used to define the
+global variables 'vt_outmap' and 'vt_inmap' is minicom.c (by defining
+an empty EXTERN macro and including the minicom.h header). The file
+vt100.c already defines these variables. The vt100.o object file is
+always linked to minicom.o. Thus it is safe not to define the
+variables in minicom.c and only declare them in the minicom.h header.
+
+This fixes linking with gcc 10 which uses -fno-common by default,
+disallowing multiple global variable definitions.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/minicom.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/minicom.h b/src/minicom.h
+index 061c013..0f9693b 100644
+--- a/src/minicom.h
++++ b/src/minicom.h
+@@ -141,7 +141,7 @@ EXTERN int sbcolor;     /* Status Bar Background Color */
+ EXTERN int st_attr;	/* Status Bar attributes. */
+ 
+ /* jl 04.09.97 conversion tables */
+-EXTERN unsigned char vt_outmap[256], vt_inmap[256];
++extern unsigned char vt_outmap[256], vt_inmap[256];
+ 
+ /* MARK updated 02/17/95 - history buffer */
+ EXTERN int num_hist_lines;  /* History buffer size */
+-- 
+2.24.1
+
meta/recipes-extended/minicom/minicom/0003-Drop-superfluous-global-variable-definitions.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-extended/minicom/minicom_2.7.1.bb +3 -0
index 1e6f1317eb..03034864c8 100644
@@ -11,6 +11,9 @@ SRC_URI = "${DEBIAN_MIRROR}/main/m/${BPN}/${BPN}_${PV}.orig.tar.gz \
            file://allow.to.disable.lockdev.patch \
            file://0001-fix-minicom-h-v-return-value-is-not-0.patch \
            file://0001-Fix-build-issus-surfaced-due-to-musl.patch \
+           file://0001-Drop-superfluous-global-variable-definitions.patch \
+           file://0002-Drop-superfluous-global-variable-definitions.patch \
+           file://0003-Drop-superfluous-global-variable-definitions.patch \
           "
 
 SRC_URI[md5sum] = "9021cb8c5445f6e6e74b2acc39962d62"
Signature · 1 line
2.28.0