+ } elsif ($TargetPlatform =~ /^powerpc-apple-darwin.*/) {
+ $pcrel_label = $p;
+ $pcrel_label =~ s/(.|\n)*^(\"?L\d+\$pb\"?):\n(.|\n)*/$2/ or $pcrel_label = "";
+
+ $p =~ s/^\tmflr r0\n//;
+ $p =~ s/^\tbl saveFP # f\d+\n//;
+ $p =~ s/^\tbl saveFP ; save f\d+-f\d+\n//;
+ $p =~ s/^\"?L\d+\$pb\"?:\n//;
+ $p =~ s/^\tstmw r\d+,-\d+\(r1\)\n//;
+ $p =~ s/^\tstfd f\d+,-\d+\(r1\)\n//g;
+ $p =~ s/^\tstw r0,\d+\(r1\)\n//g;
+ $p =~ s/^\tstwu r1,-\d+\(r1\)\n//;
+ $p =~ s/^\tstw r\d+,-\d+\(r1\)\n//g;
+ $p =~ s/^\tbcl 20,31,L\d+\$pb\n//;
+ $p =~ s/^L\d+\$pb:\n//;
+ $p =~ s/^\tmflr r31\n//;
+
+ # This is bad: GCC 3 seems to zero-fill some local variables in the prologue
+ # under some circumstances, only when generating position dependent code.
+ # I have no idea why, and I don't think it is necessary, so let's toss it.
+ $p =~ s/^\tli r\d+,0\n//g;
+ $p =~ s/^\tstw r\d+,\d+\(r1\)\n//g;
+ } elsif ($TargetPlatform =~ /^powerpc-.*-linux/) {
+ $p =~ s/^\tmflr 0\n//;
+ $p =~ s/^\tstmw \d+,\d+\(1\)\n//;
+ $p =~ s/^\tstfd \d+,\d+\(1\)\n//g;
+ $p =~ s/^\tstw r0,8\(1\)\n//;
+ $p =~ s/^\tstwu 1,-\d+\(1\)\n//;
+ $p =~ s/^\tstw \d+,\d+\(1\)\n//g;
+
+ # GCC's "large-model" PIC (-fPIC)
+ $pcrel_label = $p;
+ $pcrel_label =~ s/(.|\n)*^.LCF(\d+):\n(.|\n)*/$2/ or $pcrel_label = "";
+
+ $p =~ s/^\tbcl 20,31,.LCF\d+\n//;
+ $p =~ s/^.LCF\d+:\n//;
+ $p =~ s/^\tmflr 30\n//;
+ $p =~ s/^\tlwz 0,\.LCL\d+-\.LCF\d+\(30\)\n//;
+ $p =~ s/^\tadd 30,0,30\n//;
+
+ # This is bad: GCC 3 seems to zero-fill some local variables in the prologue
+ # under some circumstances, only when generating position dependent code.
+ # I have no idea why, and I don't think it is necessary, so let's toss it.
+ $p =~ s/^\tli \d+,0\n//g;
+ $p =~ s/^\tstw \d+,\d+\(1\)\n//g;
+ } elsif ($TargetPlatform =~ /^powerpc64-.*-linux/) {
+ $p =~ s/^\tmr 31,1\n//;
+ $p =~ s/^\tmflr 0\n//;
+ $p =~ s/^\tstmw \d+,\d+\(1\)\n//;
+ $p =~ s/^\tstfd \d+,-?\d+\(1\)\n//g;
+ $p =~ s/^\tstd r0,8\(1\)\n//;
+ $p =~ s/^\tstdu 1,-\d+\(1\)\n//;
+ $p =~ s/^\tstd \d+,-?\d+\(1\)\n//g;
+
+ # GCC's "large-model" PIC (-fPIC)
+ $pcrel_label = $p;
+ $pcrel_label =~ s/(.|\n)*^.LCF(\d+):\n(.|\n)*/$2/ or $pcrel_label = "";
+
+ $p =~ s/^\tbcl 20,31,.LCF\d+\n//;
+ $p =~ s/^.LCF\d+:\n//;
+ $p =~ s/^\tmflr 30\n//;
+ $p =~ s/^\tlwz 0,\.LCL\d+-\.LCF\d+\(30\)\n//;
+ $p =~ s/^\tadd 30,0,30\n//;
+
+ # This is bad: GCC 3 seems to zero-fill some local variables in the prologue
+ # under some circumstances, only when generating position dependent code.
+ # I have no idea why, and I don't think it is necessary, so let's toss it.
+ $p =~ s/^\tli \d+,0\n//g;
+ $p =~ s/^\tstd \d+,\d+\(1\)\n//g;