1From b7dd97708b9d0ed09d8d7ac435f8b25eadbf6487 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Petr=20P=C3=83=C2=ADsa=C3=85=E2=84=A2?= <address@hidden>
3Date: Thu, 13 Aug 2020 11:20:38 -0700
4Subject: [PATCH 1/2] Fix building with GCC 10
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9GCC 10 defaults to -fno-common that results into errors on multiple
10global variable definitions:
11
12/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
13shar-opts.o:(.data.rel.ro.local+0x0): multiple definition of
14`program_name'; shar.o:(.rodata+0x10): first defined here
15
16This patch fixes it by changing the definitions in header files into extern
17declarations.
18
19<https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/msg00001.html>
20
21Signed-off-by: Petr Písař <address@hidden>
22Signed-off-by: Khem Raj <raj.khem@gmail.com>
23---
24Upstream-Status: Pending
25
26 src/shar-opts.h     | 2 +-
27 src/shar-std.def    | 2 +-
28 src/unshar-opts.h   | 2 +-
29 src/uudecode-opts.h | 2 +-
30 src/uuencode-opts.h | 2 +-
31 5 files changed, 5 insertions(+), 5 deletions(-)
32
33diff --git a/src/shar-opts.h b/src/shar-opts.h
34index 172676f..f6e4e79 100644
35--- a/src/shar-opts.h
36+++ b/src/shar-opts.h
37@@ -352,7 +352,7 @@ extern "C" {
38  *  global exported definitions
39  */
40 #include "local.h"
41-char const * const program_name;
42+extern char const * const program_name;
43
44 extern bool initialization_done;
45 extern int optidx;
46diff --git a/src/shar-std.def b/src/shar-std.def
47index ed06b77..a28f61c 100644
48--- a/src/shar-std.def
49+++ b/src/shar-std.def
50@@ -41,7 +41,7 @@ no-misuse-usage;
51 usage-message;
52 die-code;
53
54-export  = '#include "local.h"'"\nchar const * const program_name;";
55+export  = '#include "local.h"'"\nextern char const * const program_name;";
56
57 #shell
58 echo "include = 'char const * const program_name = \"${progname}\";';"
59diff --git a/src/unshar-opts.h b/src/unshar-opts.h
60index 568ffca..aa85833 100644
61--- a/src/unshar-opts.h
62+++ b/src/unshar-opts.h
63@@ -192,7 +192,7 @@ extern "C" {
64 extern size_t       separator_str_len;
65
66 #include "local.h"
67-char const * const program_name;
68+extern char const * const program_name;
69
70
71 /* * * * * *
72diff --git a/src/uudecode-opts.h b/src/uudecode-opts.h
73index 5b74419..289a366 100644
74--- a/src/uudecode-opts.h
75+++ b/src/uudecode-opts.h
76@@ -170,7 +170,7 @@ extern "C" {
77  *  global exported definitions
78  */
79 #include "local.h"
80-char const * const program_name;
81+extern char const * const program_name;
82
83
84 /* * * * * *
85diff --git a/src/uuencode-opts.h b/src/uuencode-opts.h
86index 1a5b7bc..f2df0a8 100644
87--- a/src/uuencode-opts.h
88+++ b/src/uuencode-opts.h
89@@ -166,7 +166,7 @@ extern "C" {
90  *  global exported definitions
91  */
92 #include "local.h"
93-char const * const program_name;
94+extern char const * const program_name;
95
96
97 /* * * * * *
98--
992.28.0
100
101