split out patch adding link to libperl.so into two separated patches

This commit is contained in:
Funda Wang 2025-01-19 19:49:39 +08:00
parent ffb70d00fa
commit 8b4c8dfb4e
7 changed files with 101 additions and 61 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.xz filter=lfs diff=lfs merge=lfs -text

2
.lfsconfig Normal file
View File

@ -0,0 +1,2 @@
[lfs]
url = https://artlfs.openeuler.openatom.cn/src-openEuler/perl

View File

@ -0,0 +1,66 @@
From 5051aebec66aa530a23c7842f5c77606f208134e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jani=20V=C3=A4limaa?= <wally@mageia.org>
Date: Sat, 18 Jan 2025 15:25:52 +0200
Subject: [PATCH] Link XS modules to libperl.so with EU::CBuilder on Linux
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on patch from Petr Písař <ppisar@redhat.com>
Patch is modified to use extra_linker_flags to pass -lperl after object .o files.
In that way -Wl,--as-needed linker flag doesn't strip libperl dependecy.
<https://bugzilla.redhat.com/show_bug.cgi?id=960048>
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327585#50>
---
MANIFEST | 1 +
.../lib/ExtUtils/CBuilder/Platform/linux.pm | 24 +++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
diff --git a/MANIFEST b/MANIFEST
index 2eb9ca4..31bac12 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4104,6 +4104,7 @@ dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm CBuilder method
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
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
new file mode 100644
index 0000000..060515a
--- /dev/null
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
@@ -0,0 +1,24 @@
+package ExtUtils::CBuilder::Platform::linux;
+
+use strict;
+use ExtUtils::CBuilder::Platform::Unix;
+use File::Spec;
+
+use vars qw($VERSION @ISA);
+$VERSION = '0.280206';
+@ISA = qw(ExtUtils::CBuilder::Platform::Unix);
+
+sub link {
+ my ($self, %args) = @_;
+
+ # Link XS modules to libperl.so explicitly because multiple
+ # dlopen(, RTLD_LOCAL) hides libperl symbols from XS module.
+ $args{extra_linker_flags} = [
+ '-lperl',
+ $self->split_like_shell($args{extra_linker_flags})
+ ];
+
+ return $self->SUPER::link(%args);
+}
+
+1;
--
2.47.1

View File

@ -1,32 +1,24 @@
From fbdb9a76798ae34a7b53f664e77aaaf1f4040f2f Mon Sep 17 00:00:00 2001 From fc1f8ac36c34c35bad84fb7b99a26ab83c9ba075 Mon Sep 17 00:00:00 2001
From: zhangzikang <zhangzikang@kylinos.cn> From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 20 Mar 2024 17:44:51 +0800 Date: Wed, 3 Jul 2013 12:59:09 +0200
Subject: [PATCH] perl-5.38.0-Link-XS-modules-to-libperl.so-with-EU-MM-on-Linux Subject: [PATCH] Link XS modules to libperl.so with EU::MM on Linux
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
<https://bugzilla.redhat.com/show_bug.cgi?id=960048>
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327585#50>
Signed-off-by: Petr Písař <ppisar@redhat.com>
--- ---
MANIFEST | 1 + cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 8 +++++++-
.../lib/ExtUtils/MM_Unix.pm | 8 +++++- 1 file changed, 7 insertions(+), 1 deletion(-)
.../lib/ExtUtils/CBuilder/Platform/linux.pm | 26 +++++++++++++++++++
3 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
diff --git a/MANIFEST b/MANIFEST
index 6bc115b..0775b2f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3855,6 +3855,7 @@ dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm CBuilder method
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
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index 1761380..4e82dda 100644 index a8b172f..a3fbce2 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -32,6 +32,7 @@ BEGIN { @@ -30,6 +30,7 @@ BEGIN {
$Is{IRIX} = $^O eq 'irix'; $Is{IRIX} = $^O eq 'irix';
$Is{NetBSD} = $^O eq 'netbsd'; $Is{NetBSD} = $^O eq 'netbsd';
$Is{Interix} = $^O eq 'interix'; $Is{Interix} = $^O eq 'interix';
@ -34,7 +26,7 @@ index 1761380..4e82dda 100644
$Is{SunOS4} = $^O eq 'sunos'; $Is{SunOS4} = $^O eq 'sunos';
$Is{Solaris} = $^O eq 'solaris'; $Is{Solaris} = $^O eq 'solaris';
$Is{SunOS} = $Is{SunOS4} || $Is{Solaris}; $Is{SunOS} = $Is{SunOS4} || $Is{Solaris};
@@ -1074,7 +1075,7 @@ sub xs_make_dynamic_lib { @@ -1028,7 +1029,7 @@ sub xs_make_dynamic_lib {
push(@m," \$(RM_F) \$\@\n"); push(@m," \$(RM_F) \$\@\n");
my $libs = '$(LDLOADLIBS)'; my $libs = '$(LDLOADLIBS)';
@ -43,7 +35,7 @@ index 1761380..4e82dda 100644
# Use nothing on static perl platforms, and to the flags needed # Use nothing on static perl platforms, and to the flags needed
# to link against the shared libperl library on shared perl # to link against the shared libperl library on shared perl
# platforms. We peek at lddlflags to see if we need -Wl,-R # platforms. We peek at lddlflags to see if we need -Wl,-R
@@ -1087,6 +1088,11 @@ sub xs_make_dynamic_lib { @@ -1041,6 +1042,11 @@ sub xs_make_dynamic_lib {
# The Android linker will not recognize symbols from # The Android linker will not recognize symbols from
# libperl unless the module explicitly depends on it. # libperl unless the module explicitly depends on it.
$libs .= ' "-L$(PERL_INC)" -lperl'; $libs .= ' "-L$(PERL_INC)" -lperl';
@ -55,38 +47,6 @@ index 1761380..4e82dda 100644
} }
} }
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
new file mode 100644
index 0000000..582339b
--- /dev/null
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/linux.pm
@@ -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.280230';
+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;
-- --
2.33.0 1.8.1.4

Binary file not shown.

View File

@ -11,6 +11,8 @@
%global __provides_exclude_from ^%{_libexecdir}/perl5-tests/.*$ %global __provides_exclude_from ^%{_libexecdir}/perl5-tests/.*$
%global __requires_exclude_from ^%{_libexecdir}/perl5-tests/.*$ %global __requires_exclude_from ^%{_libexecdir}/perl5-tests/.*$
%global __brp_clean_perl_files %{nil}
#provides module without verion, no need to provide #provides module without verion, no need to provide
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\((charnames|DynaLoader|DB)\\)$ %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\((charnames|DynaLoader|DB)\\)$
@ -24,7 +26,7 @@ Name: perl
License: (GPL-1.0-or-later or Artistic-1.0-perl) and (GPL-2.0-or-later or Artistic-1.0-perl) and MIT and UCD and Public Domain and BSD License: (GPL-1.0-or-later or Artistic-1.0-perl) and (GPL-2.0-or-later or Artistic-1.0-perl) and MIT and UCD and Public Domain and BSD
Epoch: 4 Epoch: 4
Version: %{perl_version} Version: %{perl_version}
Release: 9 Release: 10
Summary: A highly capable, feature-rich programming language Summary: A highly capable, feature-rich programming language
Url: https://www.perl.org/ Url: https://www.perl.org/
Source0: https://www.cpan.org/src/5.0/%{name}-%{version}.tar.xz Source0: https://www.cpan.org/src/5.0/%{name}-%{version}.tar.xz
@ -38,6 +40,9 @@ Patch6: disable-rpath-by-default.patch
Patch7: backport-CVE-2023-47100-CVE-2023-47038.patch Patch7: backport-CVE-2023-47100-CVE-2023-47038.patch
Patch8: backport-CVE-2023-47039.patch Patch8: backport-CVE-2023-47039.patch
Patch9: perl-5.38.0-Link-XS-modules-to-libperl.so-with-EU-MM.patch Patch9: perl-5.38.0-Link-XS-modules-to-libperl.so-with-EU-MM.patch
# Please note that Patch10 comes from mageia, which will put libperl.so into extra_linker_flags.
# So it is different from redhat/fedora, which puts libperl.so into lddlflags
Patch10: perl-5.38.0-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
Patch6000: backport-aarch64-ilp32-support.patch Patch6000: backport-aarch64-ilp32-support.patch
@ -499,6 +504,12 @@ make test_harness
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Fri Jan 03 2025 Funda Wang <fundawang@yeah.net> - 4:5.38.0-10
- split out patch adding link to libperl.so into two separated patches,
and sync it with mageia, which is a better version than fedora
- disable cleaning empty perl directories
- use git lfs storage
* Tue Sep 3 2024 hongjinghao <hongjinghao@huawei.com> - 4:5.38.0-9 * Tue Sep 3 2024 hongjinghao <hongjinghao@huawei.com> - 4:5.38.0-9
- Delete the man of File::Compare and File::Find from the main package. - Delete the man of File::Compare and File::Find from the main package.
@ -536,7 +547,7 @@ make test_harness
* Mon May 15 2023 dongyuzhen <dongyuzhen@h-partners.com> 4:5.34.0-5 * Mon May 15 2023 dongyuzhen <dongyuzhen@h-partners.com> 4:5.34.0-5
- fix CVE-2023-31484 - fix CVE-2023-31484
* Tue Jan 18 2023 <yangmingtai@huawei.com> 4:5.34.0-4 * Wed Jan 18 2023 yangmingtai <yangmingtai@huawei.com> 4:5.34.0-4
- fix compile failed caused by zlib update - fix compile failed caused by zlib update
* Fri Jul 01 2022 dongyuzhen <dongyuzhen@h-partners.com> 4:5.34.0-3 * Fri Jul 01 2022 dongyuzhen <dongyuzhen@h-partners.com> 4:5.34.0-3

View File

@ -1,4 +1,4 @@
version_control: github version_control: github
src_repo: Perl/perl5 src_repo: Perl/perl5
tag_prefix: ^v tag_prefix: ^v
seperator: . separator: .