In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/e6b6bcc7b508f7a44a4976c572fd98a4350bad79?hp=323dbd00f273d31c4a30b1de1a1201aea0f1b778>
- Log ----------------------------------------------------------------- commit e6b6bcc7b508f7a44a4976c572fd98a4350bad79 Merge: 323dbd00f2 f2a60c1f79 Author: Tony Cook <[email protected]> Date: Thu Jan 5 10:39:44 2017 +1100 Various fixes for dtrace builds on FreeBSD and for other platforms (to a lesser extent) commit f2a60c1f79f4336895ffcbe81f18e49b0228ea44 Author: Tony Cook <[email protected]> Date: Mon Nov 28 15:15:18 2016 +1100 (perl #130108) check if dtrace accepts -xnolibs and use it if available dtrace without -xnolibs fails in a FreeBSD jail, so we need to supply it on FreeBSD. Unfortunately systemtap's dtrace emulation doesn't support -xnolibs so we need to test if it's available. M Configure M Makefile.SH M Porting/Glossary commit 728ecd1a39982c980df9493fd4040692b931f2a0 Author: Tony Cook <[email protected]> Date: Mon Nov 28 15:19:12 2016 +1100 (perl #130108) separate compiled objects from dtrace modified objects When generating an object file with "dtrace -G", dtrace also modifies the input object files. This causes two problems: 1) Since the objects are modified, their modification times are updated which may break dependency checks by make. 2) on FreeBSD at least, once the object has been processed it can't be processed again by dtrace -G M Makefile.SH commit c345ac2ecadb636f02f27978602d82bc0dc444e7 Author: Tony Cook <[email protected]> Date: Mon Nov 28 15:22:16 2016 +1100 (perl #130108) add elf to libswanted on FreeBSD 10.x usedtrace builds add references to libelf symbols, causing link failures without it. at hints time we don't know if the user will interactively select dtrace and there's no CBU, so it's added unconditionally on 10.x M hints/freebsd.sh commit 47a83dc69df787f8ede4d6c21526ce623877cd4e Author: Tony Cook <[email protected]> Date: Thu Nov 17 22:18:30 2016 +1100 (perl #130108) generate a dummy dtrace_main.o if perlmain.o doesn't contain probes efc4bddfd4 added generating a probes object file for perlmain.o, since the compiler was generating probes even for unused inline functions. The default compiler on FreeBSD 11 however doesn't generate probes for these unused inline functions, and dtrace -G fails because it can't find any. So if dtrace fails for perlmain.o generate a dummy object file to take its place. Similarly for XS::APItest. M Makefile.SH M ext/XS-APItest/Makefile.PL ----------------------------------------------------------------------- Summary of changes: Configure | 34 +++++++++++++++++++-- Makefile.SH | 76 +++++++++++++++++++++++++++++++++++++++++----- Porting/Glossary | 5 +++ ext/XS-APItest/Makefile.PL | 3 +- hints/freebsd.sh | 8 +++++ 5 files changed, 114 insertions(+), 12 deletions(-) diff --git a/Configure b/Configure index 845fc43d76..9d91a81c4f 100755 --- a/Configure +++ b/Configure @@ -949,6 +949,7 @@ lddlflags='' usedl='' doublesize='' dtraceobject='' +dtracexnolibs='' ebcdic='' fflushNULL='' fflushall='' @@ -20966,12 +20967,38 @@ randseedtype=U32 : object file that uses at least one of the probes defined in the .d file case "$usedtrace" in $define) + case "$dtracexnolibs" in + $define|true|[yY]*) + dtracexnolibs=$define + $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h + ;; + ' '|'') + if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then + dtracexnolibs=$define + echo "Your dtrace accepts -xnolibs" + elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then + dtracexnolibs=$undef + echo "Your dtrace doesn't accept -xnolibs" + else + echo "Your dtrace doesn't work at all, try building without dtrace support" >&4 + exit 1 + fi + ;; + *) + dtracexnolibs=$undef + $dtrace -h -s ../perldtrace.d -o perldtrace.h + ;; + esac + case $dtracexnolibs in + $define) xnolibs=-xnolibs ;; + *) xnolibs= ;; + esac + case "$dtraceobject" in $define|true|[yY]*) dtraceobject=$define ;; ' '|'') - $dtrace -h -s ../perldtrace.d -o perldtrace.h $cat >try.c <<EOM #include "perldtrace.h" int main(void) { @@ -20981,14 +21008,14 @@ int main(void) { EOM dtraceobject=$undef if $cc -c -o try.o $optimize $ccflags try.c \ - && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then + && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then dtraceobject=$define echo "Your dtrace builds an object file" fi - $rm -f try.c try.o perldtrace.o ;; *) dtraceobject=$undef ;; esac + $rm -f try.c try.o perldtrace.o perldtrace.h esac : Determine if this is an EBCDIC system @@ -24954,6 +24981,7 @@ drand01='$drand01' drand48_r_proto='$drand48_r_proto' dtrace='$dtrace' dtraceobject='$dtraceobject' +dtracexnolibs='$dtracexnolibs' dynamic_ext='$dynamic_ext' eagain='$eagain' ebcdic='$ebcdic' diff --git a/Makefile.SH b/Makefile.SH index 6c5ec87c61..1b81e20adc 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -390,8 +390,13 @@ VG_TEST ?= ./perl -e 1 2>/dev/null ;; esac +case "$dtracexnolibs" in +define) xnolibs=-xnolibs ;; +*) xnolibs= ;; +esac + $spitshell >>$Makefile <<!GROK!THIS! -DTRACE = $dtrace +DTRACE = $dtrace $xnolibs DTRACE_H = $dtrace_h DTRACE_PERLLIB_O = $dtrace_perllib_o # "dtrace -G" output for perllib_objs @@ -518,10 +523,52 @@ main_only_objs = op$(OBJ_EXT) perl$(OBJ_EXT) miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT) perllib_objs_nodt = $(main_only_objs) $(common_objs) +!NO!SUBS! + +# dtrace with -G modifies the source object files, which can cause +# dependency issues, and can cause the dtrace -G to fail on FreeBSD +# so separate the objects generated by $(CC) from those used to link +# the executable when dtrace -G is involved. +# +# $(FOO:op%os=np%ns) isn't generally portable but is portable to +# the makes on darwin, Solaris, FreeBSD and Linux, which is where we +# use dtrace + +case "$usedtrace:$dtraceobject" in +define:define) + $spitshell >>$Makefile <<'!NO!SUBS!' + +miniperl_dtrace_objs = $(miniperl_objs_nodt:%=mpdtrace/%) +perllib_dtrace_objs = $(perllib_objs_nodt:%=libpdtrace/%) +perlmain_dtrace_objs = maindtrace/perlmain$(OBJ_EXT) + +miniperl_objs = $(miniperl_dtrace_objs) $(DTRACE_MINI_O) +perllib_objs = $(perllib_dtrace_objs) $(DTRACE_PERLLIB_O) +perlmain_objs = $(perlmain_dtrace_objs) $(DTRACE_MAIN_O) + +miniperl_dep = $(DTRACE_MINI_O) +perllib_dep = $(DTRACE_PERLLIB_O) +perlmain_dep = $(DTRACE_MAIN_O) + +!NO!SUBS! + ;; +*) + $spitshell >>$Makefile <<'!NO!SUBS!' + miniperl_objs = $(miniperl_objs_nodt) $(DTRACE_MINI_O) perllib_objs = $(perllib_objs_nodt) $(DTRACE_PERLLIB_O) perlmain_objs = perlmain$(OBJ_EXT) $(DTRACE_MAIN_O) +miniperl_dep = $(miniperl_objs) +perllib_dep = $(perllib_objs) +perlmain_dep = $(perlmain_objs) + +!NO!SUBS! + ;; +esac + +$spitshell >>$Makefile <<'!NO!SUBS!' + perltoc_pod_prereqs = extra.pods pod/perl5259delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs) generated_headers = uudmap.h bitcount.h mg_data.h @@ -834,19 +881,32 @@ mydtrace.h: $(DTRACE_H) define) $spitshell >>$Makefile <<'!NO!SUBS!' $(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt) - $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_objs_nodt) + -rm -rf mpdtrace + mkdir mpdtrace + cp $(miniperl_objs_nodt) mpdtrace/ + $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_dtrace_objs) $(DTRACE_PERLLIB_O): perldtrace.d $(perllib_objs_nodt) - $(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_objs_nodt) + -rm -rf libpdtrace + mkdir libpdtrace + cp $(perllib_objs_nodt) libpdtrace/ + $(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_dtrace_objs) $(DTRACE_MAIN_O): perldtrace.d perlmain$(OBJ_EXT) - $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) perlmain$(OBJ_EXT) + -rm -rf maindtrace + mkdir maindtrace + cp perlmain$(OBJ_EXT) maindtrace/ + $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) $(perlmain_dtrace_objs) || \ + ( $(ECHO) "No probes in perlmain$(OBJ_EXT), generating a dummy $(DTRACE_MAIN_O)" && \ + $(ECHO) >dtrace_main.c && \ + `$(CCCMD)` $(PLDLFLAGS) dtrace_main.c && \ + rm -f dtrace_main.c ) !NO!SUBS! ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -$(LIBPERL): $& $(perllib_objs) $(DYNALOADER) $(LIBPERLEXPORT) +$(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT) !NO!SUBS! case "$useshrplib" in true) @@ -947,7 +1007,7 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl *) if test "X$hostperl" != X; then $spitshell >>$Makefile <<!GROK!THIS! -lib/buildcustomize.pl: \$& \$(miniperl_objs) write_buildcustomize.pl +lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl -@rm -f miniperl.xok -@rm \$(MINIPERL_EXE) \$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE) @@ -956,7 +1016,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_objs) write_buildcustomize.pl !GROK!THIS! else $spitshell >>$Makefile <<'!NO!SUBS!' -lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl +lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl -@rm -f miniperl.xok $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ $(miniperl_objs) $(libs) @@ -969,7 +1029,7 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl $spitshell >>$Makefile <<'!NO!SUBS!' -$(PERL_EXE): $& $(perlmain_objs) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl +$(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl -@rm -f miniperl.xok !NO!SUBS! diff --git a/Porting/Glossary b/Porting/Glossary index 1d2a6ea988..a94eaabe8a 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3031,6 +3031,11 @@ dtrace (usedtrace.U): dtraceobject (dtraceobject.U): Whether we need to build an object file with the dtrace tool. +dtracexnolibs (dtraceobject.U): + Whether dtrace accepts -xnolibs. If available we call dtrace -h + and dtrace -G with -xnolibs to allow dtrace to run in a jail on + FreeBSD. + dynamic_ext (Extensions.U): This variable holds a list of XS extension files we want to link dynamically into the package. It is used by Makefile. diff --git a/ext/XS-APItest/Makefile.PL b/ext/XS-APItest/Makefile.PL index d46fa64dcf..24078a6f8c 100644 --- a/ext/XS-APItest/Makefile.PL +++ b/ext/XS-APItest/Makefile.PL @@ -59,7 +59,8 @@ sub MY::postamble DTRACE_D = ../../perldtrace.d dtrace\$(OBJ_EXT): \$(DTRACE_D) core\$(OBJ_EXT) - $Config{dtrace} -G -s \$(DTRACE_D) -o dtrace\$(OBJ_EXT) core\$(OBJ_EXT) + $Config{dtrace} -G -s \$(DTRACE_D) -o dtrace\$(OBJ_EXT) core\$(OBJ_EXT) || \\ + ( \$(ECHO) >dtrace.c && \$(CCCMD) \$(CCCDLFLAGS) dtrace.c && rm -f dtrace.c ) POSTAMBLE return $post; diff --git a/hints/freebsd.sh b/hints/freebsd.sh index 135129f66f..06b0bfd7d2 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -105,6 +105,14 @@ case "$osvers" in ;; esac +case "$osvers" in +10.*) + # dtrace on 10.x needs libelf symbols, but we don't know if the + # user is going to request usedtrace and there's no .cbu for usedtrace + libswanted="$libswanted elf" + ;; +esac + # Dynamic Loading flags have not changed much, so they are separated # out here to avoid duplicating them everywhere. case "$osvers" in -- Perl5 Master Repository
