perlasm/x86_64-xlate.pl: handle binary constants early.

Not all assemblers of "gas" flavour handle binary constants, e.g.
seasoned MacOS Xcode doesn't, so give them a hand.

(Imported from upstream's ba26fa14556ba49466d51e4d9e6be32afee9c465.)

Change-Id: I35096dc8035e06d2fbef2363b869128da206ff9d
Reviewed-on: https://boringssl-review.googlesource.com/7459
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-03-14 19:18:14 -04:00
parent 51545ceac6
commit 8d5717b019

View File

@ -190,6 +190,7 @@ my %globals;
sub out { sub out {
my $self = shift; my $self = shift;
$self->{value} =~ s/\b(0b[0-1]+)/oct($1)/eig;
if ($gas) { if ($gas) {
# Solaris /usr/ccs/bin/as can't handle multiplications # Solaris /usr/ccs/bin/as can't handle multiplications
# in $self->{value} # in $self->{value}
@ -200,7 +201,6 @@ my %globals;
} }
sprintf "\$%s",$self->{value}; sprintf "\$%s",$self->{value};
} else { } else {
$self->{value} =~ s/(0b[0-1]+)/oct($1)/eig;
$self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm); $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm);
sprintf "%s",$self->{value}; sprintf "%s",$self->{value};
} }