Browse Source

* fix for Mantis #36951: B and BL can take immediate literals as well
+ added test

git-svn-id: trunk@44999 -

svenbarth 5 years ago
parent
commit
5ef9a78f5f
3 changed files with 33 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/aarch64/aasmcpu.pas
  3. 31 0
      tests/tbs/tb0669.pp

+ 1 - 0
.gitattributes

@@ -13204,6 +13204,7 @@ tests/tbs/tb0666b.pp svneol=native#text/pascal
 tests/tbs/tb0667.pp svneol=native#text/pascal
 tests/tbs/tb0667.pp svneol=native#text/pascal
 tests/tbs/tb0668a.pp svneol=native#text/pascal
 tests/tbs/tb0668a.pp svneol=native#text/pascal
 tests/tbs/tb0668b.pp svneol=native#text/pascal
 tests/tbs/tb0668b.pp svneol=native#text/pascal
+tests/tbs/tb0669.pp svneol=native#text/pascal
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain

+ 1 - 1
compiler/aarch64/aasmcpu.pas

@@ -585,7 +585,7 @@ implementation
           exit;
           exit;
         { "ldr literal" must be a 32/64 bit LDR and have a symbol }
         { "ldr literal" must be a 32/64 bit LDR and have a symbol }
         if (ref.refaddr=addr_pic) and
         if (ref.refaddr=addr_pic) and
-           ((op<>A_LDR) or
+           (not (op in [A_LDR,A_B,A_BL]) or
             not(oppostfix in [PF_NONE,PF_W,PF_SW]) or
             not(oppostfix in [PF_NONE,PF_W,PF_SW]) or
             (not assigned(ref.symbol) and
             (not assigned(ref.symbol) and
              not assigned(ref.symboldata))) then
              not assigned(ref.symboldata))) then

+ 31 - 0
tests/tbs/tb0669.pp

@@ -0,0 +1,31 @@
+{ %CPU=aarch64 }
+{ %NORUN }
+
+program tb0669;
+
+Type
+  TSysResult = Int64;
+  TSysParam  = Int64;
+
+procedure seterrno(err:longint);
+
+begin
+end;
+
+function FpSysCall(sysnr:TSysParam):TSysResult;
+assembler; nostackframe;
+asm
+  {mov w8,w0
+  svc #0
+  tbz x0,#63,.Ldone
+  str x30,[sp,#-16]!
+  neg x0,x0}
+  bl seterrno
+  {ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:}
+end;
+
+begin
+
+end.