develooper Front page | perl.perl5.porters | Postings from December 2015

Unnecessary preload wrapper in Makefile

Thread Next
From:
Hanno Böck
Date:
December 1, 2015 04:22
Subject:
Unnecessary preload wrapper in Makefile
Message ID:
20151201052232.781e1b77@pc1
Hi,

The Makefile.SH in perl contains some code that will in certain
situations create a wrapper script called preload used during
compilation.

I think this is
a) not needed
b) doesn't really work how it's intended
c) can cause problems.


The point of the wrapper seems to be to make sure that during the
compilation perl uses the newly compiled libperl and not a libperl that
might be already installed on the system.
However the Makefile is already setting LD_LIBRARY_PATH, so that should
not happen. The LD_LIBRARY_PATH method is less problematic, as I'll
explain below.


The check whether this preload script gets used looks like this:
	    if test -f $archlib/CORE/$libperl; then
This check will only be true if the paths used in the newly compiled
perl are the same as in the one already on the system. E.g. if there's
a libperl on the system with prefix /usr and the newly compiled perl
has prefix /usr/local the check will fail. It won't matter, because as
explained above the whole thing isn't needed anyway.


Finally why I actually found this and why I think it causes problems: I
tried to compile Perl with Address Sanitizer. This can cause the
compilation to fail if this preload script is created. The reason is
that if you LD_PRELOAD a library that was build with address sanitizer
and then call any executable not built with address sanitizer it will
crash. This caused gcc to crash. This does not happen with the
LD_LIBRARY_PATH, because then only the libraries needed will be
preloaded.

Conclusion: Please just remove this, I don't think it does any good and
it can cause problems. See attached patch.

-- 
Hanno Böck
http://hboeck.de/

mail/jabber: hanno@hboeck.de
GPG: BBB51E42

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About