From d10a9280370f80f00bedd664db3e165715bd3441 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Thu, 29 Oct 2020 18:57:28 +0800 Subject: [PATCH] Adapt Configure to GCC version 10 this change has given better compatible with both gcc8 and gcc10 toolchain, should be maintained util upstream fixes Comments from patch file: I got a notice from Jeff Law : Your particular package fails its testsuite. This was ultimately tracked down to a Configure problem. The perl configure script treated gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI changing flag and caused Perl to not be able to interact properly with the dbm libraries on the system leading to a segfault. His proposed patch corrected only this one instance of the version mismatch. Reading the Configure script revealed more issues. This patch fixes all of them I found. Please note I do not have GCC 10 available, I tested it by faking the version. Signed-off-by: Liwei Ge Signed-off-by: wb-lw533035 Signed-off-by: weitao zhou --- 1001-Adapt-Configure-to-GCC-version.patch | 103 ++++++++++++++++++++++ perl.spec | 12 ++- 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 1001-Adapt-Configure-to-GCC-version.patch diff --git a/1001-Adapt-Configure-to-GCC-version.patch b/1001-Adapt-Configure-to-GCC-version.patch new file mode 100644 index 0000000..b42d9f1 --- /dev/null +++ b/1001-Adapt-Configure-to-GCC-version.patch @@ -0,0 +1,103 @@ +From 9f4e6307232229875331a55e44e1245b0b91e219 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 12 Nov 2019 09:19:18 +0100 +Subject: [PATCH] Adapt Configure to GCC version 10 + +I got a notice from Jeff Law : + + Your particular package fails its testsuite. This was ultimately + tracked down to a Configure problem. The perl configure script treated + gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI + changing flag and caused Perl to not be able to interact properly with + the dbm libraries on the system leading to a segfault. + +His proposed patch corrected only this one instance of the version +mismatch. Reading the Configure script revealed more issues. This +patch fixes all of them I found. + +Please note I do not have GCC 10 available, I tested it by faking the version +with: + +--- a/Configure ++++ b/Configure +@@ -4672,7 +4672,7 @@ $cat >try.c <try.c + for incdir in $locincpth; do + warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \ +@@ -5469,13 +5469,13 @@ fi + case "$hint" in + default|recommended) + case "$gccversion" in +- 1*) dflt="$dflt -fpcc-struct-return" ;; ++ 1.*) dflt="$dflt -fpcc-struct-return" ;; + esac + case "$optimize:$DEBUGGING" in + *-g*:old) dflt="$dflt -DDEBUGGING";; + esac + case "$gccversion" in +- 2*) if $test -d /etc/conf/kconfig.d && ++ 2.*) if $test -d /etc/conf/kconfig.d && + $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 + then + # Interactive Systems (ISC) POSIX mode. +@@ -5484,7 +5484,7 @@ default|recommended) + ;; + esac + case "$gccversion" in +- 1*) ;; ++ 1.*) ;; + 2.[0-8]*) ;; + ?*) set strict-aliasing -fno-strict-aliasing + eval $checkccflag +@@ -5602,7 +5602,7 @@ case "$cppflags" in + ;; + esac + case "$gccversion" in +-1*) cppflags="$cppflags -D__GNUC__" ++1.*) cppflags="$cppflags -D__GNUC__" + esac + case "$mips_type" in + '');; +@@ -23229,7 +23229,7 @@ fi + + : add -D_FORTIFY_SOURCE if feasible and not already there + case "$gccversion" in +-[4567].*) case "$optimize$ccflags" in ++[456789].*|[1-9][0-9]*) case "$optimize$ccflags" in + *-O*) case "$ccflags$cppsymbols" in + *_FORTIFY_SOURCE=*) # Don't add it again. + echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4 diff --git a/perl.spec b/perl.spec index 4c0f265..455ccf2 100755 --- a/perl.spec +++ b/perl.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 %global perl_version 5.26.3 %global perl_epoch 4 %global perl_arch_stem -thread-multi @@ -81,7 +82,7 @@ License: GPL+ or Artistic Epoch: %{perl_epoch} Version: %{perl_version} # release number must be even higher, because dual-lived modules will be broken otherwise -Release: 420%{?dist} +Release: 420%{anolis_release}%{?dist} Summary: Practical Extraction and Report Language Url: http://www.perl.org/ Source0: http://www.cpan.org/src/5.0/perl-%{perl_version}.tar.bz2 @@ -318,6 +319,11 @@ Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li # Link XS modules to libperl.so with EU::MM on Linux, bug #960048 Patch201: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-MM-on-Linux.patch +# Begin: Anolis customized patches +# backport patch from upstream +Patch1001: 1001-Adapt-Configure-to-GCC-version.patch +# End: Anolis customized patches + # Update some of the bundled modules # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions @@ -2928,6 +2934,7 @@ Perl extension for Version Objects %patch96 -p1 %patch200 -p1 %patch201 -p1 +%patch1001 -p1 %if !%{defined perl_bootstrap} # Local patch tracking @@ -5275,6 +5282,9 @@ popd # Old changelog entries are preserved in CVS. %changelog +* Thu Jan 20 2022 Weitao Zhou - 4:5.26.3-420.0.1 +- Adapt Configure to GCC version 10 + * Thu Jun 17 2021 Jitka Plesnikova - 4:5.26.3-420 - Fix _resolv return value in Net-Ping (bug #1973030) -- Gitee