Message ID | 1508182699-10436-6-git-send-email-martin@martin.st |
---|---|
State | Committed |
Headers | show |
On 2017-10-16 22:38:18 +0300, Martin Storsjö wrote: > Also convert the register from wX into xX, since armasm fails to > assemble it when referring to the register as wX. > --- > gas-preprocessor.pl | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl > index b650c39..d9eaf1d 100755 > --- a/gas-preprocessor.pl > +++ b/gas-preprocessor.pl > @@ -891,16 +891,23 @@ sub handle_serialized_line { > ($arch eq "aarch64" and !is_aarch64_register($target))) { > $call_targets{$target}++; > } > - } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr)\s+(\w+)\s*,\s*(\w+)/) { > + } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr|tbz)\s+(\w+)\s*,(\s*#\d+\s*,)?\s*(\w+)/) { > my $instr = $2; > my $reg = $3; > - my $target = $4; > + my $bit = $4; > + my $target = $5; > if ($target =~ /^(\d+)([bf])$/) { > # The target is a local label > $line = handle_local_label($line, $1, $2); > } else { > $call_targets{$target}++; > } > + # Convert tbz with a wX register into an xX register. > + if ($instr eq "tbz" and $reg =~ /w\d+/) { > + my $xreg = $reg; > + $xreg =~ s/w/x/; > + $line =~ s/\b$reg\b/$xreg/; > + } > } elsif ($line =~ /^\s*.h?word.*\b\d+[bf]\b/) { > while ($line =~ /\b(\d+)([bf])\b/g) { > $line = handle_local_label($line, $1, $2); please mention that this is an armasm bug, the fixup is ok though Janne
diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl index b650c39..d9eaf1d 100755 --- a/gas-preprocessor.pl +++ b/gas-preprocessor.pl @@ -891,16 +891,23 @@ sub handle_serialized_line { ($arch eq "aarch64" and !is_aarch64_register($target))) { $call_targets{$target}++; } - } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr)\s+(\w+)\s*,\s*(\w+)/) { + } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr|tbz)\s+(\w+)\s*,(\s*#\d+\s*,)?\s*(\w+)/) { my $instr = $2; my $reg = $3; - my $target = $4; + my $bit = $4; + my $target = $5; if ($target =~ /^(\d+)([bf])$/) { # The target is a local label $line = handle_local_label($line, $1, $2); } else { $call_targets{$target}++; } + # Convert tbz with a wX register into an xX register. + if ($instr eq "tbz" and $reg =~ /w\d+/) { + my $xreg = $reg; + $xreg =~ s/w/x/; + $line =~ s/\b$reg\b/$xreg/; + } } elsif ($line =~ /^\s*.h?word.*\b\d+[bf]\b/) { while ($line =~ /\b(\d+)([bf])\b/g) { $line = handle_local_label($line, $1, $2);