summaryrefslogtreecommitdiffstats
path: root/crypto/perlasm/arm-xlate.pl
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/perlasm/arm-xlate.pl')
-rwxr-xr-xcrypto/perlasm/arm-xlate.pl30
1 files changed, 26 insertions, 4 deletions
diff --git a/crypto/perlasm/arm-xlate.pl b/crypto/perlasm/arm-xlate.pl
index 3b0dcad413..aef9595a5e 100755
--- a/crypto/perlasm/arm-xlate.pl
+++ b/crypto/perlasm/arm-xlate.pl
@@ -116,9 +116,26 @@ my $asciz = sub {
my $adrp = sub {
my ($args,$comment) = split(m|\s*//|,shift);
- "\tadrp\t$args\@PAGE";
-} if ($flavour =~ /ios64/);
-
+ if ($flavour =~ /ios64/) {
+ "\tadrp\t$args\@PAGE";
+ } elsif ($flavour =~ /linux/) {
+ #
+ # there seem to be two forms of 'addrp' instruction
+ # to calculate offset:
+ # addrp x3,x3,:lo12:Lrcon
+ # and alternate form:
+ # addrp x3,x3,:#lo12:Lrcon
+ # the '#' is mandatory for some compilers
+ # so make sure our asm always uses '#' here.
+ #
+ $args =~ s/(\w+)#?:lo2:(\.?\w+)/$1#:lo2:$2/;
+ if ($flavour =~ /linux32/) {
+ "\tadr\t$args";
+ } else {
+ "\tadrp\t$args";
+ }
+ }
+} if (($flavour =~ /ios64/) || ($flavour =~ /linux/));
sub range {
my ($r,$sfx,$start,$end) = @_;
@@ -150,7 +167,12 @@ sub expand_line {
$line =~ s/\b(\w+)/$GLOBALS{$1} or $1/ge;
if ($flavour =~ /ios64/) {
- $line =~ s/#:lo12:(\w+)/$1\@PAGEOFF/;
+ $line =~ s/#?:lo12:(\w+)/$1\@PAGEOFF/;
+ } elsif($flavour =~ /linux/) {
+ #
+ # make '#' mandatory for :lo12: (similar to adrp above)
+ #
+ $line =~ s/#?:lo12:(\.?\w+)/\#:lo12:$1/;
}
return $line;