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