Browse Source

Merge branch 'fixes_3_2' of gitlab.com:freepascal.org/fpc/source into fixes_3_2

marcoonthegit 2 years ago
parent
commit
d6587b00f5
4 changed files with 17 additions and 13 deletions
  1. 4 4
      compiler/avr/aoptcpu.pas
  2. 1 1
      compiler/i386/aoptcpu.pas
  3. 2 2
      compiler/systems.pas
  4. 10 6
      compiler/systems/t_linux.pas

+ 4 - 4
compiler/avr/aoptcpu.pas

@@ -304,10 +304,10 @@ Implementation
           begin
             {
               change
-              <op> reg,x,y
+              <op> reg,x
               cp reg,r1
               into
-              <op>s reg,x,y
+              <op>s reg,x
             }
             { this optimization can applied only to the currently enabled operations because
               the other operations do not update all flags and FPC does not track flag usage }
@@ -327,13 +327,13 @@ Implementation
                 (taicpu(p).opcode = A_ANDI) and
                 (taicpu(p).oper[1]^.typ=top_const) and
                 (taicpu(hp1).oper[1]^.typ=top_const) and
-                (taicpu(p).oper[1]^.val=taicpu(hp1).oper[1]^.val))) and
+                (taicpu(hp1).oper[1]^.val=0))) and
               GetNextInstruction(hp1, hp2) and
               { be careful here, following instructions could use other flags
                 however after a jump fpc never depends on the value of flags }
               { All above instructions set Z and N according to the following
                 Z := result = 0;
-                N := result[31];
+                N := result[7];
                 EQ = Z=1; NE = Z=0;
                 MI = N=1; PL = N=0; }
               MatchInstruction(hp2, A_BRxx) and

+ 1 - 1
compiler/i386/aoptcpu.pas

@@ -252,7 +252,7 @@ begin
                                     begin
                                       TmpRef.base := taicpu(p).oper[2]^.reg;
                                       TmpRef.ScaleFactor := 4;
-                                      hp1 :=  taicpu.op_ref_reg(A_LEA, S_L, TmpRef, taicpu(p).oper[1]^.reg);
+                                      hp1 :=  taicpu.op_ref_reg(A_LEA, S_L, TmpRef, taicpu(p).oper[2]^.reg);
                                     end
                                   else
                                     begin

+ 2 - 2
compiler/systems.pas

@@ -420,9 +420,9 @@ interface
          (name: 'AIX'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'DARWIN'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'ELFV2'  ; supported:{$if defined(powerpc64)}true{$else}false{$endif}),
-         (name: 'EABI'   ; supported:{$ifdef FPC_ARMEL}true{$else}false{$endif}),
+         (name: 'EABI'   ; supported:{$if defined(arm)}true{$else}false{$endif}),
          (name: 'ARMEB'  ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}),
-         (name: 'EABIHF' ; supported:{$ifdef FPC_ARMHF}true{$else}false{$endif}),
+         (name: 'EABIHF' ; supported:{$if defined(arm)}true{$else}false{$endif}),
          (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}),
          (name: 'AARCH64IOS'; supported:{$ifdef aarch64}true{$else}false{$endif}),
          (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif})

+ 10 - 6
compiler/systems/t_linux.pas

@@ -155,12 +155,16 @@ begin
 {$ifdef arm}
   { some newer Debian have the crt*.o files at uncommon locations,
     for other arm flavours, this cannot hurt }
-{$ifdef FPC_ARMHF}
-      LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/arm-linux-gnueabihf',true);
-{$endif FPC_ARMHF}
-{$ifdef FPC_ARMEL}
-      LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/arm-linux-gnueabi',true);
-{$endif}
+    if target_info.abi=abi_eabihf then
+      begin
+        LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/arm-linux-gnueabihf',true);
+        LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib/arm-linux-gnueabihf',true);
+      end;
+    if target_info.abi=abi_eabi then
+      begin
+        LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/arm-linux-gnueabi',true);
+        LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib/arm-linux-gnueabi',true);
+      end;
 {$endif arm}
 {$ifdef x86_64}
       LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/x86_64-linux-gnu',true);