git: 4ae8ff941b29 - main - lang/perl5*: work around duplicate symbol errors with lld 15 and dtrace enabled

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 19 Sep 2022 18:58:04 UTC
The branch main has been updated by dim (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=4ae8ff941b29191641e22a06e39ea27aa38c7848

commit 4ae8ff941b29191641e22a06e39ea27aa38c7848
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-09-19 18:54:14 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-09-19 18:54:14 +0000

    lang/perl5*: work around duplicate symbol errors with lld 15 and dtrace enabled
    
    Building any of the lang/perl5* ports with clang and lld 15, and the
    DTRACE option enabled (which is default on) results in link errors
    similar to:
    
        cc -pthread -Wl,-E  -fstack-protector-strong -L/usr/local/lib -o miniperl  mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/universalmini.o mpdtrace/gv.o mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o mpdtrace/reentr.o mpdtrace/mro_core.o mpdtrace/keywords.o mpdtrace/builtin.o mpdtrace/hv.o mpdtrace/av.o mpdtrace/run.o mpdtrace/pp_hot.o mpdtrace/sv.o mpdtrace/pp.o mpdtrace/scope.o mpdtrace/pp_ctl.o mpdtrace/pp_sys.o mpdtrace/doop.o mpdtrace/doio.o mpdtrace/regexec.o mpdtrace/utf8.o mpdtrace/taint.o mpdtrace/deb.o mpdtrace/globals.o mpdtrace/perlio.o mpdtrace/numeric.o mpdtrace/mathoms.o mpdtrace/locale.o mpdtrace/pp_pack.o mpdtrace/pp_sort.o mpdtrace/caretx.o mpdtrace/dquote.o mpdtrace/time64.o mpdtrace/miniperlmain.o dtrace_mini.o -lpthread -lm -lcrypt -lutil
        ld: error: duplicate symbol: __dtraceenabled_perl___sub__entry
        >>> defined in mpdtrace/pp_hot.o
        >>> defined in mpdtrace/pp_sort.o
    
        ld: error: duplicate symbol: __dtraceenabled_perl___sub__entry
        >>> defined in mpdtrace/pp_hot.o
        >>> defined in mpdtrace/regexec.o
    
        ld: error: duplicate symbol: __dtraceenabled_perl___op__entry
        >>> defined in mpdtrace/perlmini.o
        >>> defined in mpdtrace/run.o
    
        ld: error: duplicate symbol: __dtraceenabled_perl___op__entry
        >>> defined in mpdtrace/perlmini.o
        >>> defined in mpdtrace/dump.o
    
        ld: error: duplicate symbol: __dtraceenabled_perl___sub__entry
        >>> defined in mpdtrace/pp_hot.o
        >>> defined in mpdtrace/pp_ctl.o
        cc: error: linker command failed with exit code 1 (use -v to see invocation)
    
    Work around these errors by allowing multiple definitions during
    linking, using the --allow-multiple-definition linker flag. (Note: this
    flag is also supported by GNU ld.)
    
    PR:             265516
    Approved by:    maintainer timeout (1 month)
    MFH:            2022Q3
---
 lang/perl5-devel/Makefile                     |  2 +-
 lang/perl5-devel/files/patch-hints_freebsd.sh | 13 ++++++++++++-
 lang/perl5.32/Makefile                        |  2 +-
 lang/perl5.32/files/patch-hints_freebsd.sh    | 13 ++++++++++++-
 lang/perl5.34/Makefile                        |  2 +-
 lang/perl5.34/files/patch-hints_freebsd.sh    | 13 ++++++++++++-
 lang/perl5.36/Makefile                        |  2 +-
 lang/perl5.36/files/patch-hints_freebsd.sh    | 13 ++++++++++++-
 8 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/lang/perl5-devel/Makefile b/lang/perl5-devel/Makefile
index da16b99f4431..e8a750695e78 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=	0
+PORTREVISION=	1
 CATEGORIES=	lang devel perl5
 # XXX Leave only CPAN.
 MASTER_SITES=	LOCAL/mat/perl \
diff --git a/lang/perl5-devel/files/patch-hints_freebsd.sh b/lang/perl5-devel/files/patch-hints_freebsd.sh
index efcbcfea109d..359ca12088c1 100644
--- a/lang/perl5-devel/files/patch-hints_freebsd.sh
+++ b/lang/perl5-devel/files/patch-hints_freebsd.sh
@@ -1,6 +1,6 @@
 Remove libs that are not here on FreeBSD.
 
---- hints/freebsd.sh.orig	2016-12-05 10:28:13 UTC
+--- hints/freebsd.sh.orig	2022-06-19 19:29:35 UTC
 +++ hints/freebsd.sh
 @@ -88,6 +88,8 @@ case "$osvers" in
  	esac
@@ -22,3 +22,14 @@ 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 d83f6b8d86ad..fb99eef6dae8 100644
--- a/lang/perl5.32/Makefile
+++ b/lang/perl5.32/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.32/files/patch-hints_freebsd.sh b/lang/perl5.32/files/patch-hints_freebsd.sh
index efcbcfea109d..735ec399fc3d 100644
--- a/lang/perl5.32/files/patch-hints_freebsd.sh
+++ b/lang/perl5.32/files/patch-hints_freebsd.sh
@@ -1,6 +1,6 @@
 Remove libs that are not here on FreeBSD.
 
---- hints/freebsd.sh.orig	2016-12-05 10:28:13 UTC
+--- hints/freebsd.sh.orig	2020-12-18 09:58:48 UTC
 +++ hints/freebsd.sh
 @@ -88,6 +88,8 @@ case "$osvers" in
  	esac
@@ -22,3 +22,14 @@ 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 cfd72badd293..69537f04f532 100644
--- a/lang/perl5.34/Makefile
+++ b/lang/perl5.34/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	perl
 DISTVERSION=	${PERL_VERSION}
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	lang devel perl5
 MASTER_SITES=	CPAN/../../src/5.0
 DIST_SUBDIR=	perl
diff --git a/lang/perl5.34/files/patch-hints_freebsd.sh b/lang/perl5.34/files/patch-hints_freebsd.sh
index efcbcfea109d..5709b2f3358d 100644
--- a/lang/perl5.34/files/patch-hints_freebsd.sh
+++ b/lang/perl5.34/files/patch-hints_freebsd.sh
@@ -1,6 +1,6 @@
 Remove libs that are not here on FreeBSD.
 
---- hints/freebsd.sh.orig	2016-12-05 10:28:13 UTC
+--- hints/freebsd.sh.orig	2022-02-19 12:15:55 UTC
 +++ hints/freebsd.sh
 @@ -88,6 +88,8 @@ case "$osvers" in
  	esac
@@ -22,3 +22,14 @@ 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 37b04294c175..eacaa878d387 100644
--- a/lang/perl5.36/Makefile
+++ b/lang/perl5.36/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	perl
 DISTVERSION=	${PERL_VERSION}
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	lang devel perl5
 MASTER_SITES=	CPAN/../../src/5.0
 DIST_SUBDIR=	perl
diff --git a/lang/perl5.36/files/patch-hints_freebsd.sh b/lang/perl5.36/files/patch-hints_freebsd.sh
index efcbcfea109d..8401474feca7 100644
--- a/lang/perl5.36/files/patch-hints_freebsd.sh
+++ b/lang/perl5.36/files/patch-hints_freebsd.sh
@@ -1,6 +1,6 @@
 Remove libs that are not here on FreeBSD.
 
---- hints/freebsd.sh.orig	2016-12-05 10:28:13 UTC
+--- hints/freebsd.sh.orig	2020-12-28 16:57:44 UTC
 +++ hints/freebsd.sh
 @@ -88,6 +88,8 @@ case "$osvers" in
  	esac
@@ -22,3 +22,14 @@ 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