if ( $c =~ /--- BEGIN ---/ ) {
if (($p, $r) = split(/--- BEGIN ---/, $c)) {
+ # remove junk whitespace around the split point
+ $p =~ s/\t+$//;
+ $r =~ s/^\s*\n//;
+
if ($TargetPlatform =~ /^i386-/) {
$p =~ s/^\tpushl\s+\%edi\n//;
$p =~ s/^\tpushl\s+\%esi\n//;
$p =~ s/^\tpushl\s+\%ebx\n//;
$p =~ s/^\tsubl\s+\$\d+,\s*\%esp\n//;
$p =~ s/^\tmovl\s+\$\d+,\s*\%eax\n\tcall\s+__alloca\n// if ($TargetPlatform =~ /^.*-cygwin32/);
+
+ # GCC 3.1 is in the habit of adding spurious writes to the
+ # stack in the prologue. Just to be on the safe side,
+ # chuck these over the fence into the main code.
+ while ($p =~ /^\tmovl\s+(\$\d+|\%edi),\s*\d*\(\%esp\)\n/) {
+ # print "Spurious instruction: $&";
+ $p = $` . $';
+ $r = $& . $r;
+ }
+
} elsif ($TargetPlatform =~ /^m68k-/) {
$p =~ s/^\tlink a6,#-?\d.*\n//;
$p =~ s/^\tpea a6@\n\tmovel sp,a6\n//;
# glue together what's left
$c = $p . $r;
- $c =~ s/\n\t\n/\n/; # junk blank line
}
}