Browse Source

- Port RISC-V64 startup code to native inline routines.

git-svn-id: trunk@41871 -
Jeppe Johansen 6 years ago
parent
commit
53542b7c5e

+ 3 - 4
.gitattributes

@@ -9795,10 +9795,9 @@ rtl/linux/riscv32/syscall.inc svneol=native#text/plain
 rtl/linux/riscv32/syscallh.inc svneol=native#text/plain
 rtl/linux/riscv32/sysnr.inc svneol=native#text/plain
 rtl/linux/riscv64/bsyscall.inc svneol=native#text/plain
-rtl/linux/riscv64/cprt0.as svneol=native#text/plain
-rtl/linux/riscv64/dllprt0.as svneol=native#text/plain
-rtl/linux/riscv64/gprt0.as svneol=native#text/plain
-rtl/linux/riscv64/prt0.as svneol=native#text/plain
+rtl/linux/riscv64/si_c.inc svneol=native#text/plain
+rtl/linux/riscv64/si_dll.inc svneol=native#text/plain
+rtl/linux/riscv64/si_prc.inc svneol=native#text/plain
 rtl/linux/riscv64/sighnd.inc svneol=native#text/plain
 rtl/linux/riscv64/sighndh.inc svneol=native#text/plain
 rtl/linux/riscv64/stat.inc svneol=native#text/plain

+ 2 - 1
compiler/systems.pas

@@ -352,7 +352,8 @@ interface
                                    system_i386_linux,system_powerpc64_linux,system_sparc64_linux,system_x86_64_linux,
                                    system_m68k_atari,system_m68k_palmos,
                                    system_i386_haiku,system_x86_64_haiku,
-                                   system_i386_openbsd,system_x86_64_openbsd
+                                   system_i386_openbsd,system_x86_64_openbsd,
+                                   system_riscv32_linux,system_riscv64_linux
                                   ]+systems_darwin+systems_amigalike;
 
        { all systems that use garbage collection for reference-counted types }

+ 2 - 1
rtl/linux/Makefile

@@ -359,7 +359,8 @@ override LOADERS=
 SYSINIT_UNITS=si_prc si_c si_g si_dll
 endif
 ifeq ($(ARCH),riscv64)
-override LOADERS=prt0 cprt0 dllprt0
+override LOADERS=
+SYSINIT_UNITS=si_prc si_dll si_c
 endif
 ifeq ($(ARCH),mipsel)
 override FPCOPT+=-Ur

+ 2 - 1
rtl/linux/Makefile.fpc

@@ -91,7 +91,8 @@ SYSINIT_UNITS=si_prc si_c si_g si_dll
 endif
 
 ifeq ($(ARCH),riscv64)
-override LOADERS=prt0 cprt0 dllprt0
+override LOADERS=
+SYSINIT_UNITS=si_prc si_dll si_c
 endif
 
 # mipsel reuses mips files by including so some file names exist

+ 0 - 142
rtl/linux/riscv64/cprt0.as

@@ -1,142 +0,0 @@
-/* Startup code for ARM & ELF
-   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA. */
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.
-
-        Note that the code in the .init section has already been run.
-        This includes _init and _libc_init
-
-
-        At this entry point, most registers' values are unspecified, except:
-
-   a0           Contains a function pointer to be registered with `atexit'.
-                This is how the dynamic linker arranges to have DT_FINI
-                functions called for shared libraries that have been loaded
-                before this code runs.
-
-   sp           The stack contains the arguments and environment:
-                0(sp)                   argc
-                8(sp)                   argv[0]
-                ...
-                (8*argc)(sp)            NULL
-                (8*(argc+1))(sp)        envp[0]
-                ...
-                                        NULL
-*/
-
-        .text
-        .globl _start
-        .type _start,function
-_start:
-        .option push
-        .option norelax
-1:auipc gp, %pcrel_hi(__global_pointer$)
-        addi  gp, gp, %pcrel_lo(1b)
-        .option pop
-
-        /* Store rtld_fini in a5 */
-        addi a5, a0, 0
-
-        /* Clear the frame pointer since this is the outermost frame.  */
-        addi x8, x0, 0
-
-        /* Pop argc off the stack, and save argc, argv and envp */
-        ld   a1, 0(sp)
-        addi a2, sp, 8
-        addi a4, a1, 1
-        slli a4, a4, 3
-        add  a4, a2, a4
-
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argc)
-	sw	a1,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argv)
-	sd	a2,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_envp)
-	sd	a4,%pcrel_lo(1b)(x8)
-
-        /* Save initial stackpointer */
-1:auipc	x8,%pcrel_hi(__stkptr)
-	sd	sp,%pcrel_lo(1b)(x8)
-
-        /* Fetch address of fini */
-1:auipc	x8,%pcrel_hi(__libc_csu_fini)
-	addi	a4,x8,%pcrel_lo(1b)
-
-        addi a6, sp, 0
-
-        /* Set up the other arguments in registers */
-1:auipc	x8,%pcrel_hi(PASCALMAIN)
-	addi a0, x8, %pcrel_lo(1b)
-1:auipc	x8,%pcrel_hi(__libc_csu_init)
-	addi a3, x8, %pcrel_lo(1b)
-
-        /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
-
-        /* Let the libc call main and exit with its return code.  */
-1:auipc	x8,%pcrel_hi(__libc_start_main)
-        jalr ra, x8, %pcrel_lo(1b)
-
-        /* should never get here....*/
-1:auipc	x8,%pcrel_hi(abort)
-        jalr ra, x8, %pcrel_lo(1b)
-
-        .globl  _haltproc
-        .type   _haltproc,function
-_haltproc:
-1:auipc	x8,%pcrel_hi(operatingsystem_result)
-	lbu	x1,%pcrel_lo(1b)(x8)
-	addi	x17, x0, 94
-	ecall
-        jal x0, _haltproc
-
-        /* Define a symbol for the first piece of initialized data.  */
-        .data
-        .globl __data_start
-__data_start:
-        .long 0
-        .weak data_start
-        data_start = __data_start
-
-.bss
-        .comm __stkptr,8
-
-        .comm operatingsystem_parameter_envp,8
-        .comm operatingsystem_parameter_argc,4
-        .comm operatingsystem_parameter_argv,8
-
-        .section ".comment"
-        .byte 0
-        .ascii "generated by FPC http://www.freepascal.org\0"
-
-/* 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 1f - 0f
-        .long 3f - 2f
-        .long  1
-0:      .asciz "GNU"
-1:      .align 4
-2:      .long 0
-        .long 2,0,0
-3:      .align 4
-
-.section .note.GNU-stack,"",%progbits

+ 0 - 76
rtl/linux/riscv64/dllprt0.as

@@ -1,76 +0,0 @@
-/*
- * This file is part of the Free Pascal run time library.
- * Copyright (c) 2011 by Thomas Schatzl,
- * member of the Free Pascal development team.
- *
- * Startup code for shared libraries, ARM version.
- *
- * 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.
- */
-
-.file   "dllprt0.as"
-.text
-        .globl  _startlib
-        .type   _startlib,function
-_startlib:
-        .globl  FPC_SHARED_LIB_START
-        .type   FPC_SHARED_LIB_START,function
-FPC_SHARED_LIB_START:
-        addi sp, sp, -16
-        sd ra, 8(sp)
-        sd x8, 0(sp)
-        addi x8, sp, 16
-
-        /* a0 contains argc, a1 contains argv and a2 contains envp */
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argc)
-	sw	a0,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argv)
-	sd	a1,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_envp)
-	sd	a2,%pcrel_lo(1b)(x8)
-
-        /* save initial stackpointer */
-1:auipc	x8,%pcrel_hi(__stklen)
-	sd	sp,%pcrel_lo(1b)(x8)
-
-        /* call main and exit normally */
-1:auipc	x8,%pcrel_hi(PASCALMAIN)
-        jalr ra, x8, %pcrel_lo(1b)
-
-        ld x8, 0(x8)
-        ld ra, 8(x8)
-        addi sp, sp, 16
-
-        jalr x0, ra
-
-        .globl  _haltproc
-        .type   _haltproc,function
-_haltproc:
-1:auipc	x8,%pcrel_hi(operatingsystem_result)
-	lbu	x1,%pcrel_lo(1b)(x8)
-	addi	x17, x0, 94
-	ecall
-        jal x0, _haltproc
-
-.data
-
-        .type operatingsystem_parameters,object
-        .size operatingsystem_parameters, 24
-operatingsystem_parameters:
-        .skip 3 * 8
-        .global operatingsystem_parameter_argc
-        .global operatingsystem_parameter_argv
-        .global operatingsystem_parameter_envp
-        .set operatingsystem_parameter_argc, operatingsystem_parameters+0
-        .set operatingsystem_parameter_argv, operatingsystem_parameters+8
-        .set operatingsystem_parameter_envp, operatingsystem_parameters+16
-
-.bss
-
-        .comm __stkptr,8
-

+ 0 - 162
rtl/linux/riscv64/gprt0.as

@@ -1,162 +0,0 @@
-/* Startup code for ARM & ELF
-   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA. */
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.
-
-        Note that the code in the .init section has already been run.
-        This includes _init and _libc_init
-
-
-        At this entry point, most registers' values are unspecified, except:
-
-   a1           Contains a function pointer to be registered with `atexit'.
-                This is how the dynamic linker arranges to have DT_FINI
-                functions called for shared libraries that have been loaded
-                before this code runs.
-
-   sp           The stack contains the arguments and environment:
-                0(sp)                   argc
-                4(sp)                   argv[0]
-                ...
-                (4*argc)(sp)            NULL
-                (4*(argc+1))(sp)        envp[0]
-                ...
-                                        NULL
-*/
-
-        .text
-        .globl _start
-        .type _start,#function
-_start:
-        /* Clear the frame pointer since this is the outermost frame.  */
-        addi x8, x0, 0
-        ld a2, (sp)
-        addi sp, sp, 4
-
-        /* Pop argc off the stack and save a pointer to argv */
-        la x5, operatingsystem_parameter_argc
-        la x6,operatingsystem_parameter_argv
-        sd a2, (x5)
-
-        /* calc envp */
-        addi a4,a2,1
-        slli a4,a4,3
-        add  a4,sp,a4
-        la x5, operatingsystem_parameter_envp
-
-        sd sp,(a3)
-        sd a4,(x5)
-
-        /* Save initial stackpointer */
-        la x5,__stkptr
-        sd sp, (x5)
-
-        /* Initialize gmon */
-        mov     r2,#1
-        ldr     r1,=_etext
-        ldr     r0,=_start
-        bl      __monstartup
-        ldr     r0,=_mcleanup
-        bl      atexit
-
-        /* argc already loaded to a2*/
-        ldr ip, =operatingsystem_parameter_argc
-        ldr a2,[ip]
-
-        /* Fetch address of fini */
-        ldr ip, =_fini
-
-        /* load argv */
-        mov a3, sp
-
-        /* Push stack limit */
-        str a3, [sp, #-4]!
-
-        /* Push rtld_fini */
-        str a1, [sp, #-4]!
-
-        /* Set up the other arguments in registers */
-        ldr a1, =PASCALMAIN
-        ldr a4, =_init
-
-        /* Push fini */
-        str ip, [sp, #-4]!
-
-        /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
-
-        /* Let the libc call main and exit with its return code.  */
-        bl __libc_start_main
-
-        /* should never get here....*/
-        bl abort
-
-        .globl  _haltproc
-    .type   _haltproc,#function
-_haltproc:
-        ldr r0,=operatingsystem_result
-        ldrb r0,[r0]
-        swi 0x900001
-        b _haltproc
-
-        .globl  _haltproc_eabi
-        .type   _haltproc_eabi,#function
-_haltproc_eabi:
-        bl exit  /* libc exit */
-
-        ldr r0,=operatingsystem_result
-        ldrb r0,[r0]
-        mov r7,#248
-        swi 0x0
-        b _haltproc_eabi
-
-        /* Define a symbol for the first piece of initialized data.  */
-        .data
-        .globl __data_start
-__data_start:
-        .long 0
-        .weak data_start
-        data_start = __data_start
-
-.bss
-        .comm __stkptr,4
-
-        .comm operatingsystem_parameter_envp,4
-        .comm operatingsystem_parameter_argc,4
-        .comm operatingsystem_parameter_argv,4
-
-        .section ".comment"
-        .byte 0
-        .ascii "generated by FPC http://www.freepascal.org\0"
-
-/* 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 1f - 0f
-        .long 3f - 2f
-        .long  1
-0:      .asciz "GNU"
-1:      .align 4
-2:      .long 0
-        .long 2,0,0
-3:      .align 4
-
-.section .note.GNU-stack,"",%progbits

+ 0 - 85
rtl/linux/riscv64/prt0.as

@@ -1,85 +0,0 @@
-/*
-   Start-up code for Free Pascal Compiler, not in a shared library,
-   not linking with C library.
-
-   Written by Edmund Grimley Evans in 2015 and released into the public domain.
-*/
-
-	.text
-	.align 2
-
-	.globl _dynamic_start
-	.type  _dynamic_start, function
-_dynamic_start:
-1:
-	auipc	x5,%pcrel_hi(__dl_fini)
-	sd	x10, %pcrel_lo(1b)(x5)
-	jal	x0, _start
-
-	.globl	_start
-	.type	_start, function
-_start:
-	.option push
-	.option norelax
-1:  auipc gp, %pcrel_hi(__bss_start+0x800)
-	addi  gp, gp, %pcrel_lo(1b)
-	.option pop
-  
-	/* Get argc, argv, envp */
-	ld		x5,(x2)
-	addi	x6,x2,8
-	addi	x7,x5,1
-	slli    x7,x7,3
-	add 	x7,x6,x7
-
-	/* Save argc, argv, envp, and initial stack pointer */
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argc)
-	sw	x5,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_argv)
-	sd	x6,%pcrel_lo(1b)(x8)
-1:auipc	x8,%pcrel_hi(operatingsystem_parameter_envp)
-	sd	x7,%pcrel_lo(1b)(x8)
-1:auipc	x5,%pcrel_hi(__stkptr)
-	addi	x6, x2, 0
-	sd	x6,%pcrel_lo(1b)(x5)
-	
-	/* Initialise FP to zero */
-	addi	x8,x0,0
-
-	/* Call main */
-	jal x1, PASCALMAIN
-
-	.globl	_haltproc
-	.type	_haltproc,function
-_haltproc:
-1:auipc x10,%pcrel_hi(__dl_fini)
-	ld	x10,%pcrel_lo(1b)(x10)
-	beq	x10,x0,.Lexit
-	jalr x1,x10
-.Lexit:
-1:auipc x10,%pcrel_hi(operatingsystem_result)
-	ld	x10,%pcrel_lo(1b)(x10)
-	addi	x17, x0, 94
-	ecall
-	jal x0, _haltproc
-
-	/* Define a symbol for the first piece of initialized data. */
-	.data
-	.align 4
-	.globl __data_start
-__data_start:
-	.quad 0
-	.weak data_start
-	data_start = __data_start
-
-	.bss
-	.align 4
-
-	.comm __dl_fini,8
-	.comm __stkptr,8
-
-	.comm operatingsystem_parameter_envp,8
-	.comm operatingsystem_parameter_argc,4
-	.comm operatingsystem_parameter_argv,8
-
-	.section .note.GNU-stack,"",%progbits

+ 81 - 0
rtl/linux/riscv64/si_c.inc

@@ -0,0 +1,81 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2019 by Jeppe Johansen.
+
+    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.
+
+ **********************************************************************}
+
+{******************************************************************************
+                          Process start/halt
+ ******************************************************************************}
+
+var
+  dlexitproc : pointer;
+
+var
+  BSS_START: record end; external name '__bss_start';
+  STACK_PTR: record end; external name '__stkptr';
+
+  libc_init_proc: TProcedure; weakexternal name '_init';
+  libc_fini_proc: TProcedure; weakexternal name '_fini';
+
+procedure libc_start_main(main: TProcedure; argc: ptruint; argv: ppchar; init, fini, rtld_fini: TProcedure; stack_end: pointer); cdecl; external name '__libc_start_main';
+procedure libc_exit(code: ptruint); cdecl; external name 'exit';
+
+procedure _FPC_rv_enter(at_exit: TProcedure; sp: pptruint);
+  var
+    argc: ptruint;
+    argv: ppchar;
+  begin
+    argc:=sp[0];
+    argv:=@sp[1];
+
+    initialstkptr:=sp;
+    operatingsystem_parameter_argc:=argc;
+    operatingsystem_parameter_argv:=argv;
+    operatingsystem_parameter_envp:=@sp[1+argc];
+
+    libc_start_main(@PascalMain, argc, argv, libc_init_proc, libc_fini_proc, at_exit, sp);
+  end;
+
+
+procedure _FPC_proc_start; assembler; nostackframe; public name '_start';
+  asm
+    { set up GP }
+    .option push
+    .option norelax
+.L1:
+    auipc gp, %pcrel_hi(BSS_START+0x800)
+    addi  gp, gp, %pcrel_lo(.L1)
+    .option pop
+
+    { Initialise FP to zero }
+    addi fp, x0, 0
+
+    { atexit is in a0 }
+    addi a1, sp, 0
+    jal x1, _FPC_rv_enter
+  end;
+
+
+procedure _FPC_rv_exit(e:longint); assembler; nostackframe;
+  asm
+    addi  a7, x0, 94
+    ecall
+  end;
+
+
+procedure _FPC_proc_haltproc(e:longint); cdecl; public name '_haltproc';
+  begin
+    while true do
+      begin
+        libc_exit(e);
+        _FPC_rv_exit(e);
+      end;
+  end;

+ 38 - 0
rtl/linux/riscv64/si_dll.inc

@@ -0,0 +1,38 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2019 by Jeppe Johansen.
+
+    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.
+
+ **********************************************************************}
+
+
+{******************************************************************************
+                        Shared library start/halt
+ ******************************************************************************}
+
+procedure _FPC_shared_lib_start(argc : dword;argv,envp : pointer); cdecl; public name 'FPC_SHARED_LIB_START'; public name '_start';
+  begin
+
+    operatingsystem_parameter_argc:=argc;    { Copy the argument count      }
+    operatingsystem_parameter_argv:=argv;    { Copy the argument pointer    }
+    operatingsystem_parameter_envp:=envp;    { Copy the environment pointer }
+    initialstkptr:=get_frame;
+
+    PASCALMAIN;
+  end;
+
+{ this routine is only called when the halt() routine of the RTL embedded in
+  the shared library is called }
+procedure _FPC_shared_lib_haltproc(e:longint); cdecl; assembler; public name '_haltproc';
+  asm
+.L1:
+    addi  a7, x0, 94
+    ecall
+    jal x0, .L1
+  end;

+ 84 - 0
rtl/linux/riscv64/si_prc.inc

@@ -0,0 +1,84 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2019 by Jeppe Johansen.
+
+    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.
+
+ **********************************************************************}
+
+{******************************************************************************
+                          Process start/halt
+ ******************************************************************************}
+
+var
+  dlexitproc : pointer;
+
+var
+  BSS_START: record end; external name '__bss_start';
+  STACK_PTR: record end; external name '__stkptr';
+
+procedure _FPC_rv_enter(sp: pptruint);
+  var
+    argc: ptruint;
+  begin
+    argc:=sp[0];
+
+    initialstkptr:=sp;
+    operatingsystem_parameter_argc:=argc;
+    operatingsystem_parameter_argv:=@sp[1];
+    operatingsystem_parameter_envp:=@sp[1+argc];
+
+    PascalMain;
+  end;
+
+procedure _FPC_proc_start; assembler; nostackframe; public name '_start';
+  asm
+    { set up GP }
+    .option push
+    .option norelax
+.L1:
+    auipc gp, %pcrel_hi(BSS_START+0x800)
+    addi  gp, gp, %pcrel_lo(.L1)
+    .option pop
+
+    { Initialise FP to zero }
+    addi fp, x0, 0
+
+    addi a0, sp, 0
+    jal x1, _FPC_rv_enter
+  end;
+
+
+procedure _FPC_dynamic_proc_start; assembler; nostackframe; public name '_dynamic_start';
+  asm
+    .option push
+    .option norelax
+.L1:
+    auipc t0, %pcrel_hi(dlexitproc)
+    sd    a0, %pcrel_lo(.L1)(t0)
+    .option pop
+
+    jal   x0, _FPC_proc_start
+  end;
+
+
+procedure _FPC_rv_exit(e:longint); assembler; nostackframe;
+  asm
+.L1:
+    addi  a7, x0, 94
+    ecall
+    jal x0, .L1
+  end;
+
+
+procedure _FPC_proc_haltproc(e:longint); cdecl; public name '_haltproc';
+  begin
+    if assigned(dlexitproc) then
+      TProcedure(dlexitproc);
+    _FPC_rv_exit(e);
+  end;