Explorar o código

--- Merging r20714 into '.':
U compiler/systems.inc
U compiler/utils/ppudump.pp
--- Merging r20715 into '.':
U compiler/systems/i_bsd.pas
U compiler/systems/t_bsd.pas
--- Merging r20716 into '.':
U compiler/x86/agx86att.pas
--- Merging r20717 into '.':
U compiler/systems.pas
--- Merging r20718 into '.':
U compiler/ogelf.pas
--- Merging r20727 into '.':
G compiler/systems/i_bsd.pas
--- Merging r20728 into '.':
G compiler/systems/t_bsd.pas
--- Merging r20730 into '.':
G compiler/systems.inc
G compiler/systems.pas
G compiler/utils/ppudump.pp
--- Merging r20731 into '.':
G compiler/systems/i_bsd.pas
--- Merging r20732 into '.':
G compiler/systems/t_bsd.pas
--- Merging r20733 into '.':
G compiler/systems.pas
--- Merging r20743 into '.':
U rtl/netbsd/signal.inc
--- Merging r20744 into '.':
G compiler/ogelf.pas
--- Merging r20745 into '.':
G compiler/x86/agx86att.pas
--- Merging r20749 into '.':
U compiler/symdef.pas
--- Merging r20757 into '.':
U rtl/openbsd/x86_64/prt0.as
U rtl/openbsd/x86_64/cprt0.as
--- Merging r20766 into '.':
U rtl/netbsd/unxsysc.inc
--- Merging r20767 into '.':
G rtl/netbsd/unxsysc.inc
--- Merging r20774 into '.':
U rtl/bsd/ossysc.inc
--- Merging r20775 into '.':
U rtl/bsd/i386/syscall.inc
--- Merging r20776 into '.':
G compiler/systems/i_bsd.pas

# revisions: 20714,20715,20716,20717,20718,20727,20728,20730,20731,20732,20733,20743,20744,20745,20749,20757,20766,20767,20774,20775,20776
------------------------------------------------------------------------
r20714 | pierre | 2012-04-05 23:04:21 +0200 (Thu, 05 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems.inc
M /trunk/compiler/utils/ppudump.pp

+ Add system_x86_64_openbsd system
------------------------------------------------------------------------
------------------------------------------------------------------------
r20715 | pierre | 2012-04-05 23:06:56 +0200 (Thu, 05 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/i_bsd.pas
M /trunk/compiler/systems/t_bsd.pas

+ Add system_x86_64_openbsd_info record
------------------------------------------------------------------------
------------------------------------------------------------------------
r20716 | pierre | 2012-04-05 23:08:14 +0200 (Thu, 05 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/x86/agx86att.pas

+ Add system_x86_64_openbsd to list of supported systems for as assembler
------------------------------------------------------------------------
------------------------------------------------------------------------
r20717 | pierre | 2012-04-05 23:09:31 +0200 (Thu, 05 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems.pas

+ Add system_x86_64_openbsd to systems_openbsd set
------------------------------------------------------------------------
------------------------------------------------------------------------
r20718 | pierre | 2012-04-05 23:10:43 +0200 (Thu, 05 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/ogelf.pas

Accept i386/x86_64 openbsd systems for elf object writer
------------------------------------------------------------------------
------------------------------------------------------------------------
r20727 | pierre | 2012-04-06 23:21:15 +0200 (Fri, 06 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/i_bsd.pas

Mark x86_64 openbsd system as under development
------------------------------------------------------------------------
------------------------------------------------------------------------
r20728 | pierre | 2012-04-06 23:21:56 +0200 (Fri, 06 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

Use correct dynamic linker for x86_64 openbsd system
------------------------------------------------------------------------
------------------------------------------------------------------------
r20730 | pierre | 2012-04-06 23:43:40 +0200 (Fri, 06 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems.inc
M /trunk/compiler/systems.pas
M /trunk/compiler/utils/ppudump.pp

* Add system_x86_64_netbsd system
------------------------------------------------------------------------
------------------------------------------------------------------------
r20731 | pierre | 2012-04-07 00:03:37 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/i_bsd.pas

+ Add system_x86_64_ntbsd_info record
------------------------------------------------------------------------
------------------------------------------------------------------------
r20732 | pierre | 2012-04-07 00:04:20 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

+ Register for system_x86_64_ntbsd
------------------------------------------------------------------------
------------------------------------------------------------------------
r20733 | pierre | 2012-04-07 00:07:38 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems.pas

* Set netbsd defautf for x86_64 compiler if on netbsd system
------------------------------------------------------------------------
------------------------------------------------------------------------
r20743 | pierre | 2012-04-07 17:52:15 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/signal.inc

Add SigContextRec for x86_64 CPU
------------------------------------------------------------------------
------------------------------------------------------------------------
r20744 | pierre | 2012-04-07 17:53:36 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/ogelf.pas

Accept x86_64_netbsd system for elf64 object writer
------------------------------------------------------------------------
------------------------------------------------------------------------
r20745 | pierre | 2012-04-07 17:54:17 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/x86/agx86att.pas

Accept x86_64_netbsd system for GNU as
------------------------------------------------------------------------
------------------------------------------------------------------------
r20749 | pierre | 2012-04-07 19:03:21 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/symdef.pas

Add openbsd/netbsd x86_64 systems to list using 16 for size of cextended type
------------------------------------------------------------------------
------------------------------------------------------------------------
r20757 | pierre | 2012-04-08 19:42:23 +0200 (Sun, 08 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/openbsd/x86_64/cprt0.as
M /trunk/rtl/openbsd/x86_64/prt0.as

* Use RIP relative addressing for FPC system_parameter variables
------------------------------------------------------------------------
------------------------------------------------------------------------
r20766 | pierre | 2012-04-08 23:32:37 +0200 (Sun, 08 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/unxsysc.inc

+ Add netbsd x86_64 support for intAssignPipe
------------------------------------------------------------------------
------------------------------------------------------------------------
r20767 | pierre | 2012-04-08 23:42:20 +0200 (Sun, 08 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/unxsysc.inc

* Fix typo in last commit
------------------------------------------------------------------------
------------------------------------------------------------------------
r20774 | pierre | 2012-04-09 23:56:02 +0200 (Mon, 09 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/ossysc.inc

Explicitly set fpSigAction return value
------------------------------------------------------------------------
------------------------------------------------------------------------
r20775 | pierre | 2012-04-09 23:57:13 +0200 (Mon, 09 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/i386/syscall.inc

* Use correct sign extension for FPC_DOSYS1w
------------------------------------------------------------------------
------------------------------------------------------------------------
r20776 | pierre | 2012-04-10 00:00:54 +0200 (Tue, 10 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/i_bsd.pas

Use elf32 binary writer for i386 netbsd target
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20997 -

marco %!s(int64=13) %!d(string=hai) anos
pai
achega
b151b62681

+ 7 - 3
compiler/ogelf.pas

@@ -1267,8 +1267,11 @@ implementation
             idtxt  : 'ELF';
             asmbin : '';
             asmcmd : '';
-            supported_targets : [system_i386_linux,system_i386_beos,system_i386_freebsd,system_i386_haiku,system_i386_Netware,system_i386_netwlibc,
-	                              system_i386_solaris,system_i386_embedded];
+            supported_targets : [system_i386_linux,system_i386_beos,
+                                 system_i386_freebsd,system_i386_haiku,
+                                 system_i386_openbsd,system_i386_netbsd,
+                                 system_i386_Netware,system_i386_netwlibc,
+	                         system_i386_solaris,system_i386_embedded];
             flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
             labelprefix : '.L';
             comment : '';
@@ -1282,7 +1285,8 @@ implementation
             idtxt  : 'ELF';
             asmbin : '';
             asmcmd : '';
-            supported_targets : [system_x86_64_linux,system_x86_64_freebsd];
+            supported_targets : [system_x86_64_linux,system_x86_64_freebsd,
+                                 system_x86_64_openbsd,system_x86_64_netbsd];
             flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
             labelprefix : '.L';
             comment : '';

+ 1 - 0
compiler/symdef.pas

@@ -1976,6 +1976,7 @@ implementation
            sc80real:
              if target_info.system in [system_i386_darwin,system_i386_iphonesim,system_x86_64_darwin,
                   system_x86_64_linux,system_x86_64_freebsd,
+                  system_x86_64_openbsd,system_x86_64_netbsd,
                   system_x86_64_solaris,system_x86_64_embedded] then
                savesize:=16
              else

+ 3 - 1
compiler/systems.inc

@@ -146,7 +146,9 @@
              system_mipsel_linux,       { 67 }
              system_i386_nativent,      { 68 }
              system_i386_iphonesim,     { 69 }
-             system_powerpc_wii         { 70 }
+             system_powerpc_wii,        { 70 }
+             system_x86_64_openbsd,     { 71 }
+             system_x86_64_netbsd       { 72 }
        );
 
      type

+ 13 - 2
compiler/systems.pas

@@ -218,8 +218,11 @@ interface
                           system_x86_64_freebsd];
        systems_netbsd  = [system_i386_netbsd,
                           system_m68k_netbsd,
-                          system_powerpc_netbsd];
-       systems_openbsd = [system_i386_openbsd];
+                          system_powerpc_netbsd,
+                          system_x86_64_netbsd];
+       systems_openbsd = [system_i386_openbsd,
+                          system_m68k_openbsd,
+                          system_x86_64_openbsd];
 
        systems_bsd = systems_freebsd + systems_netbsd + systems_openbsd;
 
@@ -749,6 +752,14 @@ begin
     default_target(system_x86_64_freebsd);
     {$define default_target_set}
    {$endif}
+   {$ifdef openbsd}
+    default_target(system_x86_64_openbsd);
+    {$define default_target_set}
+   {$endif}
+   {$ifdef netbsd}
+    default_target(system_x86_64_netbsd);
+    {$define default_target_set}
+   {$endif}
    {$ifdef solaris}
     default_target(system_x86_64_solaris);
     {$define default_target_set}

+ 134 - 1
compiler/systems/i_bsd.pas

@@ -218,7 +218,7 @@ unit i_bsd;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            assem        : as_gas;
+            assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
             linkextern   : nil;
@@ -308,6 +308,70 @@ unit i_bsd;
             abi          : abi_default;
           );
 
+       system_x86_64_openbsd_info : tsysteminfo =
+          (
+            system       : system_x86_64_openbsd;
+            name         : 'OpenBSD for x86-64';
+            shortname    : 'OpenBSD';
+            flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,tf_library_needs_pic,tf_needs_symbol_type,
+                            tf_files_case_sensitive,tf_smartlink_library, tf_under_development,
+                            tf_dwarf_only_local_labels
+                            { tf_pic_uses_got,tf_smartlink_sections},tf_has_winlike_resources];
+            cpu          : cpu_x86_64;
+            unit_env     : 'BSDUNITS';
+            extradefines : 'UNIX;HASUNIX;BSD';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_x86_64_elf64;
+            assemextern  : as_gas;
+            link         : nil;
+            linkextern   : nil;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_dwarf2;            //dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 8;
+                loopalign       : 4;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 256*1024;
+            abi          : abi_default;
+          );
+
        system_m68k_netbsd_info : tsysteminfo =
           (
             system       : system_m68k_NetBSD;
@@ -431,6 +495,69 @@ unit i_bsd;
             abi : abi_powerpc_aix;
           );
 
+       system_x86_64_netbsd_info : tsysteminfo =
+          (
+            system       : system_x86_64_netbsd;
+            name         : 'NetBSD for x86-64';
+            shortname    : 'NetBSD';
+            flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,tf_library_needs_pic,tf_needs_symbol_type,
+                            tf_files_case_sensitive,tf_smartlink_library, tf_under_development,
+                            tf_dwarf_only_local_labels
+                            { tf_pic_uses_got,tf_smartlink_sections},tf_has_winlike_resources];
+            cpu          : cpu_x86_64;
+            unit_env     : 'BSDUNITS';
+            extradefines : 'UNIX;HASUNIX;BSD';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_x86_64_elf64;
+            assemextern  : as_gas;
+            link         : nil;
+            linkextern   : nil;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_dwarf2;            //dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 8;
+                loopalign       : 4;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 256*1024;
+            abi          : abi_default;
+          );
 
        system_powerpc_darwin_info  : tsysteminfo =
           (
@@ -828,6 +955,12 @@ initialization
    {$ifdef FreeBSD}
      set_source_info(system_x86_64_FreeBSD_info);
    {$endif}
+   {$ifdef OpenBSD}
+     set_source_info(system_x86_64_OpenBSD_info);
+   {$endif}
+   {$ifdef NetBSD}
+     set_source_info(system_x86_64_NetBSD_info);
+   {$endif}
    {$ifdef Darwin}
      set_source_info(system_x86_64_darwin_info);
    {$endif}

+ 10 - 2
compiler/systems/t_bsd.pas

@@ -188,9 +188,9 @@ begin
      else
        DllCmd[2]:='strip -x $EXE';
      { OpenBSD seems to use a wrong dynamic linker by default }
-     if target_info.system = system_i386_openbsd then
+     if target_info.system in systems_openbsd then
       DynamicLinker:='/usr/libexec/ld.so'
-     else if target_info.system = system_i386_netbsd then
+     else if target_info.system in systems_netbsd then
       DynamicLinker:='/usr/libexec/ld.elf_so'
      else
        DynamicLinker:='';
@@ -843,6 +843,14 @@ initialization
   RegisterImport(system_x86_64_freebsd,timportlibbsd);
   RegisterExport(system_x86_64_freebsd,texportlibbsd);
   RegisterTarget(system_x86_64_freebsd_info);
+  RegisterExternalLinker(system_x86_64_OpenBSD_info,TLinkerBSD);
+  RegisterImport(system_x86_64_openbsd,timportlibbsd);
+  RegisterExport(system_x86_64_openbsd,texportlibbsd);
+  RegisterTarget(system_x86_64_openbsd_info);
+  RegisterExternalLinker(system_x86_64_NetBSD_info,TLinkerBSD);
+  RegisterImport(system_x86_64_netbsd,timportlibbsd);
+  RegisterExport(system_x86_64_netbsd,texportlibbsd);
+  RegisterTarget(system_x86_64_netbsd_info);
 
   RegisterExternalLinker(system_x86_64_darwin_info,TLinkerBSD);
   RegisterImport(system_x86_64_darwin,timportlibdarwin);

+ 3 - 1
compiler/utils/ppudump.pp

@@ -146,7 +146,9 @@ const
   { 67 }  'Linux-MIPSel',
   { 68 }  'NativeNT-i386',
   { 69 }  'iPhoneSim-i386',
-  { 70 }  'Wii-powerpc'
+  { 70 }  'Wii-powerpc',
+  { 71 }  'OpenBSD-x86-64',
+  { 72 }  'NetBSD-x86-64'
   );
 
 const

+ 3 - 1
compiler/x86/agx86att.pas

@@ -333,7 +333,9 @@ interface
             idtxt  : 'AS';
             asmbin : 'as';
             asmcmd : '--64 -o $OBJ $ASM';
-            supported_targets : [system_x86_64_linux,system_x86_64_freebsd,system_x86_64_win64,system_x86_64_embedded];
+            supported_targets : [system_x86_64_linux,system_x86_64_freebsd,
+                                 system_x86_64_win64,system_x86_64_embedded,
+                                 system_x86_64_openbsd,system_x86_64_netbsd];
             flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf];
             labelprefix : '.L';
             comment : '# ';

+ 1 - 1
rtl/bsd/i386/syscall.inc

@@ -89,7 +89,7 @@ function FpSysCall(sysnr,param1:TSysParam):TSysResult; oldfpccall; assembler;[pu
 function FpSysCall(sysnr,param1:integer):TSysResult; oldfpccall;assembler;[public,alias:'FPC_DOSYS1w'];
 
  asm
-  movl  sysnr,%eax
+  movswl  sysnr,%eax
   pushw Param1
   call  actualsyscall
   add   $2,%esp

+ 1 - 1
rtl/bsd/ossysc.inc

@@ -310,7 +310,7 @@ function Fpsigaction(sig: cint; act, oact: psigactionrec): cint; [public, alias
 }
 
 begin
-  do_syscall(syscall_nr_sigaction,TSysParam(sig),TSysParam(act),TSysParam(oact));
+  fpsigaction:=do_syscall(syscall_nr_sigaction,TSysParam(sig),TSysParam(act),TSysParam(oact));
 end;
 
 (*=================== MOVED from sysunix.inc ========================*)

+ 77 - 3
rtl/netbsd/signal.inc

@@ -136,7 +136,7 @@ type sigset_t = array[0..3] of cardinal;
 
     PSigContextRec = ^SigContextRec;
     PSigContext = ^SigContextRec;
-{
+(*
 struct sigcontext {
 	int	sc_gs;
 	int	sc_fs;
@@ -164,8 +164,9 @@ struct sigcontext {
 
 	sigset_t sc_mask;		/* signal mask to restore (new style) */
 };
-}
-    SigContextRec = record
+*)
+{$ifdef i386}
+     SigContextRec = record
        sc_gs        : longint;   { machine state (struct trapframe): }
        sc_fs        : longint;
        sc_es        : longint;
@@ -205,6 +206,79 @@ struct sigcontext {
        fpr_ex_sw    : cardinal;
        fpr_pad      : array[0..63] of char; *)
        end;
+{$endif}
+(* From amd64 /usr/include/machine/frame_regs.h
+/*
+ * General register state
+ */
+#define GREG_OFFSETS(reg, REG, idx) _REG_##REG = idx,
+enum { _FRAME_GREG(GREG_OFFSETS) _NGREG = 26 };
+#undef GREG_OFFSETS
+
+#define _FRAME_REG(greg, freg) 	\
+	greg(rdi, RDI, 0)	\
+	greg(rsi, RSI, 1)	\
+	greg(rdx, RDX, 2)	\
+	greg(r10, R10, 6)	\
+	greg(r8,  R8,  4)	\
+	greg(r9,  R9,  5)	\
+	freg(arg6, @,  @)	/* syscall arg from stack */ \
+	freg(arg7, @,  @)	/* syscall arg from stack */ \
+	freg(arg8, @,  @)	/* syscall arg from stack */ \
+	freg(arg9, @,  @)	/* syscall arg from stack */ \
+	greg(rcx, RCX, 3)	\
+	greg(r11, R11, 7)	\
+	greg(r12, R12, 8)	\
+	greg(r13, R13, 9)	\
+	greg(r14, R14, 10)	\
+	greg(r15, R15, 11)	\
+	greg(rbp, RBP, 12)	\
+	greg(rbx, RBX, 13)	\
+	greg(rax, RAX, 14)	\
+	greg(gs,  GS,  15)	\
+	greg(fs,  FS,  16)	\
+	greg(es,  ES,  17)	\
+	greg(ds,  DS,  18)	\
+	greg(trapno, TRAPNO, 19)	\
+	/* below portion defined in hardware */ \
+	greg(err, ERR, 20)	/* Dummy inserted if not defined */ \
+	greg(rip, RIP, 21)	\
+	greg(cs,  CS,  22)	\
+	greg(rflags, RFLAGS, 23)	\
+	/* These are pushed unconditionally on the x86-64 */ \
+	greg(rsp, RSP, 24)	\
+	greg(ss,  SS,  25)
+*)
+{$ifdef X86_64}
+        SigContextRec = record
+	sc_rdi : clong;
+	sc_rsi : clong;
+        sc_rdx : clong;
+	sc_rcx : clong;
+	sc_r8  : clong;
+	sc_r9  : clong;
+	sc_r10 : clong;
+	sc_r11 : clong;
+	sc_r12 : clong;
+	sc_r13 : clong;
+	sc_r14 : clong;
+	sc_r15 : clong;
+	sc_rbp : clong;
+	sc_rbx : clong;
+	sc_rax : clong;
+	sc_gs  : clong;
+	sc_fs  : clong;
+	sc_es  : clong;
+	sc_ds  : clong;
+	sc_trapno : clong;
+	sc_err : clong;
+	sc_rip : clong;
+	sc_cs  : clong;
+	sc_rflags : clong;
+	sc_rsp : clong;
+	sc_ss  : clong;
+	end;
+{$endif def x86_64}
 
   SignalHandler   = Procedure(Sig : Longint);cdecl;
   PSignalHandler  = ^SignalHandler;

+ 35 - 2
rtl/netbsd/unxsysc.inc

@@ -93,8 +93,8 @@ Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; oldfpcc
   If the operation was unsuccesful, linuxerror is set.
 }
 
-begin
 {$ifdef cpui386}
+begin
  asm
    mov $42,%eax
    int $0x80
@@ -113,8 +113,41 @@ begin
    mov Errn,%edx
    mov %ebx,(%edx)
  end;
-{$endif}
 end;
+{$else}
+{$ifdef cpux86_64}
+begin
+ asm
+   mov $42,%eax
+   syscall
+   jb .Lerror
+   mov pipe_in,%rbx
+   mov %eax,(%rbx)
+   mov pipe_out,%rbx
+   mov $0,%rax
+   mov %edx,(%rbx)
+   mov %rax,%rbx
+   jmp .Lexit
+.Lerror:
+   mov %eax,%ebx
+   mov $-1,%eax
+.Lexit:
+   mov Errn,%rdx
+   mov %ebx,(%rdx)
+ end;
+end;
+{$else}
+  var fildes : tfildes;
+begin
+  fildes[0]:=pipe_in;
+  fildes[1]:=pipe_out;
+  errn:=do_syscall(syscall_nr_pipe,TSysParam(@fildes));
+  pipe_in:=fildes[0];
+  pipe_out:=fildes[1];
+  intAssignPipe:=errn;
+end;
+{$endif}
+{$endif}
 
 
 {

+ 4 - 4
rtl/openbsd/x86_64/cprt0.as

@@ -47,7 +47,7 @@ ___start:
 	movq	%r9, -64(%rbp)
 	movq	-40(%rbp), %rax
 	movq	%rax, environ(%rip)
-	movq    %rax,operatingsystem_parameter_envp
+	movq    %rax,operatingsystem_parameter_envp(%rip)
 	movq	-32(%rbp), %rax
 	movq	(%rax), %rax
 	movq	%rax, -8(%rbp)
@@ -103,8 +103,8 @@ ___start:
 	movq	environ(%rip), %rdx
 	movq	-32(%rbp), %rsi
 	movl	-20(%rbp), %edi
-	movq    %rdi,operatingsystem_parameter_argc
-	movq    %rsi,operatingsystem_parameter_argv
+	movq    %rdi,operatingsystem_parameter_argc(%rip)
+	movq    %rsi,operatingsystem_parameter_argv(%rip)
 	movl	$0, %eax
 	call	main
 	# movl	%eax, %edi
@@ -117,7 +117,7 @@ ___start:
 
 _haltproc:
            movq $1,%rax
-           movzwq operatingsystem_result,%rbx
+           movzwq operatingsystem_result(%rip),%rbx
            pushq   %rbx
            call .Lactualsyscall
            addq  $8,%rsp

+ 4 - 4
rtl/openbsd/x86_64/prt0.as

@@ -47,7 +47,7 @@ ___start:
 	movq	%r9, -64(%rbp)
 	movq	-40(%rbp), %rax
 	movq	%rax, environ(%rip)
-	movq    %rax,operatingsystem_parameter_envp
+	movq    %rax,operatingsystem_parameter_envp(%rip)
 	movq	-32(%rbp), %rax
 	movq	(%rax), %rax
 	movq	%rax, -8(%rbp)
@@ -103,8 +103,8 @@ ___start:
 	movq	environ(%rip), %rdx
 	movq	-32(%rbp), %rsi
 	movl	-20(%rbp), %edi
-	movq    %rdi,operatingsystem_parameter_argc
-	movq    %rsi,operatingsystem_parameter_argv
+	movq    %rdi,operatingsystem_parameter_argc(%rip)
+	movq    %rsi,operatingsystem_parameter_argv(%rip)
 	movl	$0, %eax
 	call	main
 	# movl	%eax, %edi
@@ -117,7 +117,7 @@ ___start:
 
 _haltproc:
            movq $1,%rax
-           movzwq operatingsystem_result,%rbx
+           movzwq operatingsystem_result(%rip),%rbx
            pushq   %rbx
            call .Lactualsyscall
            addq  $8,%rsp