| 1 | %************************************************************************ |
|---|
| 2 | %* * |
|---|
| 3 | \section[Driver-obj-splitting]{Splitting into many \tr{.o} files (for libraries)} |
|---|
| 4 | %* * |
|---|
| 5 | %************************************************************************ |
|---|
| 6 | |
|---|
| 7 | \begin{code} |
|---|
| 8 | $TargetPlatform = $TARGETPLATFORM; |
|---|
| 9 | |
|---|
| 10 | ($Pgm = $0) =~ s|.*/||; |
|---|
| 11 | $ifile = $ARGV[0]; |
|---|
| 12 | $Tmp_prefix = $ARGV[1]; |
|---|
| 13 | $Output = $ARGV[2]; |
|---|
| 14 | |
|---|
| 15 | &split_asm_file($ifile); |
|---|
| 16 | |
|---|
| 17 | open(OUTPUT, "> $Output") || &tidy_up_and_die(1,"$Pgm: failed to open `$Output' (to write)\n"); |
|---|
| 18 | print OUTPUT "$NoOfSplitFiles\n"; |
|---|
| 19 | close(OUTPUT); |
|---|
| 20 | |
|---|
| 21 | exit(0); |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | sub split_asm_file { |
|---|
| 25 | local($asm_file) = @_; |
|---|
| 26 | my @pieces = (); |
|---|
| 27 | |
|---|
| 28 | open(TMPI, "< $asm_file") || &tidy_up_and_die(1,"$Pgm: failed to open `$asm_file' (to read)\n"); |
|---|
| 29 | |
|---|
| 30 | &collectExports_hppa() if $TargetPlatform =~ /^hppa/; |
|---|
| 31 | &collectExports_mips() if $TargetPlatform =~ /^mips/; |
|---|
| 32 | &collectDyldStuff_darwin() if $TargetPlatform =~ /-apple-darwin/; |
|---|
| 33 | |
|---|
| 34 | $octr = 0; # output file counter |
|---|
| 35 | |
|---|
| 36 | %LocalConstant = (); # we have to subvert C compiler's commoning-up of constants... |
|---|
| 37 | |
|---|
| 38 | $s_stuff = &ReadTMPIUpToAMarker( '', $octr ); |
|---|
| 39 | # that first stuff is a prologue for all .s outputs |
|---|
| 40 | $prologue_stuff = &process_asm_block ( $s_stuff ); |
|---|
| 41 | # $_ already has some of the next stuff in it... |
|---|
| 42 | |
|---|
| 43 | # &tidy_up_and_die(1,"$Pgm: no split markers in .s file!\n") |
|---|
| 44 | # if $prologue_stuff eq $s_stuff; |
|---|
| 45 | |
|---|
| 46 | # lie about where this stuff came from |
|---|
| 47 | # Note the \Q: this ignores regex meta-chars in $Tmp_prefix. |
|---|
| 48 | $prologue_stuff =~ s/\Q"$Tmp_prefix.c"/"$ifile_root.hc"/gm; |
|---|
| 49 | |
|---|
| 50 | while ( $_ ne '' ) { # not EOF |
|---|
| 51 | $octr++; |
|---|
| 52 | |
|---|
| 53 | # grab and de-mangle a section of the .s file... |
|---|
| 54 | $s_stuff = &ReadTMPIUpToAMarker ( $_, $octr ); |
|---|
| 55 | $pieces[$octr] = &process_asm_block ( $s_stuff ); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | # Make sure that we still have some output when the input file is empty |
|---|
| 59 | if ($octr == 0) { |
|---|
| 60 | $octr = 1; |
|---|
| 61 | $pieces[$octr] = ''; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | $NoOfSplitFiles = $octr; |
|---|
| 65 | |
|---|
| 66 | if ($pieces[$NoOfSplitFiles] =~ /(\n[ \t]*\.section[ \t]+\.note\.GNU-stack,[^\n]*\n)/m) { |
|---|
| 67 | $note_gnu_stack = $1; |
|---|
| 68 | for $octr (1..($NoOfSplitFiles - 1)) { |
|---|
| 69 | $pieces[$octr] .= $note_gnu_stack; |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | for $octr (1..$NoOfSplitFiles) { |
|---|
| 74 | # output to a file of its own |
|---|
| 75 | # open a new output file... |
|---|
| 76 | $ofname = "${Tmp_prefix}__${octr}.s"; |
|---|
| 77 | open(OUTF, "> $ofname") || die "$Pgm: can't open output file: $ofname\n"; |
|---|
| 78 | |
|---|
| 79 | print OUTF $prologue_stuff; |
|---|
| 80 | print OUTF $pieces[$octr]; |
|---|
| 81 | |
|---|
| 82 | close(OUTF) |
|---|
| 83 | || &tidy_up_and_die(1,"$Pgm:Failed writing ${Tmp_prefix}__${octr}.s\n"); |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | close(TMPI) || &tidy_up_and_die(1,"Failed reading $asm_file\n"); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | sub collectExports_hppa { # Note: HP-PA only |
|---|
| 90 | |
|---|
| 91 | %LocalExport = (); # NB: global table |
|---|
| 92 | |
|---|
| 93 | while(<TMPI>) { |
|---|
| 94 | if (/^\s+\.EXPORT\s+([^,]+),.*\n/m) { |
|---|
| 95 | local($label) = $1; |
|---|
| 96 | local($body) = "\t.IMPORT $label"; |
|---|
| 97 | if (/,DATA/m) { |
|---|
| 98 | $body .= ",DATA\n"; |
|---|
| 99 | } else { |
|---|
| 100 | $body .= ",CODE\n"; |
|---|
| 101 | } |
|---|
| 102 | $label =~ s/\$/\\\$/gm; |
|---|
| 103 | $LocalExport{$label} = $body; |
|---|
| 104 | } |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | seek(TMPI, 0, 0); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | sub collectExports_mips { # Note: MIPS only |
|---|
| 111 | # (not really sure this is necessary [WDP 95/05]) |
|---|
| 112 | |
|---|
| 113 | $UNDEFINED_FUNS = ''; # NB: global table |
|---|
| 114 | |
|---|
| 115 | while(<TMPI>) { |
|---|
| 116 | $UNDEFINED_FUNS .= $_ if /^\t\.globl\s+\S+ \.\S+\n/m; |
|---|
| 117 | # just save 'em all |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | seek(TMPI, 0, 0); |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | sub collectDyldStuff_darwin { |
|---|
| 124 | local($chunk_label,$label,$cur_section,$section,$chunk,$alignment,$cur_alignment); |
|---|
| 125 | |
|---|
| 126 | %DyldChunks = (); # NB: global table |
|---|
| 127 | %DyldChunksDefined = (); # NB: global table |
|---|
| 128 | |
|---|
| 129 | $cur_section = ''; |
|---|
| 130 | $section = ''; |
|---|
| 131 | $label = ''; |
|---|
| 132 | $chunk = ''; |
|---|
| 133 | $alignment = ''; |
|---|
| 134 | $cur_alignment = ''; |
|---|
| 135 | |
|---|
| 136 | while ( 1 ) { |
|---|
| 137 | $_ = <TMPI>; |
|---|
| 138 | if ( $_ eq '' || (/^L(_.+)\$.+:/m && !(/^L(.*)\$stub_binder:/m))) { |
|---|
| 139 | if ( $label ne '' ) { |
|---|
| 140 | $DyldChunksDefined{$label} .= $section . $alignment . $chunk_label . $ chunk; |
|---|
| 141 | if( $section =~ s/\.data/\.non_lazy_symbol_pointer/m ) { |
|---|
| 142 | $chunk = "\t.indirect_symbol $label\n\t.long 0\n"; |
|---|
| 143 | } |
|---|
| 144 | $DyldChunks{$label} .= $section . $alignment . $chunk_label . $chunk; |
|---|
| 145 | print STDERR "### dyld chunk: $label\n$section$alignment$chunk\n###\n" if $Dump_asm_splitting_info; |
|---|
| 146 | } |
|---|
| 147 | last if ($_ eq ''); |
|---|
| 148 | |
|---|
| 149 | $chunk = ''; |
|---|
| 150 | $chunk_label = $_; |
|---|
| 151 | $label = $1; |
|---|
| 152 | $section = $cur_section; |
|---|
| 153 | $alignment = $cur_alignment; |
|---|
| 154 | print STDERR "label: $label\n" if $Dump_asm_splitting_info; |
|---|
| 155 | } elsif ( /^\s*\.(symbol_stub|picsymbol_stub|lazy_symbol_pointer|non_lazy_symbol_pointer|data|section __IMPORT,.*|section __DATA, __la_sym_ptr(2|3),lazy_symbol_pointers)/m ) { |
|---|
| 156 | $cur_section = $_; |
|---|
| 157 | printf STDERR "section: $cur_section\n" if $Dump_asm_splitting_info; |
|---|
| 158 | $cur_alignment = '' |
|---|
| 159 | } elsif ( /^\s*\.section\s+__TEXT,__symbol_stub1,symbol_stubs,pure_instructions,\d+/m ) { |
|---|
| 160 | $cur_section = $_; |
|---|
| 161 | printf STDERR "section: $cur_section\n" if $Dump_asm_splitting_info; |
|---|
| 162 | # always make sure we align things |
|---|
| 163 | $cur_alignment = '\t.align 2' |
|---|
| 164 | } elsif ( /^\s*\.align.*/m ) { |
|---|
| 165 | $cur_alignment = $_; |
|---|
| 166 | printf STDERR "alignment: $cur_alignment\n" if $Dump_asm_splitting_info; |
|---|
| 167 | } else { |
|---|
| 168 | $chunk .= $_; |
|---|
| 169 | } |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | seek(TMPI, 0, 0); |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | sub ReadTMPIUpToAMarker { |
|---|
| 176 | local($str, $count) = @_; # already read bits |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | for ( $_ = <TMPI>; $_ ne '' && ! /_?__stg_split_marker/m; $_ = <TMPI> ) { |
|---|
| 180 | $str .= $_; |
|---|
| 181 | } |
|---|
| 182 | # if not EOF, then creep forward until next "real" line |
|---|
| 183 | # (throwing everything away). |
|---|
| 184 | # that first "real" line will stay in $_. |
|---|
| 185 | |
|---|
| 186 | # This loop is intended to pick up the body of the split_marker function |
|---|
| 187 | # Note that the assembler mangler will already have eliminated this code |
|---|
| 188 | # if it's been invoked (which it probably has). |
|---|
| 189 | |
|---|
| 190 | while ($_ ne '' && (/_?__stg_split_marker/m |
|---|
| 191 | || /^L[^C].*:$/m |
|---|
| 192 | || /^\.stab/m |
|---|
| 193 | || /\t\.proc/m |
|---|
| 194 | || /\t\.stabd/m |
|---|
| 195 | || /\t\.even/m |
|---|
| 196 | || /\tunlk a6/m |
|---|
| 197 | || /^\t!#PROLOGUE/m |
|---|
| 198 | || /\t\.prologue/m |
|---|
| 199 | || /\t\.frame/m |
|---|
| 200 | # || /\t\.end/ NOT! Let the split_marker regexp catch it |
|---|
| 201 | # || /\t\.ent/ NOT! Let the split_marker regexp catch it |
|---|
| 202 | || /^\s+(save|retl?|restore|nop)/m)) { |
|---|
| 203 | $_ = <TMPI>; |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | print STDERR "### BLOCK:$count:\n$str" if $Dump_asm_splitting_info; |
|---|
| 207 | |
|---|
| 208 | # return str |
|---|
| 209 | $str =~ tr/\r//d if $TargetPlatform =~ /-mingw32$/m; # in case Perl doesn't convert line endings |
|---|
| 210 | $str; |
|---|
| 211 | } |
|---|
| 212 | \end{code} |
|---|
| 213 | |
|---|
| 214 | We must (a)~strip the marker off the block, (b)~record any literal C |
|---|
| 215 | constants that are defined here, and (c)~inject copies of any C constants |
|---|
| 216 | that are used-but-not-defined here. |
|---|
| 217 | |
|---|
| 218 | \begin{code} |
|---|
| 219 | sub process_asm_block { |
|---|
| 220 | local($str) = @_; |
|---|
| 221 | |
|---|
| 222 | return(&process_asm_block_darwin($str)) |
|---|
| 223 | if $TargetPlatform =~ /-apple-darwin/m; |
|---|
| 224 | return(&process_asm_block_sparc($str)) if $TargetPlatform =~ /^sparc-/m; |
|---|
| 225 | return(&process_asm_block_iX86($str)) if $TargetPlatform =~ /^i[34]86-/m; |
|---|
| 226 | return(&process_asm_block_x86_64($str)) if $TargetPlatform =~ /^x86_64-/m; |
|---|
| 227 | return(&process_asm_block_powerpc_linux($str)) |
|---|
| 228 | if $TargetPlatform =~ /^powerpc-[^-]+-linux/m; |
|---|
| 229 | |
|---|
| 230 | # otherwise... |
|---|
| 231 | &tidy_up_and_die(1,"$Pgm: no process_asm_block for $TargetPlatform\n"); |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | sub process_asm_block_sparc { |
|---|
| 235 | local($str) = @_; |
|---|
| 236 | |
|---|
| 237 | # strip the marker |
|---|
| 238 | if ( $OptimiseC ) { |
|---|
| 239 | $str =~ s/_?__stg_split_marker.*:\n//m; |
|---|
| 240 | } else { |
|---|
| 241 | $str =~ s/(\.text\n\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/m; |
|---|
| 242 | $str =~ s/(\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/m; |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | # make sure the *.hc filename gets saved; not just ghc*.c (temp name) |
|---|
| 246 | $str =~ s/^\.stabs "(ghc\d+\.c)"/.stabs "$ifile_root.hc"/gm; # HACK HACK |
|---|
| 247 | |
|---|
| 248 | # remove/record any literal constants defined here |
|---|
| 249 | while ( $str =~ /(\t\.align .\n\.?(L?LC\d+):\n(\t\.asci[iz].*\n)+)/m ) { |
|---|
| 250 | local($label) = $2; |
|---|
| 251 | local($body) = $1; |
|---|
| 252 | |
|---|
| 253 | &tidy_up_and_die(1,"Local constant label $label already defined!\n") |
|---|
| 254 | if $LocalConstant{$label}; |
|---|
| 255 | |
|---|
| 256 | $LocalConstant{$label} = $body; |
|---|
| 257 | |
|---|
| 258 | $str =~ s/\t\.align .\n\.?LL?C\d+:\n(\t\.asci[iz].*\n)+//m; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | # inject definitions for any local constants now used herein |
|---|
| 262 | foreach $k (keys %LocalConstant) { |
|---|
| 263 | if ( $str =~ /\b$k\b/m ) { |
|---|
| 264 | $str = $LocalConstant{$k} . $str; |
|---|
| 265 | } |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | print STDERR "### STRIPPED BLOCK (sparc):\n$str" if $Dump_asm_splitting_info; |
|---|
| 269 | |
|---|
| 270 | $str; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | sub process_asm_block_iX86 { |
|---|
| 274 | local($str) = @_; |
|---|
| 275 | |
|---|
| 276 | # strip the marker |
|---|
| 277 | |
|---|
| 278 | $str =~ s/(\.text\n\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/m; |
|---|
| 279 | $str =~ s/(\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/m; |
|---|
| 280 | |
|---|
| 281 | # it seems prudent to stick on one of these: |
|---|
| 282 | $str = "\.text\n\t.align 4\n" . $str; |
|---|
| 283 | |
|---|
| 284 | # remove/record any literal constants defined here |
|---|
| 285 | # [perl made uglier to work around the perl 5.7/5.8 bug documented at |
|---|
| 286 | # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated |
|---|
| 287 | # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' |
|---|
| 288 | # -- ccshan 2002-09-05] |
|---|
| 289 | while ( ($str =~ /((?:^|\.)(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/m )) { |
|---|
| 290 | local($label) = $2; |
|---|
| 291 | local($body) = $1; |
|---|
| 292 | local($prefix, $suffix) = ($`, $'); |
|---|
| 293 | |
|---|
| 294 | &tidy_up_and_die(1,"Local constant label $label already defined!\n") |
|---|
| 295 | if $LocalConstant{$label}; |
|---|
| 296 | |
|---|
| 297 | while ( $suffix =~ /^((\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ ) { |
|---|
| 298 | $body .= $1; |
|---|
| 299 | $suffix = $'; |
|---|
| 300 | } |
|---|
| 301 | $LocalConstant{$label} = $body; |
|---|
| 302 | $str = $prefix . $suffix; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | # inject definitions for any local constants now used herein |
|---|
| 306 | foreach $k (keys %LocalConstant) { |
|---|
| 307 | if ( $str =~ /\b$k\b/m ) { |
|---|
| 308 | $str = $LocalConstant{$k} . $str; |
|---|
| 309 | } |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | print STDERR "### STRIPPED BLOCK (iX86):\n$str" if $Dump_asm_splitting_info; |
|---|
| 313 | |
|---|
| 314 | $str; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | sub process_asm_block_x86_64 { |
|---|
| 318 | local($str) = @_; |
|---|
| 319 | |
|---|
| 320 | # remove/record any literal constants defined here |
|---|
| 321 | # [perl made uglier to work around the perl 5.7/5.8 bug documented at |
|---|
| 322 | # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated |
|---|
| 323 | # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' |
|---|
| 324 | # -- ccshan 2002-09-05] |
|---|
| 325 | while ( ($str =~ /((?:^|\.)(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/m )) { |
|---|
| 326 | local($label) = $2; |
|---|
| 327 | local($body) = $1; |
|---|
| 328 | local($prefix, $suffix) = ($`, $'); |
|---|
| 329 | |
|---|
| 330 | &tidy_up_and_die(1,"Local constant label $label already defined!\n") |
|---|
| 331 | if $LocalConstant{$label}; |
|---|
| 332 | |
|---|
| 333 | while ( $suffix =~ /^((\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ ) { |
|---|
| 334 | $body .= $1; |
|---|
| 335 | $suffix = $'; |
|---|
| 336 | } |
|---|
| 337 | $LocalConstant{$label} = $body; |
|---|
| 338 | $str = $prefix . $suffix; |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | # inject definitions for any local constants now used herein |
|---|
| 342 | foreach $k (keys %LocalConstant) { |
|---|
| 343 | if ( $str =~ /\b$k\b/m ) { |
|---|
| 344 | $str = $LocalConstant{$k} . $str; |
|---|
| 345 | } |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | print STDERR "### STRIPPED BLOCK (x86_64):\n$str" if $Dump_asm_splitting_info; |
|---|
| 349 | |
|---|
| 350 | $str; |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | # The logic for both Darwin/PowerPC and Darwin/x86 ends up being the same. |
|---|
| 354 | |
|---|
| 355 | sub process_asm_block_darwin { |
|---|
| 356 | local($str) = @_; |
|---|
| 357 | local($dyld_stuff) = ''; |
|---|
| 358 | |
|---|
| 359 | # strip the marker |
|---|
| 360 | $str =~ s/___stg_split_marker.*\n//m; |
|---|
| 361 | |
|---|
| 362 | $str =~ s/L_.*\$.*:\n(.|\n)*//m; |
|---|
| 363 | |
|---|
| 364 | # remove/record any literal constants defined here |
|---|
| 365 | while ( $str =~ s/^(\s+.const.*\n\s+\.align.*\n(LC\d+):\n(\s\.(byte|short|long|fill|space|ascii).*\n)+)//m ) { |
|---|
| 366 | local($label) = $2; |
|---|
| 367 | local($body) = $1; |
|---|
| 368 | |
|---|
| 369 | &tidy_up_and_die(1,"Local constant label $label already defined!\n") |
|---|
| 370 | if $LocalConstant{$label}; |
|---|
| 371 | |
|---|
| 372 | $LocalConstant{$label} = $body; |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | # inject definitions for any local constants now used herein |
|---|
| 376 | foreach $k (keys %LocalConstant) { |
|---|
| 377 | if ( $str =~ /\b$k(\b|\[)/m ) { |
|---|
| 378 | $str = $LocalConstant{$k} . $str; |
|---|
| 379 | } |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | foreach $k (keys %DyldChunks) { |
|---|
| 383 | if ( $str =~ /\bL$k\$/m ) { |
|---|
| 384 | if ( $str =~ /^$k:$/m ) { |
|---|
| 385 | $dyld_stuff .= $DyldChunksDefined{$k}; |
|---|
| 386 | } else { |
|---|
| 387 | $dyld_stuff .= $DyldChunks{$k}; |
|---|
| 388 | } |
|---|
| 389 | } |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | $str .= "\n" . $dyld_stuff; |
|---|
| 393 | |
|---|
| 394 | print STDERR "### STRIPPED BLOCK (darwin):\n$str" if $Dump_asm_splitting_info; |
|---|
| 395 | |
|---|
| 396 | $str; |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | sub process_asm_block_powerpc_linux { |
|---|
| 400 | local($str) = @_; |
|---|
| 401 | |
|---|
| 402 | # strip the marker |
|---|
| 403 | $str =~ s/__stg_split_marker.*\n//m; |
|---|
| 404 | |
|---|
| 405 | # remove/record any literal constants defined here |
|---|
| 406 | while ( $str =~ s/^(\s+.section\s+\.rodata\n\s+\.align.*\n(\.LC\d+):\n(\s\.(byte|short|long|quad|2byte|4byte|8byte|fill|space|ascii|string).*\n)+)//m ) { |
|---|
| 407 | local($label) = $2; |
|---|
| 408 | local($body) = $1; |
|---|
| 409 | |
|---|
| 410 | &tidy_up_and_die(1,"Local constant label $label already defined!\n") |
|---|
| 411 | if $LocalConstant{$label}; |
|---|
| 412 | |
|---|
| 413 | $LocalConstant{$label} = $body; |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | # inject definitions for any local constants now used herein |
|---|
| 417 | foreach $k (keys %LocalConstant) { |
|---|
| 418 | if ( $str =~ /[\s,]$k\b/m ) { |
|---|
| 419 | $str = $LocalConstant{$k} . $str; |
|---|
| 420 | } |
|---|
| 421 | } |
|---|
| 422 | |
|---|
| 423 | print STDERR "### STRIPPED BLOCK (powerpc linux):\n$str" if $Dump_asm_splitting_info; |
|---|
| 424 | |
|---|
| 425 | $str; |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | sub tidy_up_and_die { |
|---|
| 429 | local($return_val, $msg) = @_; |
|---|
| 430 | print STDERR $msg; |
|---|
| 431 | exit (($return_val == 0) ? 0 : 1); |
|---|
| 432 | } |
|---|
| 433 | \end{code} |
|---|