Fix building with GCC 10

This commit is contained in:
shixuantong 2021-07-31 16:50:22 +08:00
parent 162e44f625
commit 82ce75b68c
2 changed files with 101 additions and 1 deletions

View File

@ -0,0 +1,96 @@
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <address@hidden>
Date: Thu, 23 Jan 2020 15:42:41 +0100
Subject: [PATCH 1/2] Fix building with GCC 10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC 10 defaults to -fno-common that results into errors on multiple
global variable definitions:
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
shar-opts.o:(.data.rel.ro.local+0x0): multiple definition of
`program_name'; shar.o:(.rodata+0x10): first defined here
This patch fixes it by changing the definitions in header files into extern
declarations.
<https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/msg00001.html>
Signed-off-by: Petr Písař <address@hidden>
---
src/shar-opts.h | 2 +-
src/shar-std.def | 2 +-
src/unshar-opts.h | 2 +-
src/uudecode-opts.h | 2 +-
src/uuencode-opts.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/shar-opts.h b/src/shar-opts.h
index 75dcae2..5055d1c 100644
--- a/src/shar-opts.h
+++ b/src/shar-opts.h
@@ -352,7 +352,7 @@ extern "C" {
* global exported definitions
*/
#include "local.h"
-char const * const program_name;
+extern char const * const program_name;
extern bool initialization_done;
extern int optidx;
diff --git a/src/shar-std.def b/src/shar-std.def
index ed06b77..a28f61c 100644
--- a/src/shar-std.def
+++ b/src/shar-std.def
@@ -41,7 +41,7 @@ no-misuse-usage;
usage-message;
die-code;
-export = '#include "local.h"'"\nchar const * const program_name;";
+export = '#include "local.h"'"\nextern char const * const program_name;";
#shell
echo "include = 'char const * const program_name = \"${progname}\";';"
diff --git a/src/unshar-opts.h b/src/unshar-opts.h
index 2c3febe..9ebe2fc 100644
--- a/src/unshar-opts.h
+++ b/src/unshar-opts.h
@@ -192,7 +192,7 @@ extern "C" {
extern size_t separator_str_len;
#include "local.h"
-char const * const program_name;
+extern char const * const program_name;
/* * * * * *
diff --git a/src/uudecode-opts.h b/src/uudecode-opts.h
index 29b3b5c..5494289 100644
--- a/src/uudecode-opts.h
+++ b/src/uudecode-opts.h
@@ -170,7 +170,7 @@ extern "C" {
* global exported definitions
*/
#include "local.h"
-char const * const program_name;
+extern char const * const program_name;
/* * * * * *
diff --git a/src/uuencode-opts.h b/src/uuencode-opts.h
index e71c9b8..d6ec03e 100644
--- a/src/uuencode-opts.h
+++ b/src/uuencode-opts.h
@@ -166,7 +166,7 @@ extern "C" {
* global exported definitions
*/
#include "local.h"
-char const * const program_name;
+extern char const * const program_name;
/* * * * * *
--
2.21.1

View File

@ -1,6 +1,6 @@
Name: sharutils
Version: 4.15.2
Release: 15
Release: 16
Summary: The set of GNU shar utilities
License: GPLv3+ and (GPLv3+ and BSD) and (LGPLv3+ or BSD) and LGPLv2+ and Public Domain and GFDL
URL: http://www.gnu.org/software/%{name}/
@ -10,6 +10,7 @@ Source1: LicenseList
Patch0: %{name}-4.14.2-Pass-compilation-with-Werror-format-security.patch
Patch1: %{name}-4.15.2-Fix-a-heap-buffer-overflow-in-find_archive.patch
Patch2: %{name}-4.15.2-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
Patch6000: backport-Fix-building-with-GCC-10.patch
BuildRequires: binutils coreutils gcc gettext glibc-common make sed diffutils
Provides: bundled(gnulib)
@ -65,6 +66,9 @@ make check
%{_mandir}/man*
%changelog
* Sat Jul 31 2021 shixuantong <shixuantong@huawei.com> - 4.15.2-16
- Fix building with GCC 10
* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 4.15.2-15
- Package init