git: 8c69fc20e6c7 - main - lang/perl5*: alternative workaround for lld 15 and dtrace enabled

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 20:27:21 UTC
The branch main has been updated by dim (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=8c69fc20e6c71c3c5e71c8c9fcfb08ea9d5eb48d

commit 8c69fc20e6c71c3c5e71c8c9fcfb08ea9d5eb48d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-09-21 20:24:33 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-09-21 20:26:53 +0000

    lang/perl5*: alternative workaround for lld 15 and dtrace enabled
    
    Modify the workaround committed in 4ae8ff941b29 by only adding
    -Wl,--allow-multiple-definition to the two link command lines that
    require it, instead of adding it to hints/freebsd.sh
    
    Otherwise, that linker flag is emitted into perl's global configuration
    (/usr/local/lib/perl5/5.xx/mach/Config_heavy.pl), and might be used by
    other ports which link in libperl, such as www/mod_perl2, which cannot
    correctly handle any unexpected linker flags, leading to errors.
    
    PR:             265516
    Reported by:    lev
    Approved by:    maintainer timeout (1 month)
    Fixes:          4ae8ff941b29
    MFH:            2022Q3
---
 lang/perl5-devel/Makefile                     |  2 +-
 lang/perl5-devel/files/patch-Makefile.SH      | 22 ++++++++++++++++++++--
 lang/perl5-devel/files/patch-hints_freebsd.sh | 11 -----------
 lang/perl5.32/Makefile                        |  2 +-
 lang/perl5.32/files/patch-Makefile.SH         | 22 ++++++++++++++++++++--
 lang/perl5.32/files/patch-hints_freebsd.sh    | 11 -----------
 lang/perl5.34/Makefile                        |  2 +-
 lang/perl5.34/files/patch-Makefile.SH         | 22 ++++++++++++++++++++--
 lang/perl5.34/files/patch-hints_freebsd.sh    | 11 -----------
 lang/perl5.36/Makefile                        |  2 +-
 lang/perl5.36/files/patch-Makefile.SH         | 22 ++++++++++++++++++++--
 lang/perl5.36/files/patch-hints_freebsd.sh    | 11 -----------
 12 files changed, 84 insertions(+), 56 deletions(-)

diff --git a/lang/perl5-devel/Makefile b/lang/perl5-devel/Makefile
index e8a750695e78..b5327135ea98 100644
--- a/lang/perl5-devel/Makefile
+++ b/lang/perl5-devel/Makefile
@@ -4,7 +4,7 @@ PORTNAME=	perl
 DISTVERSIONPREFIX=	v
 DISTVERSION=	${GH_TAGNAME:C/^v//:C/-g[0-9a-f]*$//}
 DISTVERSIONSUFFIX=	${GH_TAGNAME:C/.*-g/-g/}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	lang devel perl5
 # XXX Leave only CPAN.
 MASTER_SITES=	LOCAL/mat/perl \
diff --git a/lang/perl5-devel/files/patch-Makefile.SH b/lang/perl5-devel/files/patch-Makefile.SH
index c65b5dfc7a30..b2a2691d922c 100644
--- a/lang/perl5-devel/files/patch-Makefile.SH
+++ b/lang/perl5-devel/files/patch-Makefile.SH
@@ -1,8 +1,8 @@
 Allow customisation of shrpldflags.
 
---- Makefile.SH.orig	2015-09-08 05:21:36 UTC
+--- Makefile.SH.orig	2022-06-19 19:29:35 UTC
 +++ Makefile.SH
-@@ -40,7 +40,6 @@ esac
+@@ -40,7 +40,6 @@ linklibperl_nonshr=''
  pwd="`pwd`"
  linklibperl='$(LIBPERL)'
  linklibperl_nonshr=''
@@ -10,3 +10,21 @@ Allow customisation of shrpldflags.
  ldlibpth=''
  DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
  DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
+@@ -924,7 +923,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLE
+ 	true)
+ 		$spitshell >>$Makefile <<'!NO!SUBS!'
+ 	rm -f $@
+-	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
++	$(LD) -o $@ $(SHRPLDFLAGS) -Wl,--allow-multiple-definition $(perllib_objs) $(DYNALOADER) $(libs)
+ !NO!SUBS!
+ 		case "$osname" in
+ 		aix)
+@@ -1015,7 +1014,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildc
+ 			$spitshell >>$Makefile <<'!NO!SUBS!'
+ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
+ 	-@rm -f miniperl.xok
+-	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
++	$(CC) $(CLDFLAGS) -Wl,--allow-multiple-definition -o $(MINIPERL_EXE) \
+ 	    $(miniperl_objs) $(libs)
+ 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+ 	$(MINIPERL) -f write_buildcustomize.pl
diff --git a/lang/perl5-devel/files/patch-hints_freebsd.sh b/lang/perl5-devel/files/patch-hints_freebsd.sh
index 359ca12088c1..9907c745ded7 100644
--- a/lang/perl5-devel/files/patch-hints_freebsd.sh
+++ b/lang/perl5-devel/files/patch-hints_freebsd.sh
@@ -22,14 +22,3 @@ Remove libs that are not here on FreeBSD.
  	;;
  esac
  
-@@ -142,8 +148,8 @@ case "$osvers" in
- *)
-        libpth="/usr/lib /usr/local/lib"
-        glibpth="/usr/lib /usr/local/lib"
--       ldflags="-Wl,-E "
--        lddlflags="-shared "
-+       ldflags="-Wl,-E,--allow-multiple-definition"
-+        lddlflags="-shared -Wl,--allow-multiple-definition"
-         cccdlflags='-DPIC -fPIC'
-        ;;
- esac
diff --git a/lang/perl5.32/Makefile b/lang/perl5.32/Makefile
index fb99eef6dae8..ab326d878717 100644
--- a/lang/perl5.32/Makefile
+++ b/lang/perl5.32/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	perl
 DISTVERSION=	${PERL_VERSION}
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	lang devel perl5
 MASTER_SITES=	CPAN/../../src/5.0
 DIST_SUBDIR=	perl
diff --git a/lang/perl5.32/files/patch-Makefile.SH b/lang/perl5.32/files/patch-Makefile.SH
index c65b5dfc7a30..d832116aa1fb 100644
--- a/lang/perl5.32/files/patch-Makefile.SH
+++ b/lang/perl5.32/files/patch-Makefile.SH
@@ -1,8 +1,8 @@
 Allow customisation of shrpldflags.
 
---- Makefile.SH.orig	2015-09-08 05:21:36 UTC
+--- Makefile.SH.orig	2020-12-18 12:43:54 UTC
 +++ Makefile.SH
-@@ -40,7 +40,6 @@ esac
+@@ -40,7 +40,6 @@ linklibperl_nonshr=''
  pwd="`pwd`"
  linklibperl='$(LIBPERL)'
  linklibperl_nonshr=''
@@ -10,3 +10,21 @@ Allow customisation of shrpldflags.
  ldlibpth=''
  DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
  DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
+@@ -932,7 +931,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLE
+ 	true)
+ 		$spitshell >>$Makefile <<'!NO!SUBS!'
+ 	rm -f $@
+-	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
++	$(LD) -o $@ $(SHRPLDFLAGS) -Wl,--allow-multiple-definition $(perllib_objs) $(DYNALOADER) $(libs)
+ !NO!SUBS!
+ 		case "$osname" in
+ 		aix)
+@@ -1038,7 +1037,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildc
+ 			$spitshell >>$Makefile <<'!NO!SUBS!'
+ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
+ 	-@rm -f miniperl.xok
+-	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
++	$(CC) $(CLDFLAGS) -Wl,--allow-multiple-definition -o $(MINIPERL_EXE) \
+ 	    $(miniperl_objs) $(libs)
+ 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+ 	$(MINIPERL) -f write_buildcustomize.pl
diff --git a/lang/perl5.32/files/patch-hints_freebsd.sh b/lang/perl5.32/files/patch-hints_freebsd.sh
index 735ec399fc3d..d8904480b745 100644
--- a/lang/perl5.32/files/patch-hints_freebsd.sh
+++ b/lang/perl5.32/files/patch-hints_freebsd.sh
@@ -22,14 +22,3 @@ Remove libs that are not here on FreeBSD.
  	;;
  esac
  
-@@ -142,8 +148,8 @@ case "$osvers" in
- *)
-        libpth="/usr/lib /usr/local/lib"
-        glibpth="/usr/lib /usr/local/lib"
--       ldflags="-Wl,-E "
--        lddlflags="-shared "
-+       ldflags="-Wl,-E,--allow-multiple-definition"
-+        lddlflags="-shared -Wl,--allow-multiple-definition"
-         cccdlflags='-DPIC -fPIC'
-        ;;
- esac
diff --git a/lang/perl5.34/Makefile b/lang/perl5.34/Makefile
index 69537f04f532..07f18903042c 100644
--- a/lang/perl5.34/Makefile
+++ b/lang/perl5.34/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	perl
 DISTVERSION=	${PERL_VERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	lang devel perl5
 MASTER_SITES=	CPAN/../../src/5.0
 DIST_SUBDIR=	perl
diff --git a/lang/perl5.34/files/patch-Makefile.SH b/lang/perl5.34/files/patch-Makefile.SH
index c65b5dfc7a30..94a9d7fc6812 100644
--- a/lang/perl5.34/files/patch-Makefile.SH
+++ b/lang/perl5.34/files/patch-Makefile.SH
@@ -1,8 +1,8 @@
 Allow customisation of shrpldflags.
 
---- Makefile.SH.orig	2015-09-08 05:21:36 UTC
+--- Makefile.SH.orig	2022-02-26 18:50:37 UTC
 +++ Makefile.SH
-@@ -40,7 +40,6 @@ esac
+@@ -40,7 +40,6 @@ linklibperl_nonshr=''
  pwd="`pwd`"
  linklibperl='$(LIBPERL)'
  linklibperl_nonshr=''
@@ -10,3 +10,21 @@ Allow customisation of shrpldflags.
  ldlibpth=''
  DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
  DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
+@@ -932,7 +931,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLE
+ 	true)
+ 		$spitshell >>$Makefile <<'!NO!SUBS!'
+ 	rm -f $@
+-	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
++	$(LD) -o $@ $(SHRPLDFLAGS) -Wl,--allow-multiple-definition $(perllib_objs) $(DYNALOADER) $(libs)
+ !NO!SUBS!
+ 		case "$osname" in
+ 		aix)
+@@ -1038,7 +1037,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildc
+ 			$spitshell >>$Makefile <<'!NO!SUBS!'
+ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
+ 	-@rm -f miniperl.xok
+-	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
++	$(CC) $(CLDFLAGS) -Wl,--allow-multiple-definition -o $(MINIPERL_EXE) \
+ 	    $(miniperl_objs) $(libs)
+ 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+ 	$(MINIPERL) -f write_buildcustomize.pl
diff --git a/lang/perl5.34/files/patch-hints_freebsd.sh b/lang/perl5.34/files/patch-hints_freebsd.sh
index 5709b2f3358d..4730556d1e89 100644
--- a/lang/perl5.34/files/patch-hints_freebsd.sh
+++ b/lang/perl5.34/files/patch-hints_freebsd.sh
@@ -22,14 +22,3 @@ Remove libs that are not here on FreeBSD.
  	;;
  esac
  
-@@ -142,8 +148,8 @@ case "$osvers" in
- *)
-        libpth="/usr/lib /usr/local/lib"
-        glibpth="/usr/lib /usr/local/lib"
--       ldflags="-Wl,-E "
--        lddlflags="-shared "
-+       ldflags="-Wl,-E,--allow-multiple-definition"
-+        lddlflags="-shared -Wl,--allow-multiple-definition"
-         cccdlflags='-DPIC -fPIC'
-        ;;
- esac
diff --git a/lang/perl5.36/Makefile b/lang/perl5.36/Makefile
index eacaa878d387..7cbaf029ae2c 100644
--- a/lang/perl5.36/Makefile
+++ b/lang/perl5.36/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	perl
 DISTVERSION=	${PERL_VERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	lang devel perl5
 MASTER_SITES=	CPAN/../../src/5.0
 DIST_SUBDIR=	perl
diff --git a/lang/perl5.36/files/patch-Makefile.SH b/lang/perl5.36/files/patch-Makefile.SH
index c65b5dfc7a30..2fd3f4a0b091 100644
--- a/lang/perl5.36/files/patch-Makefile.SH
+++ b/lang/perl5.36/files/patch-Makefile.SH
@@ -1,8 +1,8 @@
 Allow customisation of shrpldflags.
 
---- Makefile.SH.orig	2015-09-08 05:21:36 UTC
+--- Makefile.SH.orig	2022-05-21 21:27:09 UTC
 +++ Makefile.SH
-@@ -40,7 +40,6 @@ esac
+@@ -40,7 +40,6 @@ linklibperl_nonshr=''
  pwd="`pwd`"
  linklibperl='$(LIBPERL)'
  linklibperl_nonshr=''
@@ -10,3 +10,21 @@ Allow customisation of shrpldflags.
  ldlibpth=''
  DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
  DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
+@@ -924,7 +923,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLE
+ 	true)
+ 		$spitshell >>$Makefile <<'!NO!SUBS!'
+ 	rm -f $@
+-	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
++	$(LD) -o $@ $(SHRPLDFLAGS) -Wl,--allow-multiple-definition $(perllib_objs) $(DYNALOADER) $(libs)
+ !NO!SUBS!
+ 		case "$osname" in
+ 		aix)
+@@ -1015,7 +1014,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildc
+ 			$spitshell >>$Makefile <<'!NO!SUBS!'
+ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
+ 	-@rm -f miniperl.xok
+-	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
++	$(CC) $(CLDFLAGS) -Wl,--allow-multiple-definition -o $(MINIPERL_EXE) \
+ 	    $(miniperl_objs) $(libs)
+ 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+ 	$(MINIPERL) -f write_buildcustomize.pl
diff --git a/lang/perl5.36/files/patch-hints_freebsd.sh b/lang/perl5.36/files/patch-hints_freebsd.sh
index 8401474feca7..cf2569284c62 100644
--- a/lang/perl5.36/files/patch-hints_freebsd.sh
+++ b/lang/perl5.36/files/patch-hints_freebsd.sh
@@ -22,14 +22,3 @@ Remove libs that are not here on FreeBSD.
  	;;
  esac
  
-@@ -142,8 +148,8 @@ case "$osvers" in
- *)
-        libpth="/usr/lib /usr/local/lib"
-        glibpth="/usr/lib /usr/local/lib"
--       ldflags="-Wl,-E "
--        lddlflags="-shared "
-+       ldflags="-Wl,-E,--allow-multiple-definition"
-+        lddlflags="-shared -Wl,--allow-multiple-definition"
-         cccdlflags='-DPIC -fPIC'
-        ;;
- esac