-
- if ($TargetPlatform =~ /^powerpc-apple-.*/) {
- # on PowerPC, we have to keep a part of the prologue
- # (which loads the current instruction pointer into register r31)
- $u_p = $p; # $u_p is for unexpected prologue
- $u_p =~ s/^\tbcl 20,31,L\d+\$pb\n//;
- $u_p =~ s/^L\d+\$pb:\n//;
- $u_p =~ s/^\tmflr r31\n//;
- die "Prologue junk?: $u_p\n" if $u_p =~ /^\t[^\.]/
- } else {
- # HWL HACK: dont die, just print a warning
- #print stderr "HWL: this should die! Prologue junk?: $p\n" if $p =~ /^\t[^\.]/;
- die "Prologue junk?: $p\n" if $p =~ /^\t[^\.]/;
+
+ # HWL HACK: dont die, just print a warning
+ #print stderr "HWL: this should die! Prologue junk?: $p\n" if $p =~ /^\t[^\.]/;
+ die "Prologue junk?: $p\n" if $p =~ /^\t[^\.]/;
+
+ if ($TargetPlatform =~ /^powerpc-apple-.*/ && $pcrel_label ne "") {
+ # on PowerPC, we have to keep a part of the prologue
+ # (which loads the current instruction pointer into register r31)
+ $p .= "bcl 20,31,$pcrel_label\n";
+ $p .= "$pcrel_label:\n";
+ $p .= "\tmflr r31";