* fixed FPC_USE_LIBC building for Linux and exception handling (mantis #13450)

- fixed a platform modifier in ipc.pp
   - fixed different layout sigaction record in libc. (field order)
   - fixed many bad use_libc fixes in linux. Most of these were only checked
      for compilation, not linking. (e.g. futex doesn't link)

git-svn-id: trunk@18042 -
This commit is contained in:
marco 2011-07-31 23:36:17 +00:00
parent 4392dd13a4
commit 2c00a2a0b3
3 changed files with 24 additions and 9 deletions

View File

@ -105,14 +105,16 @@ const
function futex(uaddr:Pcint;op,val:cint;timeout:Ptimespec;addr2:Pcint;val3:cint):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
function futex(var uaddr;op,val:cint;timeout:Ptimespec;var addr2;val3:cint):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
function futex(var uaddr;op,val:cint;var timeout:Ttimespec;var addr2;val3:cint):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
{$else}
function futex(uaddr:Pcint;op,val:cint;timeout:Ptimespec;addr2:Pcint;val3:cint):cint; cdecl; external name 'futex';
function futex(var uaddr;op,val:cint;timeout:Ptimespec;var addr2;val3:cint):cint; cdecl; external name 'futex';
function futex(var uaddr;op,val:cint;var timeout:Ttimespec;var addr2;val3:cint):cint; cdecl; external name 'futex';
{$endif}
// general aliases:
function futex(uaddr:Pcint;op,val:cint;timeout:Ptimespec):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
function futex(var uaddr;op,val:cint;timeout:Ptimespec):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
function futex(var uaddr;op,val:cint;var timeout:Ttimespec):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
{$else}
// futex is currently not exposed by glibc
//function futex(uaddr:Pcint;op,val:cint;timeout:Ptimespec;addr2:Pcint;val3:cint):cint; cdecl; external name 'futex';
//function futex(var uaddr;op,val:cint;timeout:Ptimespec;var addr2;val3:cint):cint; cdecl; external name 'futex';
//function futex(var uaddr;op,val:cint;var timeout:Ttimespec;var addr2;val3:cint):cint; cdecl; external name 'futex';
{$endif}
{$ifndef FPC_USE_LIBC}
function futex_op(op, oparg, cmp, cmparg: cint): cint; {$ifdef SYSTEMINLINE}inline;{$endif}
@ -204,6 +206,7 @@ type
function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; {$ifdef FPC_USE_LIBC} cdecl; external name 'clone'; {$endif}
{$endif}
{$ifndef FPC_USE_LIBC}
{$if defined(cpui386) or defined(cpux86_64)}
const
MODIFY_LDT_CONTENTS_DATA = 0;
@ -234,6 +237,7 @@ type
function modify_ldt(func:cint;p:pointer;bytecount:culong):cint;
{$endif cpui386 or cpux86_64}
{$endif}
procedure sched_yield; {$ifdef FPC_USE_LIBC} cdecl; external name 'sched_yield'; {$endif}
@ -532,7 +536,7 @@ end;
{$else}
{Libc case.}
(*
function futex(uaddr:Pcint;op,val:cint;timeout:Ptimespec):cint;{$ifdef SYSTEMINLINE}inline;{$endif}
begin
@ -550,9 +554,10 @@ function futex(var uaddr;op,val:cint;var timeout:Ttimespec):cint;{$ifdef SYSTEMI
begin
futex:=futex(@uaddr,op,val,@timeout,nil,0);
end;
*)
{$endif} // non-libc
{$ifndef FPC_USE_LIBC}
{$if defined(cpui386) or defined(cpux86_64)}
{ does not exist as a wrapper in glibc, and exists only for x86 }
function modify_ldt(func:cint;p:pointer;bytecount:culong):cint;
@ -563,6 +568,7 @@ begin
Tsysparam(bytecount));
end;
{$endif}
{$endif}
{ FUTEX_OP is a macro, doesn't exist in libC as function}
function FUTEX_OP(op, oparg, cmp, cmparg: cint): cint; {$ifdef SYSTEMINLINE}inline;{$endif}

View File

@ -195,10 +195,19 @@ type
tsigrestorerhandler = sigrestorerhandler_t;
psigactionrec = ^sigactionrec;
{$ifdef FPC_USE_LIBC} // libc order is different ?
sigactionrec = record
sa_handler: sigactionhandler_t;
sa_mask: sigset_t;
sa_flags: cint;
sa_restorer: sigrestorerhandler_t;
end;
{$else}
sigactionrec = record
sa_handler: sigactionhandler_t;
sa_flags: culong;
sa_restorer: sigrestorerhandler_t;
sa_mask: sigset_t;
end;
{$endif}

View File

@ -551,7 +551,7 @@ Function semget(key:Tkey; nsems:cint; semflg:cint): cint; {$ifdef FPC_USE_LIBC}
Function semop(semid:cint; sops: psembuf; nsops: cuint): cint; {$ifdef FPC_USE_LIBC} cdecl; external clib name 'semop'; {$endif}
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): cint;
{$ifdef linux}
Function semtimedop(semid:cint; sops: psembuf; nsops: cuint; timeOut: ptimespec): cint; platform; {$ifdef FPC_USE_LIBC} cdecl; external name 'semtimedop'; {$endif}
Function semtimedop(semid:cint; sops: psembuf; nsops: cuint; timeOut: ptimespec): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'semtimedop'; platform; {$else} platform; {$endif}
{$endif}
implementation