From: Gisle Aas Date: Mon, 20 Mar 2006 10:21:50 +0000 (+0000) Subject: Move DynaLoader.o into libperl.so. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=908fcb8bef8cbab8cfe098520d89599eb7d1a16c;p=p5sagit%2Fp5-mst-13.2.git Move DynaLoader.o into libperl.so. This avoids the need to statically link DynaLoader into the stub perl executable and make libperl.so provide all the code needed to get a functional embedded perl interpreter up running. As a side effect this also moves DynaLoader into libperl.a for non-useshrplib builds. Fixes [perl #32539] p4raw-id: //depot/perl@27549 --- diff --git a/Makefile.SH b/Makefile.SH index 6f99951..f61d0db 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -237,7 +237,7 @@ dynamic_ext = $dynamic_list static_ext = $static_list nonxs_ext = $nonxs_list ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext) -DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT) +DYNALOADER = DynaLoader\$(OBJ_EXT) libs = $perllibs $cryptlib @@ -546,12 +546,12 @@ Makefile: $Makefile_s !GROK!THIS! else $spitshell >>Makefile <<'!NO!SUBS!' -$(LIBPERL): $& $(obj) $(LIBPERLEXPORT) +$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) !NO!SUBS! case "$useshrplib" in true) $spitshell >>Makefile <<'!NO!SUBS!' - $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(libs) + $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) !NO!SUBS! case "$osname" in aix) @@ -566,7 +566,7 @@ $(LIBPERL): $& $(obj) $(LIBPERLEXPORT) *) $spitshell >>Makefile <<'!NO!SUBS!' rm -f $(LIBPERL) - $(AR) rcu $(LIBPERL) $(obj) + $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER) @$(ranlib) $(LIBPERL) !NO!SUBS! ;; @@ -617,19 +617,21 @@ NAMESPACEFLAGS = -force_flat_namespace ;; esac $spitshell >>Makefile <<'!NO!SUBS!' -miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT) +miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT) -@rm -f miniperl.xok $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl \ - miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) + `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \ + miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs) $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '' || $(MAKE) minitest !NO!SUBS! ;; *) $spitshell >>Makefile <<'!NO!SUBS!' -miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT) +miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT) -@rm -f miniperl.xok $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl \ - miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) + `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \ + miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs) $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '' || $(MAKE) minitest !NO!SUBS! ;; @@ -637,20 +639,20 @@ miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT) $spitshell >>Makefile <<'!NO!SUBS!' -perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) +perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) -@rm -f miniperl.xok - $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) # Purify/Quantify Perls. -pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) +pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) + $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) -purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) +purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) + $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) -quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) +quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) + $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) # Valgrind perl (currently Linux only) @@ -747,8 +749,8 @@ microperl: # checks as well as the special code to validate that the script in question # has been invoked correctly. -suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) +suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) + $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) !NO!SUBS! diff --git a/ext/DynaLoader/Makefile.PL b/ext/DynaLoader/Makefile.PL index 30853c6..f76994e 100644 --- a/ext/DynaLoader/Makefile.PL +++ b/ext/DynaLoader/Makefile.PL @@ -32,3 +32,10 @@ test-xs: '; } +sub MY::static { + ' +static :: $(FIRST_MAKEFILE) $(OBJECT) + $(RM_RF) $(PERL_SRC)/$(OBJECT) + $(CP) $(OBJECT) $(PERL_SRC)/$(OBJECT) +'; +} diff --git a/ext/util/make_ext b/ext/util/make_ext index 30d007c..d90b057 100644 --- a/ext/util/make_ext +++ b/ext/util/make_ext @@ -65,6 +65,7 @@ ext*) # Remove ext/ prefix and /pm_to_blib suffix pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/pm_to_blib$::' ` ;; *::*) # Convert :: to / pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;; +*.o) pname=`echo "$extspec" | sed -e 's/\.o//'` ;; *) pname="$extspec" ;; esac # echo "Converted $extspec to $pname" diff --git a/writemain.SH b/writemain.SH index 0b5bd07..400329f 100644 --- a/writemain.SH +++ b/writemain.SH @@ -39,8 +39,8 @@ args='' : Remove any .a suffixes and any leading path components for file in $orig ; do case "$file" in - *.a) file=`echo $file | sed 's/\.a//g'` - ;; + *.a) file=`echo $file | sed 's/\.a//g'`;; + *.o) file=`echo $file | sed 's/\.o//g'`;; esac case "$file" in ext/*) file=`echo $file | sed 's:ext/\(.*\)/[^/]*:\1:'`