!96 [sync] PR-95: 解决执行“ldd -r re.so”命令有大量的“undefined symbol”报错问题

From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
This commit is contained in:
openeuler-ci-bot 2023-09-12 05:55:37 +00:00 committed by Gitee
commit bb3d3ef271
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,73 @@
diff -aurpN a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm 2023-09-08 16:58:12.482566546 +0800
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm 2023-09-08 17:02:56.171807359 +0800
@@ -31,6 +31,7 @@ BEGIN {
$Is{IRIX} = $^O eq 'irix';
$Is{NetBSD} = $^O eq 'netbsd';
$Is{Interix} = $^O eq 'interix';
+ $Is{Linux} = $^O eq 'linux';
$Is{SunOS4} = $^O eq 'sunos';
$Is{Solaris} = $^O eq 'solaris';
$Is{SunOS} = $Is{SunOS4} || $Is{Solaris};
@@ -1060,7 +1061,7 @@ sub xs_make_dynamic_lib {
push(@m," \$(RM_F) \$\@\n");
my $libs = '$(LDLOADLIBS)';
- if (($Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') {
+ if (($Is{Linux} || $Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') {
# Use nothing on static perl platforms, and to the flags needed
# to link against the shared libperl library on shared perl
# platforms. We peek at lddlflags to see if we need -Wl,-R
@@ -1073,6 +1074,11 @@ sub xs_make_dynamic_lib {
# The Android linker will not recognize symbols from
# libperl unless the module explicitly depends on it.
$libs .= ' "-L$(PERL_INC)" -lperl';
+ } else {
+ if ($ENV{PERL_CORE}) {
+ $libs .= ' "-L$(PERL_INC)"';
+ }
+ $libs .= ' -lperl';
}
}
diff -aurpN a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm 1970-01-01 08:00:00.000000000 +0800
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm 2023-09-08 17:09:16.773017629 +0800
@@ -0,0 +1,26 @@
+package ExtUtils::CBuilder::Platform::linux;
+
+use strict;
+use ExtUtils::CBuilder::Platform::Unix;
+use File::Spec;
+
+use vars qw($VERSION @ISA);
+$VERSION = '0.280236';
+our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
+
+sub link {
+ my ($self, %args) = @_;
+ my $cf = $self->{config};
+
+ # Link XS modules to libperl.so explicitly because multiple
+ # dlopen(, RTLD_LOCAL) hides libperl symbols from XS module.
+ local $cf->{lddlflags} = $cf->{lddlflags};
+ if ($ENV{PERL_CORE}) {
+ $cf->{lddlflags} .= ' -L' . $self->perl_inc();
+ }
+ $cf->{lddlflags} .= ' -lperl';
+
+ return $self->SUPER::link(%args);
+}
+
+1;
diff -aurpN a/MANIFEST b/MANIFEST
--- a/MANIFEST 2023-09-08 16:59:28.747862538 +0800
+++ b/MANIFEST 2023-09-08 17:00:43.036559444 +0800
@@ -3535,6 +3535,7 @@ dist/ExtUtils-CBuilder/lib/ExtUtils/CBui
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm CBuilder methods for cygwin
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm CBuilder methods for darwin
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm CBuilder methods for OSF
+dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm CBuilder methods for Linux
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm CBuilder methods for OS/2
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm CBuilder methods for Unix
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm CBuilder methods for VMS

View File

@ -22,7 +22,7 @@ Name: perl
License: (GPL+ or Artistic) and (GPLv2+ or Artistic) and MIT and UCD and Public Domain and BSD
Epoch: 4
Version: %{perl_version}
Release: 9
Release: 10
Summary: A highly capable, feature-rich programming language
Url: https://www.perl.org/
Source0: https://www.cpan.org/src/5.0/%{name}-%{version}.tar.xz
@ -35,6 +35,7 @@ Patch5: perl-5.35.1-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch
Patch6: perl-5.35.1-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch
Patch7: change-lib-to-lib64.patch
Patch8: disable-rpath-by-default.patch
Patch9: perl-5.34.0-Link-XS-modules-to-libperl.so-with-EU-MM-on-Linux.patch
Patch6000: backport-CVE-2021-36770.patch
Patch6001: backport-CVE-2023-31484.patch
@ -490,6 +491,12 @@ make test_harness
%{_mandir}/man3/*
%changelog
* Fri Sep 8 2023 zhangzikang <zhangzikang@kylinos.cn> - 4:5.34.0-10
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix-perl-re.so-undefined-symbol-error
* Fri Aug 25 2023 yangmingtai <yangmingtai@huawei.com> - 4:5.34.0-9
- fix CVE-2022-48522