Change 19150 by [EMAIL PROTECTED] on 2003/04/05 21:10:00
Subject: LD_PRELOAD hack, still badly flawed / a solution
From: Enache Adrian <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2003 15:50:48 +0300
Message-ID: <[EMAIL PROTECTED]>
On linux, when building a shared library, generate
a small shell wrapper, "preload", that preloads libperl.so
only if it exists. Useful when the 'make' process stops
before the link phase.
Affected files ...
... //depot/perl/Makefile.SH#265 edit
Differences ...
==== //depot/perl/Makefile.SH#265 (text) ====
Index: perl/Makefile.SH
--- perl/Makefile.SH#264~19120~ Tue Apr 1 08:32:03 2003
+++ perl/Makefile.SH Sat Apr 5 13:10:00 2003
@@ -96,26 +96,32 @@
ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
;;
esac
- ;;
-*) pldlflags=''
- static_target='static'
- ;;
-esac
-case "$ldlibpth" in
-# Protect any spaces
-*" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
-esac
+ case "$ldlibpth" in
+ # Protect any spaces
+ *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
+ esac
-case "$osname" in
-linux)
- case "$useshrplib" in
- true)
- ldlibpth="LD_PRELOAD=\"\$\$LD_PRELOAD `pwd`/$libperl\" $ldlibpth"
- ;;
+ case "$osname" in
+ linux)
+ cat <<-'EOT' >| preload
+ #! /bin/sh
+ lib=$1
+ shift
+ test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
+ exec "$@"
+ EOT
+ chmod 755 preload
+ ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
+ ;;
+ os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
+ ;;
esac
+
;;
-os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
+
+*) pldlflags=''
+ static_target='static'
;;
esac
@@ -944,6 +950,7 @@
rm -f lib/.exists lib/*/.exists lib/*/*/.exists
rm -f h2ph.man pstruct
rm -rf .config
+ rm -f preload
rm -f testcompile compilelog
-rmdir lib/B lib/Data lib/Digest
rm -rf lib/Encode
End of Patch.