Commit | Line | Data |
---|---|---|
a0d0e21e LW |
1 | # Create global symbol declarations, transfer vector, and |
2 | # linker options files for PerlShr. | |
3 | # | |
4 | # Input: | |
5 | # $cflags - command line qualifiers passed to cc when preprocesing perl.h | |
6 | # Note: A rather simple-minded attempt is made to restore quotes to | |
7 | # a /Define clause - use with care. | |
8 | # $objsuffix - file type (including '.') used for object files. | |
748a9306 LW |
9 | # $libperl - Perl object library. |
10 | # $extnames - package names for static extensions (used to generate | |
11 | # linker options file entries for boot functions) | |
12 | # $rtlopt - name of options file specifying RTLs to which PerlShr.Exe | |
13 | # must be linked | |
a0d0e21e LW |
14 | # |
15 | # Output: | |
94ae10c0 | 16 | # PerlShr_Attr.Opt - linker options file which specifies that global vars |
a0d0e21e LW |
17 | # be placed in NOSHR,WRT psects. Use when linking any object files |
18 | # against PerlShr.Exe, since cc places global vars in SHR,WRT psects | |
19 | # by default. | |
748a9306 | 20 | # PerlShr_Bld.Opt - declares universal symbols for PerlShr.Exe |
a0d0e21e LW |
21 | # Perlshr_Gbl*.Mar, Perlshr_Gbl*.Obj (VAX only) - declares global symbols |
22 | # for global vars (done here because gcc can't globaldef) and creates | |
23 | # transfer vectors for routines on a VAX. | |
24 | # PerlShr_Gbl.Opt (VAX only) - list of PerlShr_Gbl*.Obj, used for input | |
25 | # to the linker when building PerlShr.Exe. | |
26 | # | |
27 | # To do: | |
28 | # - figure out a good way to collect global vars in one psect, given that | |
29 | # we can't use globaldef because of gcc. | |
30 | # - then, check for existing files and preserve symbol and transfer vector | |
31 | # order for upward compatibility | |
32 | # - then, add GSMATCH to options file - but how do we insure that new | |
33 | # library has everything old one did | |
34 | # (i.e. /Define=DEBUGGING,EMBED,MULTIPLICITY)? | |
35 | # | |
bd3fa61c | 36 | # Author: Charles Bailey bailey@newman.upenn.edu |
a0d0e21e | 37 | |
466adc1d | 38 | use strict; |
a0d0e21e LW |
39 | require 5.000; |
40 | ||
466adc1d | 41 | my $debug = $ENV{'GEN_SHRFLS_DEBUG'}; |
a5f75d66 | 42 | |
466adc1d | 43 | print "gen_shrfls.pl Rev. 30-Sep-2010\n" if $debug; |
71be2cbc | 44 | |
a5f75d66 AD |
45 | if ($ARGV[0] eq '-f') { |
46 | open(INP,$ARGV[1]) or die "Can't read input file $ARGV[1]: $!\n"; | |
47 | print "Input taken from file $ARGV[1]\n" if $debug; | |
48 | @ARGV = (); | |
49 | while (<INP>) { | |
50 | chomp; | |
51 | push(@ARGV,split(/\|/,$_)); | |
52 | } | |
53 | close INP; | |
54 | print "Read input data | ",join(' | ',@ARGV)," |\n" if $debug > 1; | |
55 | } | |
56 | ||
466adc1d CB |
57 | my $cc_cmd = shift @ARGV; |
58 | my $cpp_file; | |
4633a7c4 LW |
59 | |
60 | # Someday, we'll have $GetSyI built into perl . . . | |
466adc1d | 61 | my $isvax = `\$ Write Sys\$Output \(F\$GetSyI(\"HW_MODEL\") .LE. 1024 .AND. F\$GetSyI(\"HW_MODEL\") .GT. 0\)`; |
a50752f9 | 62 | chomp $isvax; |
4633a7c4 LW |
63 | print "\$isvax: \\$isvax\\\n" if $debug; |
64 | ||
466adc1d | 65 | my $isi64 = `\$ Write Sys\$Output \(F\$GetSyI(\"HW_MODEL\") .GE. 4096)`; |
e8e09534 PP |
66 | chomp $isi64; |
67 | print "\$isi64: \\$isi64\\\n" if $debug; | |
68 | ||
a0d0e21e | 69 | print "Input \$cc_cmd: \\$cc_cmd\\\n" if $debug; |
466adc1d | 70 | my $docc = ($cc_cmd !~ /^~~/); |
a0d0e21e LW |
71 | print "\$docc = $docc\n" if $debug; |
72 | ||
0729becf CB |
73 | my ( $use_threads, $use_mymalloc, $care_about_case, $shorten_symbols, |
74 | $debugging_enabled, $hide_mymalloc, $isgcc, $use_perlio, $dir ) | |
466adc1d CB |
75 | = ( 0, 0, 0, 0, 0, 0, 0, 0 ); |
76 | ||
a0d0e21e | 77 | if ($docc) { |
429a5e67 DS |
78 | if (-f 'perl.h') { $dir = '[]'; } |
79 | elsif (-f '[-]perl.h') { $dir = '[-]'; } | |
80 | else { die "$0: Can't find perl.h\n"; } | |
81 | ||
403396f3 | 82 | # Go see what is enabled in config.sh |
466adc1d CB |
83 | my $config = $dir . "config.sh"; |
84 | open CONFIG, '<', $config; | |
429a5e67 | 85 | while(<CONFIG>) { |
ac25e0e7 | 86 | $use_threads++ if /usethreads='(define|yes|true|t|y|1)'/i; |
cbe4ad0c | 87 | $use_mymalloc++ if /usemymalloc='(define|yes|true|t|y|1)'/i; |
ac25e0e7 | 88 | $care_about_case++ if /d_vms_case_sensitive_symbols='(define|yes|true|t|y|1)'/i; |
0729becf | 89 | $shorten_symbols++ if /d_vms_shorten_long_symbols='(define|yes|true|t|y|1)'/i; |
ac25e0e7 CL |
90 | $debugging_enabled++ if /usedebugging_perl='(define|yes|true|t|y|1)'/i; |
91 | $hide_mymalloc++ if /embedmymalloc='(define|yes|true|t|y|1)'/i; | |
de4b552e | 92 | $isgcc++ if /gccversion='[^']/; |
ac25e0e7 | 93 | $use_perlio++ if /useperlio='(define|yes|true|t|y|1)'/i; |
429a5e67 | 94 | } |
403396f3 | 95 | close CONFIG; |
429a5e67 | 96 | |
a0d0e21e | 97 | # put quotes back onto defines - they were removed by DCL on the way in |
466adc1d | 98 | if (my ($prefix,$defines,$suffix) = |
a0d0e21e LW |
99 | ($cc_cmd =~ m#(.*)/Define=(.*?)([/\s].*)#i)) { |
100 | $defines =~ s/^\((.*)\)$/$1/; | |
429a5e67 | 101 | $debugging_enabled ||= $defines =~ /\bDEBUGGING\b/; |
466adc1d | 102 | my @defines = split(/,/,$defines); |
a0d0e21e LW |
103 | $cc_cmd = "$prefix/Define=(" . join(',',grep($_ = "\"$_\"",@defines)) |
104 | . ')' . $suffix; | |
105 | } | |
106 | print "Filtered \$cc_cmd: \\$cc_cmd\\\n" if $debug; | |
107 | ||
4633a7c4 LW |
108 | # check for gcc - if present, we'll need to use MACRO hack to |
109 | # define global symbols for shared variables | |
de4b552e | 110 | |
4633a7c4 | 111 | print "\$isgcc: $isgcc\n" if $debug; |
09b7f37c | 112 | print "\$debugging_enabled: $debugging_enabled\n" if $debug; |
4633a7c4 | 113 | |
a0d0e21e | 114 | } |
4633a7c4 | 115 | else { |
466adc1d | 116 | (undef,undef,$cpp_file,$cc_cmd) = split(/~~/,$cc_cmd,4); |
482b294c | 117 | $isgcc = $cc_cmd =~ /case_hack/i |
4633a7c4 | 118 | or 0; # for nice debug output |
09b7f37c | 119 | $debugging_enabled = $cc_cmd =~ /\bdebugging\b/i; |
4633a7c4 | 120 | print "\$isgcc: \\$isgcc\\\n" if $debug; |
09b7f37c | 121 | print "\$debugging_enabled: \\$debugging_enabled\\\n" if $debug; |
4633a7c4 LW |
122 | print "Not running cc, preprocesor output in \\$cpp_file\\\n" if $debug; |
123 | } | |
a0d0e21e | 124 | |
466adc1d | 125 | my $objsuffix = shift @ARGV; |
a0d0e21e | 126 | print "\$objsuffix: \\$objsuffix\\\n" if $debug; |
466adc1d | 127 | my $dbgprefix = shift @ARGV; |
748a9306 | 128 | print "\$dbgprefix: \\$dbgprefix\\\n" if $debug; |
466adc1d | 129 | my $olbsuffix = shift @ARGV; |
748a9306 | 130 | print "\$olbsuffix: \\$olbsuffix\\\n" if $debug; |
466adc1d CB |
131 | my $libperl = "${dbgprefix}libperl$olbsuffix"; |
132 | my $extnames = shift @ARGV; | |
748a9306 | 133 | print "\$extnames: \\$extnames\\\n" if $debug; |
466adc1d | 134 | my $rtlopt = shift @ARGV; |
748a9306 | 135 | print "\$rtlopt: \\$rtlopt\\\n" if $debug; |
a0d0e21e | 136 | |
466adc1d CB |
137 | my (%vars, %cvars, %fcns); |
138 | ||
713ca5fa CB |
139 | # These are symbols that we should not export. They may merely |
140 | # look like exportable symbols but aren't, or they may be declared | |
141 | # as exportable symbols but there is no function implementing them | |
142 | # (possibly due to an alias). | |
143 | ||
144 | my %symbols_to_exclude = ( | |
145 | '__attribute__format__' => 1, | |
146 | 'main' => 1, | |
147 | 'Perl_pp_avalues' => 1, | |
148 | 'Perl_pp_reach' => 1, | |
149 | 'Perl_pp_rvalues' => 1, | |
150 | 'Perl_pp_say' => 1, | |
151 | 'Perl_pp_transr' => 1, | |
152 | 'sizeof' => 1, | |
153 | ); | |
154 | ||
a0d0e21e LW |
155 | sub scan_var { |
156 | my($line) = @_; | |
71be2cbc | 157 | my($const) = $line =~ /^EXTCONST/; |
a0d0e21e | 158 | |
748a9306 | 159 | print "\tchecking for global variable\n" if $debug > 1; |
3e3baf6d TB |
160 | $line =~ s/\s*EXT/EXT/; |
161 | $line =~ s/INIT\s*\(.*\)//; | |
a0d0e21e LW |
162 | $line =~ s/\[.*//; |
163 | $line =~ s/=.*//; | |
164 | $line =~ s/\W*;?\s*$//; | |
61bb5906 | 165 | $line =~ s/\W*\)\s*\(.*$//; # closing paren for args stripped in previous stmt |
748a9306 | 166 | print "\tfiltered to \\$line\\\n" if $debug > 1; |
a0d0e21e | 167 | if ($line =~ /(\w+)$/) { |
71be2cbc | 168 | print "\tvar name is \\$1\\" . ($const ? ' (const)' : '') . "\n" if $debug > 1; |
169 | if ($const) { $cvars{$1}++; } | |
170 | else { $vars{$1}++; } | |
171 | } | |
a0d0e21e LW |
172 | } |
173 | ||
174 | sub scan_func { | |
466adc1d | 175 | my @lines = split /;/, $_[0]; |
b37f629b CB |
176 | |
177 | for my $line (@lines) { | |
178 | print "\tchecking for global routine\n" if $debug > 1; | |
9396c84f | 179 | $line =~ s/\b(IV|Off_t|Size_t|SSize_t|void|int)\b//i; |
b37f629b CB |
180 | if ( $line =~ /(\w+)\s*\(/ ) { |
181 | print "\troutine name is \\$1\\\n" if $debug > 1; | |
713ca5fa CB |
182 | if (exists($symbols_to_exclude{$1}) |
183 | || ($1 eq 'Perl_stashpv_hvname_match' && ! $use_threads)) { | |
b37f629b CB |
184 | print "\tskipped\n" if $debug > 1; |
185 | } | |
186 | else { $fcns{$1}++ } | |
a0d0e21e | 187 | } |
a0d0e21e LW |
188 | } |
189 | } | |
190 | ||
429a5e67 DS |
191 | # Go add some right up front if we need 'em |
192 | if ($use_mymalloc) { | |
b6837a3b CB |
193 | $fcns{'Perl_malloc'}++; |
194 | $fcns{'Perl_calloc'}++; | |
195 | $fcns{'Perl_realloc'}++; | |
196 | $fcns{'Perl_mfree'}++; | |
429a5e67 DS |
197 | } |
198 | ||
466adc1d | 199 | my ($used_expectation_enum, $used_opcode_enum) = (0, 0); # avoid warnings |
a0d0e21e | 200 | if ($docc) { |
77227254 CB |
201 | 1 while unlink 'perlincludes.tmp'; |
202 | END { 1 while unlink 'perlincludes.tmp'; } # and clean up after | |
203 | ||
466adc1d | 204 | open(PERLINC, '>', 'perlincludes.tmp') or die "Couldn't open 'perlincludes.tmp' $!"; |
77227254 CB |
205 | |
206 | print PERLINC qq/#include "${dir}perl.h"\n/; | |
207 | print PERLINC qq/#include "${dir}perlapi.h"\n/; | |
208 | print PERLINC qq/#include "${dir}perliol.h"\n/ if $use_perlio; | |
209 | print PERLINC qq/#include "${dir}regcomp.h"\n/; | |
210 | ||
211 | close PERLINC; | |
466adc1d | 212 | my $preprocess_list = 'perlincludes.tmp'; |
77227254 | 213 | |
a15cef0c CB |
214 | open(CPP,"${cc_cmd}/NoObj/PreProc=Sys\$Output $preprocess_list|") |
215 | or die "$0: Can't preprocess $preprocess_list: $!\n"; | |
a0d0e21e LW |
216 | } |
217 | else { | |
a5f75d66 | 218 | open(CPP,"$cpp_file") or die "$0: Can't read preprocessed file $cpp_file: $!\n"; |
a0d0e21e | 219 | } |
466adc1d | 220 | my %checkh = map { $_,1 } qw( bytecode byterun intrpvar perlapi perlio perliol |
77227254 | 221 | perlvars proto regcomp thrdvar thread ); |
466adc1d | 222 | my $ckfunc = 0; |
a0d0e21e LW |
223 | LINE: while (<CPP>) { |
224 | while (/^#.*vmsish\.h/i .. /^#.*perl\.h/i) { | |
225 | while (/__VMS_PROTOTYPES__/i .. /__VMS_SEPYTOTORP__/i) { | |
748a9306 | 226 | print "vms_proto>> $_" if $debug > 2; |
9947c4e3 | 227 | if (/^\s*EXT(CONST|\s+)/) { &scan_var($_); } |
b9f71c63 | 228 | else { &scan_func($_); } |
09b7f37c | 229 | last LINE unless defined($_ = <CPP>); |
a0d0e21e | 230 | } |
748a9306 | 231 | print "vmsish.h>> $_" if $debug > 2; |
9947c4e3 | 232 | if (/^\s*EXT(CONST|\s+)/) { &scan_var($_); } |
09b7f37c | 233 | last LINE unless defined($_ = <CPP>); |
a0d0e21e LW |
234 | } |
235 | while (/^#.*opcode\.h/i .. /^#.*perl\.h/i) { | |
748a9306 | 236 | print "opcode.h>> $_" if $debug > 2; |
a0d0e21e | 237 | if (/^OP \*\s/) { &scan_func($_); } |
9947c4e3 | 238 | if (/^\s*EXT(CONST|\s+)/) { &scan_var($_); } |
09b7f37c | 239 | last LINE unless defined($_ = <CPP>); |
a0d0e21e | 240 | } |
09b7f37c | 241 | # Check for transition to new header file |
466adc1d | 242 | my $scanname; |
09b7f37c CB |
243 | if (/^# \d+ "(\S+)"/) { |
244 | my $spec = $1; | |
245 | # Pull name from library module or header filespec | |
246 | $spec =~ /^(\w+)$/ or $spec =~ /(\w+)\.h/i; | |
247 | my $name = lc $1; | |
248 | $ckfunc = exists $checkh{$name} ? 1 : 0; | |
249 | $scanname = $name if $ckfunc; | |
250 | print "Header file transition: ckfunc = $ckfunc for $name.h\n" if $debug > 1; | |
61bb5906 | 251 | } |
09b7f37c CB |
252 | if ($ckfunc) { |
253 | print "$scanname>> $_" if $debug > 2; | |
9947c4e3 | 254 | if (/^\s*EXT(CONST|\s+)/) { &scan_var($_); } |
09b7f37c CB |
255 | else { &scan_func($_); } |
256 | } | |
257 | else { | |
258 | print $_ if $debug > 3 && ($debug > 5 || length($_)); | |
9947c4e3 | 259 | if (/^\s*EXT(CONST|\s+)/) { &scan_var($_); } |
a0d0e21e | 260 | } |
a0d0e21e LW |
261 | } |
262 | close CPP; | |
b9f71c63 | 263 | |
a0d0e21e LW |
264 | while (<DATA>) { |
265 | next if /^#/; | |
266 | s/\s+#.*\n//; | |
4633a7c4 | 267 | next if /^\s*$/; |
466adc1d | 268 | my ($key,$array) = split('=',$_); |
cc391245 CB |
269 | if ($array eq 'vars') { $key = "PL_$key"; } |
270 | else { $key = "Perl_$key"; } | |
748a9306 | 271 | print "Adding $key to \%$array list\n" if $debug > 1; |
a0d0e21e LW |
272 | ${$array}{$key}++; |
273 | } | |
9ef4b0a6 | 274 | if ($debugging_enabled and $isgcc) { $vars{'colors'}++ } |
748a9306 LW |
275 | foreach (split /\s+/, $extnames) { |
276 | my($pkgname) = $_; | |
277 | $pkgname =~ s/::/__/g; | |
4633a7c4 LW |
278 | $fcns{"boot_$pkgname"}++; |
279 | print "Adding boot_$pkgname to \%fcns (for extension $_)\n" if $debug; | |
748a9306 | 280 | } |
a0d0e21e | 281 | |
0729becf CB |
282 | # For symbols over 31 characters, export the shortened name. |
283 | # TODO: Make this general purpose so we can predict the shortened name the | |
284 | # compiler will generate for any symbol over 31 characters in length. The | |
285 | # docs to CC/NAMES=SHORTENED describe the CRC used to shorten the name, but | |
286 | # don't describe its use fully enough to actually mimic what the compiler | |
287 | # does. | |
288 | ||
289 | if ($shorten_symbols) { | |
290 | if (exists $fcns{'Perl_ck_entersub_args_proto_or_list'}) { | |
291 | delete $fcns{'Perl_ck_entersub_args_proto_or_list'}; | |
292 | if ($care_about_case) { | |
293 | $fcns{'Perl_ck_entersub_args_p11c2bjj$'}++; | |
294 | } | |
295 | else { | |
296 | $fcns{'PERL_CK_ENTERSUB_ARGS_P3IAT616$'}++; | |
297 | } | |
298 | } | |
299 | } | |
300 | ||
a0d0e21e LW |
301 | # Eventually, we'll check against existing copies here, so we can add new |
302 | # symbols to an existing options file in an upwardly-compatible manner. | |
303 | ||
466adc1d CB |
304 | my $marord = 1; |
305 | open(OPTBLD,'>', "${dir}${dbgprefix}perlshr_bld.opt") | |
748a9306 | 306 | or die "$0: Can't write to ${dir}${dbgprefix}perlshr_bld.opt: $!\n"; |
a0d0e21e | 307 | if ($isvax) { |
466adc1d | 308 | open(MAR, '>', "${dir}perlshr_gbl${marord}.mar") |
a0d0e21e | 309 | or die "$0: Can't write to ${dir}perlshr_gbl${marord}.mar: $!\n"; |
748a9306 | 310 | print MAR "\t.title perlshr_gbl$marord\n"; |
a0d0e21e | 311 | } |
5e4ba136 | 312 | |
71be2cbc | 313 | unless ($isgcc) { |
e8e09534 PP |
314 | if ($isi64) { |
315 | print OPTBLD "PSECT_ATTR=\$GLOBAL_RO_VARS,NOEXE,RD,NOWRT,SHR\n"; | |
316 | print OPTBLD "PSECT_ATTR=\$GLOBAL_RW_VARS,NOEXE,RD,WRT,NOSHR\n"; | |
317 | } | |
318 | else { | |
319 | print OPTBLD "PSECT_ATTR=\$GLOBAL_RO_VARS,PIC,NOEXE,RD,NOWRT,SHR\n"; | |
320 | print OPTBLD "PSECT_ATTR=\$GLOBAL_RW_VARS,PIC,NOEXE,RD,WRT,NOSHR\n"; | |
321 | } | |
71be2cbc | 322 | } |
b6837a3b | 323 | print OPTBLD "case_sensitive=yes\n" if $care_about_case; |
466adc1d CB |
324 | my $count = 0; |
325 | foreach my $var (sort (keys %vars,keys %cvars)) { | |
748a9306 LW |
326 | if ($isvax) { print OPTBLD "UNIVERSAL=$var\n"; } |
327 | else { print OPTBLD "SYMBOL_VECTOR=($var=DATA)\n"; } | |
4633a7c4 LW |
328 | # This hack brought to you by the lack of a globaldef in gcc. |
329 | if ($isgcc) { | |
a0d0e21e LW |
330 | if ($count++ > 200) { # max 254 psects/file |
331 | print MAR "\t.end\n"; | |
332 | close MAR; | |
333 | $marord++; | |
466adc1d | 334 | open(MAR, '>', "${dir}perlshr_gbl${marord}.mar") |
a0d0e21e | 335 | or die "$0: Can't write to ${dir}perlshr_gbl${marord}.mar: $!\n"; |
748a9306 | 336 | print MAR "\t.title perlshr_gbl$marord\n"; |
a0d0e21e LW |
337 | $count = 0; |
338 | } | |
a0d0e21e LW |
339 | print MAR "\t.psect ${var},long,pic,ovr,rd,wrt,noexe,noshr\n"; |
340 | print MAR "\t${var}:: .blkl 1\n"; | |
341 | } | |
342 | } | |
343 | ||
344 | print MAR "\t.psect \$transfer_vec,pic,rd,nowrt,exe,shr\n" if ($isvax); | |
466adc1d | 345 | foreach my $func (sort keys %fcns) { |
a0d0e21e LW |
346 | if ($isvax) { |
347 | print MAR "\t.transfer $func\n"; | |
348 | print MAR "\t.mask $func\n"; | |
4633a7c4 | 349 | print MAR "\tjmp G\^${func}+2\n"; |
a0d0e21e | 350 | } |
748a9306 | 351 | else { print OPTBLD "SYMBOL_VECTOR=($func=PROCEDURE)\n"; } |
a0d0e21e | 352 | } |
4633a7c4 LW |
353 | if ($isvax) { |
354 | print MAR "\t.end\n"; | |
355 | close MAR; | |
356 | } | |
a0d0e21e | 357 | |
466adc1d | 358 | open(OPTATTR, '>', "${dir}perlshr_attr.opt") |
4633a7c4 | 359 | or die "$0: Can't write to ${dir}perlshr_attr.opt: $!\n"; |
ecc0eccd | 360 | if ($isgcc) { |
466adc1d | 361 | foreach my $var (sort keys %cvars) { |
71be2cbc | 362 | print OPTATTR "PSECT_ATTR=${var},PIC,OVR,RD,NOEXE,NOWRT,SHR\n"; |
363 | } | |
466adc1d | 364 | foreach my $var (sort keys %vars) { |
71be2cbc | 365 | print OPTATTR "PSECT_ATTR=${var},PIC,OVR,RD,NOEXE,WRT,NOSHR\n"; |
366 | } | |
367 | } | |
368 | else { | |
369 | print OPTATTR "! No additional linker directives are needed when using DECC\n"; | |
4633a7c4 | 370 | } |
a0d0e21e | 371 | close OPTATTR; |
4633a7c4 | 372 | |
466adc1d CB |
373 | my $incstr = 'PERL,GLOBALS'; |
374 | my (@symfiles, $drvrname); | |
a0d0e21e | 375 | if ($isvax) { |
a0d0e21e | 376 | $drvrname = "Compile_shrmars.tmp_".time; |
466adc1d | 377 | open (DRVR,'>', $drvrname) or die "$0: Can't write to $drvrname: $!\n"; |
a0d0e21e LW |
378 | print DRVR "\$ Set NoOn\n"; |
379 | print DRVR "\$ Delete/NoLog/NoConfirm $drvrname;\n"; | |
380 | print DRVR "\$ old_proc_vfy = F\$Environment(\"VERIFY_PROCEDURE\")\n"; | |
381 | print DRVR "\$ old_img_vfy = F\$Environment(\"VERIFY_IMAGE\")\n"; | |
748a9306 | 382 | print DRVR "\$ MCR $^X -e \"\$ENV{'LIBPERL_RDT'} = (stat('$libperl'))[9]\"\n"; |
a0d0e21e | 383 | print DRVR "\$ Set Verify\n"; |
748a9306 | 384 | print DRVR "\$ If F\$Search(\"$libperl\").eqs.\"\" Then Library/Object/Create $libperl\n"; |
a0d0e21e | 385 | do { |
bbce6d69 | 386 | push(@symfiles,"perlshr_gbl$marord"); |
a0d0e21e | 387 | print DRVR "\$ Macro/NoDebug/Object=PerlShr_Gbl${marord}$objsuffix PerlShr_Gbl$marord.Mar\n"; |
748a9306 | 388 | print DRVR "\$ Library/Object/Replace/Log $libperl PerlShr_Gbl${marord}$objsuffix\n"; |
a0d0e21e | 389 | } while (--$marord); |
748a9306 LW |
390 | # We had to have a working miniperl to run this program; it's probably the |
391 | # one we just built. It depended on LibPerl, which will be changed when | |
392 | # the PerlShr_Gbl* modules get inserted, so miniperl will be out of date, | |
393 | # and so, therefore, will all of its dependents . . . | |
394 | # We touch LibPerl here so it'll be back 'in date', and we won't rebuild | |
395 | # miniperl etc., and therefore LibPerl, the next time we invoke MM[KS]. | |
a0d0e21e | 396 | print DRVR "\$ old_proc_vfy = F\$Verify(old_proc_vfy,old_img_vfy)\n"; |
748a9306 | 397 | print DRVR "\$ MCR $^X -e \"utime 0, \$ENV{'LIBPERL_RDT'}, '$libperl'\"\n"; |
a0d0e21e | 398 | close DRVR; |
a0d0e21e | 399 | } |
748a9306 | 400 | |
bbce6d69 | 401 | # Initial hack to permit building of compatible shareable images for a |
402 | # given version of Perl. | |
403 | if ($ENV{PERLSHR_USE_GSMATCH}) { | |
424a8fe9 CB |
404 | if ($ENV{PERLSHR_USE_GSMATCH} eq 'INCLUDE_COMPILE_OPTIONS') { |
405 | # Build up a major ID. Since it can only be 8 bits, we encode the version | |
406 | # number in the top four bits and use the bottom four for build options | |
407 | # that'll cause incompatibilities | |
466adc1d | 408 | my ($ver, $sub) = $] =~ /\.(\d\d\d)(\d\d)/; |
e4dfc136 | 409 | $ver += 0; $sub += 0; |
466adc1d | 410 | my $gsmatch = ($sub >= 50) ? "equal" : "lequal"; # Force an equal match for |
424a8fe9 CB |
411 | # dev, but be more forgiving |
412 | # for releases | |
413 | ||
414 | $ver *=16; | |
415 | $ver += 8 if $debugging_enabled; # If DEBUGGING is set | |
416 | $ver += 4 if $use_threads; # if we're threaded | |
417 | $ver += 2 if $use_mymalloc; # if we're using perl's malloc | |
418 | print OPTBLD "GSMATCH=$gsmatch,$ver,$sub\n"; | |
419 | } | |
420 | else { | |
421 | my $major = int($] * 1000) & 0xFF; # range 0..255 | |
422 | my $minor = int(($] * 1000 - $major) * 100 + 0.5) & 0xFF; # range 0..255 | |
423 | print OPTBLD "GSMATCH=LEQUAL,$major,$minor\n"; | |
424 | } | |
09b7f37c CB |
425 | print OPTBLD 'CLUSTER=$$TRANSFER_VECTOR,,', |
426 | map(",$_$objsuffix",@symfiles), "\n"; | |
bbce6d69 | 427 | } |
36477c24 | 428 | elsif (@symfiles) { $incstr .= ',' . join(',',@symfiles); } |
748a9306 LW |
429 | # Include object modules and RTLs in options file |
430 | # Linker wants /Include and /Library on different lines | |
431 | print OPTBLD "$libperl/Include=($incstr)\n"; | |
432 | print OPTBLD "$libperl/Library\n"; | |
a5f75d66 | 433 | open(RTLOPT,$rtlopt) or die "$0: Can't read options file $rtlopt: $!\n"; |
748a9306 LW |
434 | while (<RTLOPT>) { print OPTBLD; } |
435 | close RTLOPT; | |
436 | close OPTBLD; | |
437 | ||
438 | exec "\$ \@$drvrname" if $isvax; | |
439 | ||
440 | ||
a0d0e21e LW |
441 | __END__ |
442 | ||
443 | # Oddball cases, so we can keep the perl.h scan above simple | |
9396c84f CB |
444 | #Foo=vars # uncommented becomes PL_Foo |
445 | #Bar=funcs # uncommented becomes Perl_Bar |