Browse Source

- more PowerPC64 fixes; "Hello World" style programs can be compiled and run

git-svn-id: trunk@1209 -
tom_at_work 20 years ago
parent
commit
3681639a6a

+ 42 - 3
compiler/aggas.pas

@@ -202,11 +202,11 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.debug_frame',
-          'fpc'
+          'fpc.resptrs'
         );
       begin
-        if (use_smartlink_section and
-           (aname<>'')) or (atype=sec_fpc) then
+        if use_smartlink_section and
+           (aname<>'') then
           result:=secnames[atype]+'.'+aname
         else
           result:=secnames[atype];
@@ -246,6 +246,16 @@ implementation
 
 
     procedure TGNUAssembler.WriteTree(p:TAAsmoutput);
+    {$ifdef powerpc64}
+    function is_const(hp : tai) : boolean;
+    begin
+	is_const := 
+          assigned(hp) and
+          (hp.typ in [ait_const_rva_symbol,
+             ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_datablock,
+             ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit]);
+    end;
+    {$endif powerpc64}
     var
       ch       : char;
       hp       : tai;
@@ -660,6 +670,7 @@ implementation
                 end;
              end;
 
+  
            ait_symbol :
              begin
                if tai_symbol(hp).is_global then
@@ -698,6 +709,24 @@ implementation
                       AsmWrite(', ');
                       AsmWriteLn(tostr(tai_symbol(hp).sym.size));
                     end;
+               {$IFDEF POWERPC64}
+               end else if (target_info.system = system_powerpc64_linux) then begin
+                 if (tai_symbol(hp).sym.typ <> AT_FUNCTION) then begin
+                   AsmWriteLn(#9'.type'#9 + tai_symbol(hp).sym.name + ',@object');
+                   if tai_symbol(hp).sym.size>0 then begin
+                     AsmWriteLn(#9'.size'#9 + tai_symbol(hp).sym.name + ', ' + tostr(tai_symbol(hp).sym.size));
+                   end;
+                 end else begin
+                   AsmWriteLn('.section "opd", "aw"');
+                   AsmWriteLn('.align 3');
+                   AsmWriteLn(tai_symbol(hp).sym.name + ':');
+                   AsmWriteLn('.quad .' + tai_symbol(hp).sym.name + ', .TOC.@tocbase, 0');
+                   AsmWriteLn('.previous');
+                   AsmWriteLn('.size ' + tai_symbol(hp).sym.name + ', 24');
+                   AsmWriteLn('.globl .' + tai_symbol(hp).sym.name);
+                   AsmWrite('.');
+                 end;
+               {$ENDIF}
                 end;
                AsmWrite(tai_symbol(hp).sym.name);
                AsmWriteLn(':');
@@ -711,8 +740,18 @@ implementation
                   inc(symendcount);
                   AsmWriteLn(s+':');
                   AsmWrite(#9'.size'#9);
+                  {$ifdef powerpc64}
+                  if (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then begin
+                    AsmWrite('.');
+                  end;
+                  {$endif powerpc64}
                   AsmWrite(tai_symbol_end(hp).sym.name);
                   AsmWrite(', '+s+' - ');
+                  {$ifdef powerpc64}
+                  if (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then begin
+                    AsmWrite('.');
+                  end;
+                  {$endif powerpc64}
                   AsmWriteLn(tai_symbol_end(hp).sym.name);
                 end;
              end;

+ 1 - 0
compiler/fpcdefs.inc

@@ -72,6 +72,7 @@
   {$define cpuflags}
   {$define cputargethasfixedstack}
   {$define cpumm}  
+  {$define cpurequiresproperalignment}
 {$endif powerpc64}
 
 {$ifdef arm}

+ 0 - 21
compiler/powerpc64/agppcgas.pas

@@ -60,27 +60,6 @@ begin
     AsmWriteln(#9'.set'#9'r' + tostr(i) + ',' + tostr(i));
   for i := 0 to 31 do
     AsmWriteln(#9'.set'#9'f' + tostr(i) + ',' + tostr(i));
-  AsmWriteLn('.macro FUNCTION_PROLOG fn');
-  AsmWriteLn('  .section    ".text"');
-  AsmWriteLn('  .align  2');
-  AsmWriteLn('  .globl  \fn');
-  AsmWriteLn('  .section    ".opd", "aw"');
-  AsmWriteLn('  .align  3');
-  AsmWriteLn('  \fn:');
-  AsmWriteLn('  .quad   .\fn, .TOC.@tocbase, 0');
-  AsmWriteLn('  .previous');
-  AsmWriteLn('  .size   \fn, 24');
-  AsmWriteLn('  .globl  .\fn');
-  AsmWriteLn('.\fn:');
-  AsmWriteLn('.endm');
-  AsmWriteLn('');
-  AsmWriteLn('.macro FUNCTION_EPILOG fn');
-  AsmWriteLn('  .long   0');
-  AsmWriteLn('  .byte   0, 12, 0, 0, 0, 0, 0, 0');
-  AsmWriteLn('  .type   .\fn, @function');
-  AsmWriteLn('  .size   .\fn,.-.\fn');
-  AsmWriteLn('.endm');
-  AsmWriteLn('');
 end;
 
 const

+ 1 - 1
compiler/powerpc64/cgcpu.pas

@@ -1465,7 +1465,7 @@ procedure tcgppc.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const
 var
   make_global: boolean;
 begin
-  if procdef.proctypeoption <> potype_none then
+  if (not (procdef.proctypeoption in [potype_function, potype_procedure])) then
     Internalerror(200006137);
   if not assigned(procdef._class) or
     (procdef.procoptions * [po_classmethod, po_staticmethod,

+ 48 - 37
compiler/powerpc64/cputarg.pas

@@ -21,47 +21,58 @@
 }
 unit cputarg;
 
-{$I fpcdefs.inc}
+{$i fpcdefs.inc}
 
 interface
 
+
 implementation
 
-uses
-  systems { prevent a syntax error when nothing is included }
-
-  {**************************************
-               Targets
-  **************************************}
-
-{$IFNDEF NOTARGETLINUX}
-  , t_linux
-{$ENDIF}
-{$IFNDEF NOTARGETMACOS}
-  , t_macos
-{$ENDIF}
-{$IFNDEF NOTARGETDARWIN}
-  , t_bsd
-{$ENDIF}
-{$IFNDEF NOTARGETMORPHOS}
-  , t_morph
-{$ENDIF}
-
-  {**************************************
-               Assemblers
-  **************************************}
-
-{$IFNDEF NOAGPPCGAS}
-  , agppcgas
-{$ENDIF}
-  {**************************************
-               Optimizer
-  **************************************}
-
-{$IFNDEF NOOPT}
-  , aoptcpu
-{$ENDIF NOOPT}
-  ;
+    uses
+      systems { prevent a syntax error when nothing is included }
 
-end.
+{**************************************
+             Targets
+**************************************}
+
+    {$ifndef NOTARGETLINUX}
+      ,t_linux
+    {$endif}
+
+{**************************************
+             Assemblers
+**************************************}
+
+    {$ifndef NOAGPPCGAS}
+      ,agppcgas
+    {$endif}
+
+{**************************************
+        Assembler Readers
+**************************************}
 
+  {$ifndef NoRaPPCGas}
+       ,rappcgas
+  {$endif NoRaPPCGas}
+
+{**************************************
+             Debuginfo
+**************************************}
+
+  {$ifndef NoDbgStabs}
+      ,dbgstabs
+  {$endif NoDbgStabs}
+  {$ifndef NoDbgDwarf}
+      ,dbgdwarf
+  {$endif NoDbgDwarf}
+
+{**************************************
+             Optimizer
+**************************************}
+
+    {$ifndef NOOPT}
+      , aoptcpu
+    {$endif NOOPT}
+      ;
+
+end.

+ 3 - 2
compiler/powerpc64/rappcgas.pas

@@ -1,4 +1,5 @@
 {
+    $Id: rappcgas.pas,v 1.19 2005/02/14 17:13:10 peter Exp $
     Copyright (c) 1998-2002 by Carl Eric Codere and Peter Vreman
 
     Does the parsing for the PowerPC GNU AS styled inline assembler.
@@ -106,11 +107,11 @@ begin
       else if upper(actasmpattern) = 'HIGHERA' then
         oper.opr.ref.refaddr := addr_highera
       else if upper(actasmpattern) = 'HIGHESTA' then
-        oper.opr.ref.refaddr := addr_highesta
+        oper.opr.ref.refaddr := addr_highesta        
       else if upper(actasmpattern) = 'HIGHER' then
         oper.opr.ref.refaddr := addr_higher
       else if upper(actasmpattern) = 'HIGHEST' then
-        oper.opr.ref.refaddr := addr_highest
+        oper.opr.ref.refaddr := addr_highest                
       else
         Message(asmr_e_invalid_reference_syntax);
       Consume(AS_ID);

+ 0 - 16
rtl/linux/powerpc64/bsyscall.inc

@@ -12,19 +12,3 @@
 
  **********************************************************************}
 
-
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2005 by Michael Van Canneyt,
-    member of the Free Pascal development team.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-

+ 0 - 52
rtl/linux/powerpc64/sighnd.inc

@@ -50,55 +50,3 @@ begin
     HandleErrorAddrFrame(res,pointer(SigContext^.pt_regs^.nip),pointer(SigContext^.pt_regs^.gpr[1]));
 end;
 
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Michael Van Canneyt,
-    member of the Free Pascal development team.
-
-    Signal handler is arch dependant due to processor to language
-    exception conversion.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-
-procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);cdecl;
-var
-  res : word;
-{  fpustate: longint; }
-begin
-  res:=0;
-  { exception flags are turned off by kernel }
-  fpc_enable_ppc_fpu_exceptions;
-  case sig of
-    SIGFPE :
-        begin
-{
-         fpscr is cleared by the kernel -> can't find out cause :(
-          fpustate := fpc_get_ppc_fpscr;
-          if (fpustate and ppc_fpu_underflow) <> 0 then
-            res := 206
-          else if (fpustate and ppc_fpu_overflow) <> 0 then
-            res := 205
-          else if (fpustate and ppc_fpu_divbyzero) <> 0 then
-            res := 200
-          else
-}
-            res := 207;
-        end;
-    SIGILL,
-    SIGBUS,
-    SIGSEGV :
-        res:=216;
-  end;
-  { give runtime error at the position where the signal was raised }
-  if res<>0 then
-    HandleErrorAddrFrame(res,pointer(SigContext^.pt_regs^.nip),pointer(SigContext^.pt_regs^.gpr[1]));
-end;
-

+ 0 - 80
rtl/linux/powerpc64/sighndh.inc

@@ -76,83 +76,3 @@ type
 
   PSigContext = ^TSigContext;
   TSigContext= tsigcontext_struct;
-
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Jonas Maebe,
-    member of the Free Pascal development team.
-
-    TSigContext
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{$packrecords C}
-
-type
-  TPPC_Reg = QWord;
-  { from include/ppc/ptrace.h }
-  pptregs = ^tptregs;
-  tptregs = record
-    gpr: array[0..31] of TPPC_Reg;
-    nip: TPPC_Reg;
-    msr: TPPC_Reg;
-    orig_gpr3: TPPC_Reg; { Used for restarting system calls }
-    ctr: TPPC_Reg;
-    link: TPPC_Reg;
-    xer: TPPC_Reg;
-    ccr: TPPC_Reg;
-    mq: TPPC_Reg;        { 601 only (not used at present)  }
-                         { Used on APUS to hold IPL value. }
-    trap: TPPC_Reg;      { Reason for being here }
-    dar: TPPC_Reg;       { Fault registers }
-    dsisr: TPPC_Reg;
-    result: TPPC_Reg;    { Result of a system call }
-  end;
-
-  { from include/asm-ppc/signal.h }
-  stack_t = record
-    ss_sp: pointer;
-    ss_flags: longint;
-    ss_size: size_t;
-  end;
-
-  { from include/asm-ppc/sigcontext.h }
-  tsigcontext_struct = record
-    _unused: array[0..3] of PtrUInt;
-    signal: longint;
-    handler: PtrInt;
-    oldmask: PtrInt;
-    pt_regs: pptregs;
-  end;
-
-  { from include/asm-ppc/ucontext.h }
-  pucontext = ^tucontext;
-  tucontext = record
-    uc_flags : dword;
-    uc_link : pucontext;
-    uc_stack : stack_t;
-    uc_mcontext : tsigcontext_struct;
-    uc_sigmask : sigset_t;
-  end;
-
-
-  { from arch/ppc/kernel/signal.c, the type of the actual parameter passed }
-  { to the sigaction handler                                               }
-  t_rt_sigframe = record
-    _unused: array[0..1] of cardinal;
-    pinfo: psiginfo;
-    puc: pointer;
-    siginfo: tsiginfo;
-    uc: tucontext;
-  end;
-
-  PSigContext = ^TSigContext;
-  TSigContext= tsigcontext_struct;
-

+ 0 - 38
rtl/linux/powerpc64/stat.inc

@@ -34,41 +34,3 @@
     __reserved2 : qword;    { reserved for atime.nanoseconds }
     __unused : array[0..2] of int64;
   end;
-
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Jonas Maebe,
-    member of the Free Pascal development team.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-  Stat = packed record  // No unix typing because of differences
-    st_dev : qword;
-    st_ino : qword;
-    st_nlink : qword;
-
-    st_mode : dword;
-    st_uid : dword;
-    st_gid : dword;
-    __pad0 : dword;
-    st_rdev : qword;
-    st_size : int64;
-    st_blksize : int64;
-    st_blocks : int64;      { Number 512-byte blocks allocated. }
-
-    st_atime : qword;
-    __reserved0 : qword;    { reserved for atime.nanoseconds }
-    st_mtime : qword;
-    __reserved1 : qword;    { reserved for atime.nanoseconds }
-    st_ctime : qword;
-    __reserved2 : qword;    { reserved for atime.nanoseconds }
-    __unused : array[0..2] of int64;
-  end;
-

+ 0 - 372
rtl/linux/powerpc64/syscall.inc

@@ -368,375 +368,3 @@ asm
   li	r3, -1
 .LDone:
 end;
-
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Michael Van Canneyt,
-    member of the Free Pascal development team.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{No debugging for syslinux include !}
-{$IFDEF SYS_LINUX}
-  {$UNDEF SYSCALL_DEBUG}
-{$ENDIF SYS_LINUX}
-
-
-{*****************************************************************************
-                     --- Main:The System Call Self ---
-*****************************************************************************}
-
-function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : longint;
-  retaddress: ptruint;
-asm
-  mr  r0,r3
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  mr    r4,r5
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-
-function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  mr    r4,r5
-  mr    r5,r6
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-
-function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  mr    r4,r5
-  mr    r5,r6
-  mr    r6,r7
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-
-function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  mr    r4,r5
-  mr    r5,r6
-  mr    r6,r7
-  mr    r7,r8
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-
-
-function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
-{
-  This function puts the registers in place, does the call, and then
-  copies back the registers as they are after the SysCall.
-}
-var
-  temp : int64;
-  retaddress: ptruint;
-asm
-  mr    r0,r3
-  mr    r3,r4
-  mr    r4,r5
-  mr    r5,r6
-  mr    r6,r7
-  mr    r7,r8
-  mr    r8,r9
-  sc
-  bns   .LDone
-  lis   r10,(fpc_threadvar_relocate_proc)@highesta
-  ori   r10, r10, (fpc_threadvar_relocate_proc)@highera
-  sldi  r10, r10, 32
-  oris  r10, r10, (fpc_threadvar_relocate_proc)@ha
-  ld    r10,(fpc_threadvar_relocate_proc)@l(r10)
-
-  cmpdi r10,0
-  bne   .LThreaded
-  lis   r4, (Errno+8)@highesta
-  ori   r4, r4, (Errno+8)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (Errno+8)@ha
-  stw   r3,(Errno+8)@l(r4)
-  b     .LFailed
-.LThreaded:
-  std   r3,temp
-  mflr  r3
-  mtctr r10
-  lis   r4, (errno)@highesta
-  ori   r4, r4, (errno)@highera
-  sldi  r4, r4, 32
-  oris  r4, r4, (errno)@ha
-  std   r3,retaddress
-  ld    r3,(errno)@l(r4)
-  bctrl
-  ld    r4,temp
-  ld    r5,retaddress
-  std   r4,0(r3)
-  mtlr  r5
-.LFailed:
-  li    r3, -1
-.LDone:
-end;
-

+ 0 - 44
rtl/linux/powerpc64/syscallh.inc

@@ -40,47 +40,3 @@ function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external n
 function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;  external name 'FPC_SYSCALL5';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;  external name 'FPC_SYSCALL6';
-
-{
-    Copyright (c) 2002 by Marco van de Voort
-
-    Header for syscall in system unit for powerpc *nix.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-
-}
-
-Type
-
-  TSysResult = Int64;   // all platforms, cint=32-bit.
-                        // On platforms with off_t =64-bit, people should
-                        // use int64, and typecast all calls that don't
-                        // return off_t to cint.
-
-// I don't think this is going to work on several platforms
-// 64-bit machines don't have only 64-bit params.
-
-  TSysParam  = Int64;
-
-function Do_SysCall(sysnr:TSysParam):TSysResult;  external name 'FPC_SYSCALL0';
-function Do_SysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_SYSCALL1';
-function Do_SysCall(sysnr,param1,param2:TSysParam):TSysResult;  external name 'FPC_SYSCALL2';
-function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
-function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
-function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;  external name 'FPC_SYSCALL5';
-function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;  external name 'FPC_SYSCALL6';
-

+ 0 - 262
rtl/linux/powerpc64/sysnr.inc

@@ -258,265 +258,3 @@ Const
         syscall_nr_lremovexattr         = 236;
         syscall_nr_fremovexattr         = 237;
 
-
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Michael Van Canneyt,
-    member of the Free Pascal development team.
-
-    Syscall nrs for 2.4.18
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-
-{
-* This file contains the system call numbers.
-}
-
-Const
-        syscall_nr_exit                 =  1;
-        syscall_nr_fork                 =  2;
-        syscall_nr_read                 =  3;
-        syscall_nr_write                =  4;
-        syscall_nr_open                 =  5;
-        syscall_nr_close                =  6;
-        syscall_nr_waitpid              =  7;
-        syscall_nr_creat                =  8;
-        syscall_nr_link                 =  9;
-        syscall_nr_unlink               = 10;
-        syscall_nr_execve               = 11;
-        syscall_nr_chdir                = 12;
-        syscall_nr_time                 = 13;
-        syscall_nr_mknod                = 14;
-        syscall_nr_chmod                = 15;
-        syscall_nr_lchown               = 16;
-        syscall_nr_break                = 17;
-        syscall_nr_oldstat              = 18;
-        syscall_nr_lseek                = 19;
-        syscall_nr_getpid               = 20;
-        syscall_nr_mount                = 21;
-        syscall_nr_umount               = 22;
-        syscall_nr_setuid               = 23;
-        syscall_nr_getuid               = 24;
-        syscall_nr_stime                = 25;
-        syscall_nr_ptrace               = 26;
-        syscall_nr_alarm                = 27;
-        syscall_nr_oldfstat             = 28;
-        syscall_nr_pause                = 29;
-        syscall_nr_utime                = 30;
-        syscall_nr_stty                 = 31;
-        syscall_nr_gtty                 = 32;
-        syscall_nr_access               = 33;
-        syscall_nr_nice                 = 34;
-        syscall_nr_ftime                = 35;
-        syscall_nr_sync                 = 36;
-        syscall_nr_kill                 = 37;
-        syscall_nr_rename               = 38;
-        syscall_nr_mkdir                = 39;
-        syscall_nr_rmdir                = 40;
-        syscall_nr_dup                  = 41;
-        syscall_nr_pipe                 = 42;
-        syscall_nr_times                = 43;
-        syscall_nr_prof                 = 44;
-        syscall_nr_brk                  = 45;
-        syscall_nr_setgid               = 46;
-        syscall_nr_getgid               = 47;
-        syscall_nr_signal               = 48;
-        syscall_nr_geteuid              = 49;
-        syscall_nr_getegid              = 50;
-        syscall_nr_acct                 = 51;
-        syscall_nr_umount2              = 52;
-        syscall_nr_lock                 = 53;
-        syscall_nr_ioctl                = 54;
-        syscall_nr_fcntl                = 55;
-        syscall_nr_mpx                  = 56;
-        syscall_nr_setpgid              = 57;
-        syscall_nr_ulimit               = 58;
-        syscall_nr_oldolduname          = 59;
-        syscall_nr_umask                = 60;
-        syscall_nr_chroot               = 61;
-        syscall_nr_ustat                = 62;
-        syscall_nr_dup2                 = 63;
-        syscall_nr_getppid              = 64;
-        syscall_nr_getpgrp              = 65;
-        syscall_nr_setsid               = 66;
-        syscall_nr_sigaction            = 67;
-        syscall_nr_sgetmask             = 68;
-        syscall_nr_ssetmask             = 69;
-        syscall_nr_setreuid             = 70;
-        syscall_nr_setregid             = 71;
-        syscall_nr_sigsuspend           = 72;
-        syscall_nr_sigpending           = 73;
-        syscall_nr_sethostname          = 74;
-        syscall_nr_setrlimit            = 75;
-        syscall_nr_getrlimit            = 76;   { Back compatible 2Gig limited rlimit }
-        syscall_nr_getrusage            = 77;
-        syscall_nr_gettimeofday         = 78;
-        syscall_nr_settimeofday         = 79;
-        syscall_nr_getgroups            = 80;
-        syscall_nr_setgroups            = 81;
-        syscall_nr_select               = 82;
-        syscall_nr_symlink              = 83;
-        syscall_nr_oldlstat             = 84;
-        syscall_nr_readlink             = 85;
-        syscall_nr_uselib               = 86;
-        syscall_nr_swapon               = 87;
-        syscall_nr_reboot               = 88;
-        syscall_nr_readdir              = 89;
-        syscall_nr_mmap                 = 90;
-        syscall_nr_munmap               = 91;
-        syscall_nr_truncate             = 92;
-        syscall_nr_ftruncate            = 93;
-        syscall_nr_fchmod               = 94;
-        syscall_nr_fchown               = 95;
-        syscall_nr_getpriority          = 96;
-        syscall_nr_setpriority          = 97;
-        syscall_nr_profil               = 98;
-        syscall_nr_statfs               = 99;
-        syscall_nr_fstatfs              = 100;
-        syscall_nr_ioperm               = 101;
-        syscall_nr_socketcall           = 102;
-        syscall_nr_syslog               = 103;
-        syscall_nr_setitimer            = 104;
-        syscall_nr_getitimer            = 105;
-        syscall_nr_stat                 = 106;
-        syscall_nr_lstat                = 107;
-        syscall_nr_fstat                = 108;
-        syscall_nr_olduname             = 109;
-        syscall_nr_iopl                 = 110;
-        syscall_nr_vhangup              = 111;
-        syscall_nr_idle                 = 112;
-        syscall_nr_vm86old              = 113;
-        syscall_nr_wait4                = 114;
-        syscall_nr_swapoff              = 115;
-        syscall_nr_sysinfo              = 116;
-        syscall_nr_ipc                  = 117;
-        syscall_nr_fsync                = 118;
-        syscall_nr_sigreturn            = 119;
-        syscall_nr_clone                = 120;
-        syscall_nr_setdomainname        = 121;
-        syscall_nr_uname                = 122;
-        syscall_nr_modify_ldt           = 123;
-        syscall_nr_adjtimex             = 124;
-        syscall_nr_mprotect             = 125;
-        syscall_nr_sigprocmask          = 126;
-        syscall_nr_create_module        = 127;
-        syscall_nr_init_module          = 128;
-        syscall_nr_delete_module        = 129;
-        syscall_nr_get_kernel_syms      = 130;
-        syscall_nr_quotactl             = 131;
-        syscall_nr_getpgid              = 132;
-        syscall_nr_fchdir               = 133;
-        syscall_nr_bdflush              = 134;
-        syscall_nr_sysfs                = 135;
-        syscall_nr_personality          = 136;
-        syscall_nr_afs_syscall          = 137; { Syscall for Andrew File System }
-        syscall_nr_setfsuid             = 138;
-        syscall_nr_setfsgid             = 139;
-        syscall_nr__llseek              = 140;
-        syscall_nr_getdents             = 141;
-        syscall_nr__newselect           = 142;
-        syscall_nr_flock                = 143;
-        syscall_nr_msync                = 144;
-        syscall_nr_readv                = 145;
-        syscall_nr_writev               = 146;
-        syscall_nr_getsid               = 147;
-        syscall_nr_fdatasync            = 148;
-        syscall_nr__sysctl              = 149;
-        syscall_nr_mlock                = 150;
-        syscall_nr_munlock              = 151;
-        syscall_nr_mlockall             = 152;
-        syscall_nr_munlockall           = 153;
-        syscall_nr_sched_setparam       = 154;
-        syscall_nr_sched_getparam       = 155;
-        syscall_nr_sched_setscheduler   = 156;
-        syscall_nr_sched_getscheduler   = 157;
-        syscall_nr_sched_yield          = 158;
-        syscall_nr_sched_get_priority_max       = 159;
-        syscall_nr_sched_get_priority_min       = 160;
-        syscall_nr_sched_rr_get_interval        = 161;
-        syscall_nr_nanosleep            = 162;
-        syscall_nr_mremap               = 163;
-        syscall_nr_setresuid            = 164;
-        syscall_nr_getresuid            = 165;
-        syscall_nr_vm86                 = 166;
-        syscall_nr_query_module         = 167;
-        syscall_nr_poll                 = 168;
-        syscall_nr_nfsservctl           = 169;
-        syscall_nr_setresgid            = 170;
-        syscall_nr_getresgid            = 171;
-        syscall_nr_prctl                = 172;
-        syscall_nr_rt_sigreturn         = 173;
-        syscall_nr_rt_sigaction         = 174;
-        syscall_nr_rt_sigprocmask       = 175;
-        syscall_nr_rt_sigpending        = 176;
-        syscall_nr_rt_sigtimedwait      = 177;
-        syscall_nr_rt_sigqueueinfo      = 178;
-        syscall_nr_rt_sigsuspend        = 179;
-        syscall_nr_pread                = 180;
-        syscall_nr_pwrite               = 181;
-        syscall_nr_chown                = 182;
-        syscall_nr_getcwd               = 183;
-        syscall_nr_capget               = 184;
-        syscall_nr_capset               = 185;
-        syscall_nr_sigaltstack          = 186;
-        syscall_nr_sendfile             = 187;
-        syscall_nr_getpmsg              = 188;  { some people actually want streams }
-        syscall_nr_putpmsg              = 189;  { some people actually want streams }
-        syscall_nr_vfork                = 190;
-        syscall_nr_ugetrlimit           = 191;  { SuS compliant getrlimit }
-        syscall_nr_mmap2                = 192;
-        syscall_nr_truncate64           = 193;
-        syscall_nr_ftruncate64          = 194;
-        syscall_nr_stat64               = 195;
-        syscall_nr_lstat64              = 196;
-        syscall_nr_fstat64              = 197;
-        syscall_nr_lchown32             = 198;
-        syscall_nr_getuid32             = 199;
-        syscall_nr_getgid32             = 200;
-        syscall_nr_geteuid32            = 201;
-        syscall_nr_getegid32            = 202;
-        syscall_nr_setreuid32           = 203;
-        syscall_nr_setregid32           = 204;
-        syscall_nr_getgroups32          = 205;
-        syscall_nr_setgroups32          = 206;
-        syscall_nr_fchown32             = 207;
-        syscall_nr_setresuid32          = 208;
-        syscall_nr_getresuid32          = 209;
-        syscall_nr_setresgid32          = 210;
-        syscall_nr_getresgid32          = 211;
-        syscall_nr_chown32              = 212;
-        syscall_nr_setuid32             = 213;
-        syscall_nr_setgid32             = 214;
-        syscall_nr_setfsuid32           = 215;
-        syscall_nr_setfsgid32           = 216;
-        syscall_nr_pivot_root           = 217;
-        syscall_nr_mincore              = 218;
-        syscall_nr_madvise              = 219;
-        syscall_nr_madvise1             = 219;  { delete when C lib stub is removed }
-        syscall_nr_getdents64           = 220;
-        syscall_nr_fcntl64              = 221;
-        syscall_nr_security             = 223;  { syscall for security modules }
-        syscall_nr_gettid               = 224;
-        syscall_nr_readahead            = 225;
-        syscall_nr_setxattr             = 226;
-        syscall_nr_lsetxattr            = 227;
-        syscall_nr_fsetxattr            = 228;
-        syscall_nr_getxattr             = 229;
-        syscall_nr_lgetxattr            = 230;
-        syscall_nr_fgetxattr            = 231;
-        syscall_nr_listxattr            = 232;
-        syscall_nr_llistxattr           = 233;
-        syscall_nr_flistxattr           = 234;
-        syscall_nr_removexattr          = 235;
-        syscall_nr_lremovexattr         = 236;
-        syscall_nr_fremovexattr         = 237;
-
-

+ 2 - 22
rtl/powerpc64/math.inc

@@ -25,7 +25,6 @@ const
                        EXTENDED data type routines
  ****************************************************************************}
 
-{$ifdef INTERNCONSTINTF}
     {$define FPC_SYSTEM_HAS_PI}
     function fpc_pi_real : valreal;compilerproc;
     begin
@@ -50,28 +49,13 @@ const
       result:=0;
     end;
 
-{$else}
-    {$define FPC_SYSTEM_HAS_PI}
-    function pi : double;[internproc:fpc_in_pi];
-
-    {$define FPC_SYSTEM_HAS_ABS}
-    function abs(d : extended) : extended;[internproc:fpc_in_abs_real];
-
-    {$define FPC_SYSTEM_HAS_SQR}
-    function sqr(d : extended) : extended;[internproc:fpc_in_sqr_real];
-{$endif ndef INTERNCONSTINTF}
-
       const
         factor: double = double(int64(1) shl 32);
         factor2: double = double(int64(1) shl 31);
 (*
 {$ifndef FPC_SYSTEM_HAS_TRUNC}
     {$define FPC_SYSTEM_HAS_TRUNC}
-    {$ifdef INTERNCONSTINTF}
     function fpc_trunc_real(d : valreal) : int64;assembler;compilerproc;
-    {$else}
-    function trunc(d : extended) : int64;assembler;[internconst:fpc_in_const_trunc];
-    {$endif}
       { input: d in fr1      }
       { output: result in r3 }
       assembler;
@@ -163,13 +147,9 @@ const
 (*
 {$ifndef FPC_SYSTEM_HAS_ROUND}
     {$define FPC_SYSTEM_HAS_ROUND}
-{$ifdef hascompilerproc}
-    function round(d : extended) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round, external name 'FPC_ROUND'];{$endif}
+    function round(d : extended) : int64;
 
-    function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
-{$else}
-    function round(d : extended) : int64;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif}
-{$endif hascompilerproc}
+    function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];compilerproc;
       { exactly the same as trunc, except that one fctiwz has become fctiw }
       { input: d in fr1      }
       { output: result in r3 }

+ 5 - 5
rtl/powerpc64/powerpc.inc

@@ -958,7 +958,7 @@ asm
 end;
 
 {$define FPC_SYSTEM_HAS_ABS_LONGINT}
-function abs(l:longint):longint; assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
+function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
 asm
         srawi   r0,r3,31
         add     r3,r0,r3
@@ -971,27 +971,27 @@ end;
 ****************************************************************************}
 
 {$define FPC_SYSTEM_HAS_ODD_LONGINT}
-function odd(l:longint):boolean;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
+function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
 asm
         rldicl r3, r3, 0, 63
 end;
 
 
 {$define FPC_SYSTEM_HAS_SQR_LONGINT}
-function sqr(l:longint):longint;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
+function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
 asm
         mullw   r3,r3,r3
 end;
 
 {$define FPC_SYSTEM_HAS_ODD_INT64}
-function odd(l:int64):boolean;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
+function odd(l:int64):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
 asm
         rldicl r3, r3, 0, 63
 end;
 
 
 {$define FPC_SYSTEM_HAS_SQR_INT64}
-function sqr(l:int64):int64;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
+function sqr(l:int64):int64;assembler;{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
 asm
         mulld   r3,r3,r3
 end;