Changeset View
Changeset View
Standalone View
Standalone View
lang/fpc/files/patch-rtl_freebsd_aarch64_signal
diff --git a/rtl/freebsd/aarch64/bsyscall.inc b/rtl/freebsd/aarch64/bsyscall.inc | |||||
new file mode 100644 | |||||
index 00000000..c690ebeb | |||||
--- /dev/null | |||||
+++ rtl/freebsd/aarch64/bsyscall.inc | |||||
@@ -0,0 +1 @@ | |||||
+{ nothing } | |||||
diff --git a/rtl/freebsd/aarch64/si_c.inc b/rtl/freebsd/aarch64/si_c.inc | |||||
new file mode 100644 | |||||
index 00000000..f629e50a | |||||
--- /dev/null | |||||
+++ rtl/freebsd/aarch64/si_c.inc | |||||
@@ -0,0 +1,89 @@ | |||||
+ | |||||
+Type | |||||
+ TCleanup = procedure; cdecl; | |||||
+ | |||||
+var | |||||
+ environ : ppchar; cvar; public name '__environ'; | |||||
+ progname: pchar = #0#0; cvar; public name '__progname'; | |||||
+ dynamic : pchar; external name '_DYNAMIC'; // #pragma weak | |||||
+ | |||||
+procedure atexit(prc:TCleanup); cdecl external name 'atexit'; | |||||
+procedure cleanup(prc:TCleanup); cdecl external name 'cleanup'; | |||||
+procedure init_tls; cdecl; external name 'init_tls'; | |||||
+procedure fini; cdecl; external name '_fini'; | |||||
+procedure init; cdecl; external name '_init'; | |||||
+procedure libc_exit(exitcode:longint);cdecl; external name 'exit'; | |||||
+function main(nrarg:longint;pp:ppchar;env:ppchar):longint; cdecl; external name 'main'; | |||||
+ | |||||
+{$ifdef gcrt} | |||||
+ procedure cmcleanup; cdecl; external name '_mcleanup'; | |||||
+ procedure monstratup(p,p2:pointer); cdecl; external name 'monstartup'; | |||||
+ | |||||
+var | |||||
+ eprol:longint; external name 'eprol'; | |||||
+ etext:longint; external name 'etext'; | |||||
+{$endif} | |||||
+ | |||||
+procedure start(ap:ppchar;cleanup:TCleanup); | |||||
+ | |||||
+var argc: longint; | |||||
+ argv: ppchar; | |||||
+ env : ppchar; | |||||
+ s : pchar; | |||||
+begin | |||||
+ argc:=plongint(ap)^; | |||||
+ argv:=ppchar(ap[1]); | |||||
+ env:= ppchar(ap[2+argc]); | |||||
+ environ:=env; | |||||
+ if (argc>0) and (argv[0]<>#0) Then | |||||
+ begin | |||||
+ progname:=argv[0]; | |||||
+ s:=progname; | |||||
+ while s^<>#0 do | |||||
+ begin | |||||
+ if s^='/' then | |||||
+ progname:=@s[1]; | |||||
+ inc(s); | |||||
+ end; | |||||
+ end; | |||||
+ if assigned(pchar(@dynamic)) then // I suspect this is a trick to find | |||||
+ // out runtime if we are shared | |||||
+ // linking, so the same code can be used | |||||
+ // for static and shared linking | |||||
+ atexit(cleanup) | |||||
+ else | |||||
+ init_tls; | |||||
+ {$ifdef GCRT} | |||||
+ atexit(@_mcleanup); | |||||
+ {$endif} | |||||
+ atexit(@fini); | |||||
+ {$ifdef GCRT} | |||||
+ monstartup(@eprol,@etext); | |||||
+ asm | |||||
+ eprol: | |||||
+ end; | |||||
+ {$endif} | |||||
+ init; | |||||
+ libc_exit(main(argc,argv,env)); // doesn't return | |||||
+ asm | |||||
+ { We need this stuff to make gdb behave itself, otherwise | |||||
+ gdb will chokes with SIGILL when trying to debug apps. | |||||
+ } | |||||
+ .section ".note.ABI-tag", "a" | |||||
+ .align 4 | |||||
+ .long 8 | |||||
+ .long 4 | |||||
+ .long 1 | |||||
+ .asciz "FreeBSD" | |||||
+ .align 4 | |||||
+ .long 900044 | |||||
+ .align 4 | |||||
+ .section .note.GNU-stack,"",@progbits | |||||
+ end; | |||||
+end; | |||||
+ | |||||
+ | |||||
+ | |||||
+begin | |||||
+end. | |||||
+ | |||||
diff --git a/rtl/freebsd/aarch64/sighnd.inc b/rtl/freebsd/aarch64/sighnd.inc | |||||
new file mode 100644 | |||||
index 00000000..cd4f5e55 | |||||
--- /dev/null | |||||
+++ rtl/freebsd/aarch64/sighnd.inc | |||||
@@ -0,0 +1,43 @@ | |||||
+{ | |||||
+ 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; UContext: PUContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl; } | |||||
+procedure SignalToRunerror(Sig: cint; info : psiginfo; SigContext:PSigContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl; | |||||
+ | |||||
+var | |||||
+ res : word; | |||||
+begin | |||||
+ res:=0; | |||||
+ case sig of | |||||
+ SIGFPE: | |||||
+ res:=207; | |||||
+ SIGILL: | |||||
+ res:=216; | |||||
+ SIGSEGV : | |||||
+ res:=216; | |||||
+ SIGBUS: | |||||
+ res:=214; | |||||
+ SIGINT: | |||||
+ res:=217; | |||||
+ SIGQUIT: | |||||
+ res:=233; | |||||
+ end; | |||||
+ reenable_signal(sig); | |||||
+ { give runtime error at the position where the signal was raised } | |||||
+ if res<>0 then | |||||
+ HandleError(res); | |||||
+end; |