Browse Source

* fixed tests now that i386 assembler code is checked for correct PIC
usage in case PIC generation is on (some by adding PIC-versions of
the assembler code, most by adding -Cg- to the options to be used).

Note: the Intel assembler reader does not yet support the Delphi
PIC construct, so tests with that (like test/tasmread and test/tcg1)
do not work with -Cg on non-Darwin (Darwin needs a different PIC
construct)

git-svn-id: trunk@9370 -

Jonas Maebe 17 years ago
parent
commit
61522d00a2

+ 1 - 0
tests/tbf/tb0037.pp

@@ -1,4 +1,5 @@
 { %FAIL }
+{ %OPT=-Cg- }
 { Old file: tbf0175.pp }
 { Asm, mov word,%eax should not be allowed without casting emits a warning (or error with range checking enabled)  OK 0.99.11 (PM) }
 

+ 1 - 0
tests/tbs/tb0106.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0124b.pp }
 {  }
 

+ 1 - 0
tests/tbs/tb0145.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0175.pp }
 { Asm, mov word,%eax should not be allowed without casting emits a warning (or error with range checking enabled)  OK 0.99.11 (PM) }
 

+ 1 - 0
tests/tbs/tb0193.pp

@@ -1,4 +1,5 @@
 { %skiptarget=win32,win64 }
+{ %OPT=-Cg- }
 { Old file: tbs0227.pp }
 { external var does strange things when declared in localsymtable OK 0.99.11 (PFV) }
 

+ 1 - 0
tests/tbs/tb0194.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0228.pp }
 { Asm, wrong warning for size                          OK 0.99.11 (PFV) }
 

+ 1 - 0
tests/tbs/tb0236.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0276.pp }
 { Asm, intel reference parsing incompatibility         OK 0.99.13 (PFV) }
 

+ 1 - 0
tests/tbs/tb0261.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0304.pp }
 { Label redefined when inlining assembler              OK 0.99.13 (PFV) }
 

+ 1 - 0
tests/tbs/tb0267.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0309.pp }
 { problem with ATT assembler written by bin writer     OK 0.99.14 (PFV) }
 

+ 1 - 0
tests/tbs/tb0275.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Old file: tbs0322.pp }
 {  }
 

+ 1 - 0
tests/tbs/tb0319.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode att}
 
 const

+ 1 - 0
tests/tbs/tb0320.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 
 const

+ 1 - 0
tests/tbs/tb0495.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 var
   Digits : array[0..63] of byte;

+ 25 - 1
tests/test/opt/tretopt.pp

@@ -281,8 +281,20 @@ begin
 {$endif}
 {$ifdef cpui386}
     leal t,%eax
+{$ifndef FPC_PIC}
     movl %eax,p3
-{$endif}
+{$else FPC_PIC}
+    call .Lpic
+.Lpic:
+    popl %ecx
+{$ifdef darwin}
+    movl %eax,p3-.Lpic(%ecx)
+{$else darwin}
+   addl $_GLOBAL_OFFSET_TABLE_,%ecx
+   movl %eax,p3@GOT(%ecx)
+{$endif darwin}
+{$endif FPC_PIC}
+{$endif cpui386}
   end;
 
   t.a:='x';
@@ -320,7 +332,19 @@ begin
 {$endif}
 {$ifdef cpui386}
     leal t,%eax
+{$ifndef FPC_PIC}
     movl %eax,p3
+{$else FPC_PIC}
+    call .Lpic
+.Lpic:
+    popl %ecx
+{$ifdef darwin}
+    movl %eax,p3-.Lpic(%ecx)
+{$else darwin}
+   addl $_GLOBAL_OFFSET_TABLE_,%ecx
+   movl %eax,p3@GOT(%ecx)
+{$endif darwin}
+{$endif FPC_PIC}
 {$endif}
   end;
 

+ 12 - 0
tests/test/tasmread.pp

@@ -11,7 +11,19 @@ var l: longint;
 begin
 {$ifdef cpui386}
   asm
+{$ifndef FPC_PIC}
      mov test.l, 5
+{$else FPC_PIC}
+     call @@LPIC
+@@LPIC:
+     pop ecx
+{$ifdef darwin}
+     mov [test.l-@@LPIC+ecx],5
+{$else darwin}
+     add ecx, @_GLOBAL_OFFSET_TABLE_
+     mov [ecx].OFFSET test.l,5
+{$endif darwin}
+{$endif FPC_PIC}
   end;
 {$endif cpui386}
 {$ifdef cpu68k}

+ 90 - 0
tests/test/tcg1.pp

@@ -12,10 +12,28 @@ begin
 {$ifdef CPUI386}
 {$asmmode att}
   asm
+{$ifndef FPC_PIC}
     movl   %esp,before
     pushw  %es
     movl   %esp,after
     popw   %es
+{$else not FPC_PIC}
+    call   .LPIC
+.LPIC:
+    popl   %ecx
+{$ifdef darwin}
+    movl   %esp,before-.LPIC(%ecx)
+    pushw  %es
+    movl   %esp,after-.LPIC(%ecx)
+    popw   %es
+{$else darwin}
+    addl   $_GLOBAL_OFFSET_TABLE_,%ecx
+    movl   %esp,before@GOT(%ecx)
+    pushw  %es
+    movl   %esp,after@GOT(%ecx)
+    popw   %es
+{$endif darwin}
+{$endif not FPC_PIC}
   end;
   wpush:=before-after;
   if wpush<>2 then
@@ -24,10 +42,28 @@ begin
       haserror:=true;
     end;
   asm
+{$ifndef FPC_PIC}
     movl   %esp,before
     pushl  %es
     movl   %esp,after
     popl   %es
+{$else not FPC_PIC}
+    call   .LPIC
+.LPIC:
+    popl   %ecx
+{$ifdef darwin}
+    movl   %esp,before-.LPIC(%ecx)
+    pushl  %es
+    movl   %esp,after-.LPIC(%ecx)
+    popl   %es
+{$else darwin}
+    addl   $_GLOBAL_OFFSET_TABLE_,%ecx
+    movl   %esp,before@GOT(%ecx)
+    pushl  %es
+    movl   %esp,after@GOT(%ecx)
+    popl   %es
+{$endif darwin}
+{$endif not FPC_PIC}
   end;
   lpush:=before-after;
 
@@ -38,10 +74,28 @@ begin
     end;
 
   asm
+{$ifndef FPC_PIC}
     movl   %esp,before
     pushw  %gs
     movl   %esp,after
     popw   %gs
+{$else not FPC_PIC}
+    call   .LPIC
+.LPIC:
+    popl   %ecx
+{$ifdef darwin}
+    movl   %esp,before-.LPIC(%ecx)
+    pushw  %gs
+    movl   %esp,after-.LPIC(%ecx)
+    popw   %gs
+{$else darwin}
+    addl   $_GLOBAL_OFFSET_TABLE_,%ecx
+    movl   %esp,before@GOT(%ecx)
+    pushw  %gs
+    movl   %esp,after@GOT(%ecx)
+    popw   %gs
+{$endif darwin}
+{$endif not FPC_PIC}
   end;
   wpush:=before-after;
   if wpush<>2 then
@@ -50,10 +104,28 @@ begin
       haserror:=true;
     end;
   asm
+{$ifndef FPC_PIC}
     movl   %esp,before
     pushl  %gs
     movl   %esp,after
     popl   %gs
+{$else not FPC_PIC}
+    call   .LPIC
+.LPIC:
+    popl   %ecx
+{$ifdef darwin}
+    movl   %esp,before-.LPIC(%ecx)
+    pushl  %gs
+    movl   %esp,after-.LPIC(%ecx)
+    popl   %gs
+{$else darwin}
+    addl   $_GLOBAL_OFFSET_TABLE_,%ecx
+    movl   %esp,before@GOT(%ecx)
+    pushl  %gs
+    movl   %esp,after@GOT(%ecx)
+    popl   %gs
+{$endif darwin}
+{$endif not FPC_PIC}
   end;
   lpush:=before-after;
 
@@ -64,10 +136,28 @@ begin
     end;
 {$asmmode intel}
   asm
+{$ifndef FPC_PIC}
     mov    before,esp
     push   es
     mov    after,esp
     pop    es
+{$else not FPC_PIC}
+    call   @@LPIC
+@@LPIC:
+    pop    ecx
+{$ifdef darwin}
+    mov    [before-@@LPIC+ecx],esp
+    push   es
+    mov    [after-@@LPIC+ecx],esp
+    pop    es
+{$else darwin}
+    add    ecx,@_GLOBAL_OFFSET_TABLE_
+    mov    [ecx].OFFSET before,esp
+    push   es
+    mov    [ecx].OFFSET after,esp
+    pop    es
+{$endif darwin}
+{$endif not FPC_PIC}
   end;
   Writeln('Intel "push es" uses ',before-after,' bytes');
 {$endif CPUI386}

+ 19 - 1
tests/test/testsse2.pp

@@ -3,7 +3,7 @@
 uses
    mmx;
 
-{ only a small test to see if it works in principal }
+{ only a small test to see if it works in principle }
 
 var
   b : byte;
@@ -12,9 +12,27 @@ var
 begin
   if is_sse2_cpu then
     asm
+{$ifdef FPC_PIC}
+       call .LPIC
+.LPIC:
+       popl %ecx
+{$ifdef darwin}
+       movdqa    %xmm1,%xmm2
+       movdqa    q-.LPIC(%ecx),%xmm4
+       psubq     %xmm1,%xmm2
+       psubq     q-.LPIC(%ecx),%xmm4
+{$else darwin}
+       addl      $_GLOBAL_OFFSET_TABLE_,%ecx
+       movdqa    %xmm1,%xmm2
+       movdqa    q@GOT(%ecx),%xmm4
+       psubq     %xmm1,%xmm2
+       psubq     q@GOT(%ecx),%xmm4
+{$endif darwin}
+{$else FPC_PIC}
        movdqa    %xmm1,%xmm2
        movdqa    q,%xmm4
        psubq     %xmm1,%xmm2
        psubq     q,%xmm4
+{$endif FPC_PIC}
     end;
 end.

+ 1 - 0
tests/test/tfpu3.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { %NOTE= this test requires that nasm assembler is installed }
 { testfdiv variant with NASM output forced }
 {$ifdef go32v2}

+ 1 - 0
tests/test/tfpu4.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { testfdiv variant with GNU AS output forced }
 {$ifdef win32}
 {$ifdef VER1_0}

+ 1 - 0
tests/test/tfpu5.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { This test program deals with the
   the delicate problem of
   non commutative FPU instruction

+ 1 - 0
tests/webtbf/tw3931b.pp

@@ -1,5 +1,6 @@
 { %fail }
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$asmmode intel}
 

+ 1 - 0
tests/webtbs/tw0735.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 {$inline on}
 

+ 1 - 0
tests/webtbs/tw0761.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 Type TFather = Object A : Integer; end;
      TSon = Object (TFather) B : Integer; end;

+ 1 - 0
tests/webtbs/tw0892.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 
 
 {$asmmode intel}

+ 1 - 0
tests/webtbs/tw0919.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 var i:integer;
 {$asmmode intel}

+ 1 - 0
tests/webtbs/tw0944.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$ifdef TP}
 {$N+}
 {$endif TP}

+ 1 - 0
tests/webtbs/tw1023.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Source provided for Free Pascal Bug Report 1023 }
 { Submitted by "Denis Yarkovoy" on  2000-07-03 }
 { e-mail: [email protected] }

+ 1 - 0
tests/webtbs/tw1066a.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Source provided for Free Pascal Bug Report 1066 }
 { Submitted by "Fernando Oscar Schmitt" on  2000-07-24 }
 { e-mail: [email protected] }

+ 1 - 0
tests/webtbs/tw1066b.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {----------------cut here----------------}
 
 {$asmmode intel}

+ 1 - 0
tests/webtbs/tw1090.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 const
   Number = $7FFFFFF;

+ 1 - 0
tests/webtbs/tw1117.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 {$asmmode intel}
 var
   l1,l2 : longint;

+ 1 - 0
tests/webtbs/tw1902.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$ifdef fpc}
 {$MODE DELPHI}

+ 1 - 0
tests/webtbs/tw1950.pp

@@ -11,6 +11,7 @@ procedure Test(const T: TTest);
  begin
   if @T = nil then exit;
   // do something
+//  halt(1);
  end;
 
 begin

+ 1 - 0
tests/webtbs/tw2323.pp

@@ -1,4 +1,5 @@
 { %CPU=i386 }
+{ %OPT=-Cg- }
 { Source provided for Free Pascal Bug Report 2323 }
 { Submitted by "marco" on  2003-01-16 }
 { e-mail: [email protected] }

+ 1 - 0
tests/webtbs/tw2668.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 { %version=1.1 }
 { Source provided for Free Pascal Bug Report 2668 }
 { Submitted by "Marco" on  2003-09-06 }

+ 1 - 0
tests/webtbs/tw2806.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$ifdef fpc}{$asmmode intel}{$endif}
 

+ 1 - 1
tests/webtbs/tw2998.pp

@@ -1,5 +1,5 @@
 { %cpu=i386 }
-{ %OPT=-OaVARMIN=8 }
+{ %OPT=-OaVARMIN=8 -Cg- }
 
 { Source provided for Free Pascal Bug Report 2998 }
 { Submitted by "bartek" on  2004-03-02 }

+ 1 - 0
tests/webtbs/tw3093.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 { Source provided for Free Pascal Bug Report 3093 }
 { Submitted by "Dail Singleton" on  2004-05-08 }

+ 1 - 0
tests/webtbs/tw3274.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %opt=-Cg- }
 
 { Source provided for Free Pascal Bug Report 3274 }
 { Submitted by "Frank Kintrup" on  2004-08-27 }

+ 1 - 0
tests/webtbs/tw3577.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %opt=-Cg- }
 
 { Source provided for Free Pascal Bug Report 3577 }
 { Submitted by "Simon Kissel" on  2005-01-19 }

+ 1 - 0
tests/webtbs/tw3863.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %opt=-Cg- }
 
 { Source provided for Free Pascal Bug Report 3863 }
 { Submitted by "Jernej" on  2005-04-01 }

+ 1 - 0
tests/webtbs/tw3931a.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$asmmode intel}
 

+ 1 - 0
tests/webtbs/tw4240.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 { Source provided for Free Pascal Bug Report 4240 }
 { Submitted by "Den Jean" on  2005-07-30 }
 { e-mail: [email protected] }

+ 1 - 1
tests/webtbs/tw4388.pp

@@ -1,4 +1,4 @@
-{ %opt=-O2r }
+{ %opt=-O2r -Cg- }
 { %cpu=i386 }
 {$mode delphi}
 

+ 1 - 0
tests/webtbs/tw4450.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$ifdef fpc}{$asmmode intel}{$endif}
 

+ 1 - 0
tests/webtbs/tw5015.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 { Source provided for Free Pascal Bug Report 5015 }
 { Submitted by "Zeljan Rikalo" on  2006-04-15 }

+ 1 - 0
tests/webtbs/tw8195a.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$APPTYPE CONSOLE}
 

+ 1 - 0
tests/webtbs/tw8195b.pp

@@ -1,4 +1,5 @@
 { %cpu=i386 }
+{ %OPT=-Cg- }
 
 {$APPTYPE CONSOLE}