diff --git a/.gitattributes b/.gitattributes index 1bf5372c69..f3db213cdb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8221,6 +8221,7 @@ rtl/netbsd/errno.inc svneol=native#text/plain rtl/netbsd/errnostr.inc svneol=native#text/plain rtl/netbsd/i386/bsyscall.inc svneol=native#text/plain rtl/netbsd/i386/cprt0.as svneol=native#text/plain +rtl/netbsd/i386/dllprt0.as svneol=native#text/plain rtl/netbsd/i386/prt0.as svneol=native#text/plain rtl/netbsd/i386/prt0_10.as svneol=native#text/plain rtl/netbsd/i386/sighnd.inc svneol=native#text/plain @@ -8248,6 +8249,7 @@ rtl/netbsd/unxsockh.inc svneol=native#text/plain rtl/netbsd/unxsysc.inc svneol=native#text/plain rtl/netbsd/x86_64/bsyscall.inc svneol=native#text/plain rtl/netbsd/x86_64/cprt0.as svneol=native#text/plain +rtl/netbsd/x86_64/dllprt0.as svneol=native#text/plain rtl/netbsd/x86_64/gprt0.as svneol=native#text/plain rtl/netbsd/x86_64/prt0.as svneol=native#text/plain rtl/netbsd/x86_64/sighnd.inc svneol=native#text/plain diff --git a/rtl/netbsd/Makefile.fpc b/rtl/netbsd/Makefile.fpc index 71aa3f1a9d..3b3a860f19 100644 --- a/rtl/netbsd/Makefile.fpc +++ b/rtl/netbsd/Makefile.fpc @@ -9,7 +9,7 @@ main=rtl fpcpackage=y [target] -loaders=prt0 cprt0 +loaders=prt0 cprt0 dllprt0 units=$(SYSTEMUNIT) uuchar unixtype ctypes objpas macpas iso7185 \ strings syscall sysctl baseunix unixutil character \ unix rtlconsts initc cmem matrix \ @@ -122,6 +122,9 @@ prt0$(OEXT) : $(CPU_TARGET)/$(PRT0).as cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as $(AS) -o $(UNITTARGETDIRPREFIX)cprt0$(OEXT) $(CPU_TARGET)/cprt0.as +dllprt0$(OEXT) : $(CPU_TARGET)/dllprt0.as + $(AS) -o $(UNITTARGETDIRPREFIX)dllprt0$(OEXT) $(CPU_TARGET)/dllprt0.as + # # System Units (System, Objpas, Strings) # diff --git a/rtl/netbsd/i386/dllprt0.as b/rtl/netbsd/i386/dllprt0.as new file mode 100644 index 0000000000..b0a6b778d6 --- /dev/null +++ b/rtl/netbsd/i386/dllprt0.as @@ -0,0 +1 @@ +.include "i386/cprt0.as" diff --git a/rtl/netbsd/x86_64/dllprt0.as b/rtl/netbsd/x86_64/dllprt0.as new file mode 100644 index 0000000000..7350947a34 --- /dev/null +++ b/rtl/netbsd/x86_64/dllprt0.as @@ -0,0 +1,52 @@ + .file "crt0.c" + .globl __progname + .section .rodata +.LC0: + .string "" + .data + .align 8 + .type __progname, @object + .size __progname, 8 +__progname: + .quad .LC0 + .text + .p2align 2,0x90 + +.globl _haltproc +.type _haltproc,@function + +_haltproc: + movq $1,%rax + movzwq operatingsystem_result(%rip),%rbx + pushq %rbx + call .Lactualsyscall + addq $8,%rsp + jmp _haltproc + +.Lactualsyscall: + int $0x80 + jb .LErrorcode + xor %rbx,%rbx + ret +.LErrorcode: + movl %eax, %edi + +# This section is needed for NetBSD to recognize a NetBSD binary as such. +# otherwise it will be startup in Linux emulation mode. + +.section ".note.netbsd.ident","a" +.p2align 2 + +.long 7 +.long 4 +# ELF NOTE TYPE NETBSD TAG +.long 1 +.ascii "NetBSD\0\0" +.long 199905 + + .comm environ,8,8 + .comm __progname_storage,256,32 + .comm operatingsystem_parameter_envp,8,8 + .comm operatingsystem_parameter_argc,8,8 + .comm operatingsystem_parameter_argv,8,8 +