nga-c: non-libc: openbsd-amd64 support, source cleanups

FossilOrigin-Name: f8712bb8ce359909a61a8d0ff917173da4e35b8586e34b6207e3604ae40f139e
This commit is contained in:
crc 2021-06-17 18:49:53 +00:00
parent 6f8bd3047f
commit 2b311ceab7
4 changed files with 33 additions and 14 deletions

View file

@ -1,9 +1,10 @@
default:
@echo specify the target:
@echo - freebsd-x86-32bit
@echo - freebsd-x86-64bit
@echo - macos
@echo - linux-x86-32bit
@echo - freebsd-i386
@echo - freebsd-amd64
@echo - linux-i386
@echo - macos-amd64
@echo - openbsd-amd64
common:
mkdir -p bin
@ -14,22 +15,31 @@ common:
clean:
rm *.o
freebsd-x86-32bit: common
bsd-i386:
nasm -f elf bsd-i386.s
bsd-amd64:
nasm -f elf64 bsd-amd64.s
freebsd-i386: common bsd-i386
cc -m32 -c retro.c
nasm -f elf fbsd.s
ld -nostdlib -m elf_i386_fbsd fbsd.o retro.o -o bin/retro.freebsd32
ld -nostdlib -m elf_i386_fbsd bsd-i386.o retro.o -o bin/retro
freebsd-x86-64bit: common
freebsd-amd64: common bsd-amd64
cc -m64 -c retro.c
nasm -f elf64 fbsd64.s
ld -nostdlib -m elf_x86_64_fbsd fbsd64.o retro.o -o bin/retro.freebsd64
ld -nostdlib -m elf_x86_64_fbsd bsd-amd64.o retro.o -o bin/retro
macos: common
openbsd-amd64: common bsd-amd64
cc -m64 -c retro.c
as openbsd.s -o openbsd.o
ld -nostdlib -no-pie -m elf_x86_64 openbsd.o bsd-amd64.o retro.o -o bin/retro
macos-amd64: common
cc -m64 -fno-pie -c retro.c
nasm -f macho64 macos.s
ld macos.o retro.o -o bin/retro.macos
ld macos.o retro.o -o bin/retro
linux-x86-32bit: common
linux-i386: common
cc -m32 -c retro.c
nasm -f elf linux.s
ld -nostdlib linux.o retro.o -o bin/retro.linux32
ld -nostdlib linux.o retro.o -o bin/retro

View file

@ -0,0 +1,9 @@
.section ".note.openbsd.ident", "a"
.p2align 2
.long 0x8
.long 0x4
.long 0x1
.ascii "OpenBSD\0"
.long 0x0
.p2align 2