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

Darwin perl runs without libc? "@dl_resolve_using =dl_findfile('-lc');"

From:
bulk 88
Date:
October 27, 2015 21:23
Subject:
Darwin perl runs without libc? "@dl_resolve_using =dl_findfile('-lc');"
Message ID:
BAY182-W199D9B10D390207C2B8C56DF220@phx.gbl

http://perl5.git.perl.org/perl.git/blob/c6b7cc2176dc0e9133fd8c3b9505120c31c614b4:/ext/DynaLoader/DynaLoader_pm.PL#l151

    # This is a fix to support DLD's unfortunate desire to relink -lc
    @dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";

http://perl5.git.perl.org/perl.git/blob/c6b7cc2176dc0e9133fd8c3b9505120c31c614b4:/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm#l43

    if ($Config{'dlsrc'} =~ /^dl_dld/){
        package DynaLoader;
        push(@dl_resolve_using, dl_findfile('-lc'));
    }

from
 commit 
http://perl5.git.perl.org/perl.git/commitdiff/a0d0e21ea6ea90a22318550944fe6cb09ae10cda
 "perl 5.000" day 1 of dynaloader and day 1 of predecessor of 
Mkbootstrap.pm

This code is from 1994. I have a plan to remove 
the dependency that building Win32 XS DLLs, atleast in core (make_ext.pl
 run to build XS code), requires that DynaLoader.pm be built and 
loadable by miniperl, before a dynamic XS module can be "make" built 
(this will save atleast 5 seconds wall time on the parallel build). My 
plan is that in Mkbootstrap.pm, if BSLOADLIBS is empty (which is always 
is on Win32, unless you take extreme (unrealistic) measures in your 
Makefile.PL), and there is no Foo_BS file to execute, don't load 
DynaLoader.pm and return early from ExtUtils::Mkbootstrap::Mkbootstrap.

The 
 "@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";" line
 in DynaLoader.pm (which should be compiled out in DynaLoader_pm.PL in 
the first place) needs to go to accomplish that. Does anyone know why 
that line can't be removed from 1994 , and why perl is executing without
 libc in the process? How were ops allocated and how did yy_parse run 
and how was DynaLoader.pm/Mkbootstrap.pm read off a disk without stdio?

I
 will note XSLoader has no such line, and it never loads DynaLoader.pm 
and somehow things magically work (IDK how) (unless every OSX/Darwin XS 
.so has a .bs that loads libc next to it, and XSLoader always goto-es to
 full DynaLoader.pm which sounds unrealistic and somebody wouldve fixed 
that years ago). That is why I think the line is redundant.
 		 	   		  


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