1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
--- Configure.orig 2016-07-14 19:08:07 UTC
+++ Configure
@@ -940,6 +940,7 @@ lddlflags=''
usedl=''
doublesize=''
dtraceobject=''
+dtracexnolibs=''
ebcdic=''
fflushNULL=''
fflushall=''
@@ -8140,10 +8141,19 @@ while $test 1 ; do
if $test -f $dtrace
then
- if $dtrace -h -s ../perldtrace.d \
+ if $dtrace -h -xnolibs -s ../perldtrace.d \
-o perldtrace.tmp >/dev/null 2>&1 \
&& rm -f perldtrace.tmp
then
+ default_xnolibs=$define
+ echo " "
+ echo "Good: your $dtrace knows about the -h flag"
+ echo "and apparently the -xnolibs flag."
+ elif $dtrace -h -s ../perldtrace.d \
+ -o perldtrace.tmp >/dev/null 2>&1 \
+ && rm -f perldtrace.tmp
+ then
+ default_xnolibs=$undef
echo " "
echo "Good: your $dtrace knows about the -h flag."
else
@@ -8157,6 +8167,17 @@ while $test 1 ; do
EOM
exit 1
fi
+ case "$dtracexnolibs" in
+ $define|true|[yY]*)
+ dtracxnolibs=$define
+ ;;
+ ''|' ')
+ dtracexnolibs=$default_xnolibs
+ ;;
+ *)
+ dtracexnolibs=$undef
+ ;;
+ esac
break;
fi
@@ -20756,7 +20777,11 @@ $define)
dtraceobject=$define
;;
' '|'')
- $dtrace -h -s ../perldtrace.d -o perldtrace.h
+ case "$dtracexnolibs" in
+ $define) xnolibs_option=-xnolibs ;;
+ *) xnolibs_option= ;;
+ esac
+ $dtrace -h $xnolibs_option -s ../perldtrace.d -o perldtrace.h
$cat >try.c <<EOM
#include "perldtrace.h"
int main(void) {
@@ -20766,14 +20791,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_option -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
@@ -24722,6 +24747,7 @@ drand01='$drand01'
drand48_r_proto='$drand48_r_proto'
dtrace='$dtrace'
dtraceobject='$dtraceobject'
+dtracexnolibs='$dtracexnolibs'
dynamic_ext='$dynamic_ext'
eagain='$eagain'
ebcdic='$ebcdic'
--- Makefile.SH.orig 2016-07-16 10:52:42 UTC
+++ 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,53 @@ main_only_objs = op$(OBJ_EXT) perl$(
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/perl5242delta.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
@@ -860,19 +908,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)
@@ -973,7 +1034,7 @@ lib/buildcustomize.pl: $& $(miniperl_obj
*)
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)
@@ -982,7 +1043,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_o
!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)
@@ -995,7 +1056,7 @@ lib/buildcustomize.pl: $& $(miniperl_obj
$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!
--- Porting/Glossary.orig 2016-07-14 19:06:55 UTC
+++ Porting/Glossary
@@ -2949,6 +2949,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.
--- ext/XS-APItest/Makefile.PL.orig 2016-07-14 19:08:07 UTC
+++ ext/XS-APItest/Makefile.PL
@@ -58,7 +58,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;
--- hints/freebsd.sh.orig 2016-07-14 19:07:39 UTC
+++ hints/freebsd.sh
@@ -105,6 +105,15 @@ 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"
+ echo "libswanted $libswanted" >&4
+ ;;
+esac
+
# Dynamic Loading flags have not changed much, so they are separated
# out here to avoid duplicating them everywhere.
case "$osvers" in
|