gas -g doesn't tolerate unpadded .bytes in code segment.
[openssl.git] / crypto / perlasm / ppc-xlate.pl
index a3b5b0e37bcc9c9fdf43e92e4cf84aa8824f488a..fed56e3772a3fa0a0a2c5b62e6ef57a2ba1c0006 100755 (executable)
@@ -7,7 +7,7 @@ open STDOUT,">$output" || die "can't open $output: $!";
 
 my $flavour = $output;
 my %GLOBALS;
-my $dotinlocallabels=0;
+my $dotinlocallabels=($flavour=~/linux/)?1:0;
 
 ################################################################
 # directives which need special treatment on different platforms
@@ -29,7 +29,6 @@ my $globl = sub {
                              };
        /linux.*32/     && do { $ret .= ".globl $name\n";
                                $ret .= ".type  $name,\@function";
-                               $dotinlocallabels = 1;
                                last;
                              };
        /linux.*64/     && do { $ret .= ".globl .$name\n";
@@ -43,7 +42,6 @@ my $globl = sub {
                                $ret .= ".previous\n";
 
                                $name = ".$name";
-                               $dotinlocallabels = 1;
                                last;
                              };
     }
@@ -64,6 +62,14 @@ my $machine = sub {
     }
     ".machine  $arch";
 };
+my $asciz = sub {
+    shift;
+    my $line = join(",",@_);
+    if ($line =~ /^"(.*)"$/)
+    {  ".byte  " . join(",",unpack("C*",$1),0) . "\n.align     2";     }
+    else
+    {  "";     }
+};
 
 ################################################################
 # simplified mnemonics not handled by at least one assembler
@@ -106,7 +112,7 @@ while($line=<>) {
        my $mnemonic = $2;
        my $f = $3;
        my $opcode = eval("\$$mnemonic");
-       $line =~ s|\br([0-9]+)\b|$1|g if ($c ne "." and $flavour !~ /osx/);
+       $line =~ s|\bc?r([0-9]+)\b|$1|g if ($c ne "." and $flavour !~ /osx/);
        if (ref($opcode) eq 'CODE') { $line = &$opcode($f,split(',',$line)); }
        elsif ($mnemonic)           { $line = $c.$mnemonic.$f."\t".$line; }
     }