aboutsummaryrefslogtreecommitdiff
path: root/sys/modules/cloudabi64/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'sys/modules/cloudabi64/Makefile')
-rw-r--r--sys/modules/cloudabi64/Makefile32
1 files changed, 30 insertions, 2 deletions
diff --git a/sys/modules/cloudabi64/Makefile b/sys/modules/cloudabi64/Makefile
index 3aee96d97525..b6fe38057ba8 100644
--- a/sys/modules/cloudabi64/Makefile
+++ b/sys/modules/cloudabi64/Makefile
@@ -1,11 +1,39 @@
# $FreeBSD$
-.PATH: ${.CURDIR}/../../compat/cloudabi64
-.PATH: ${.CURDIR}/../../${MACHINE}/cloudabi64
+SYSDIR?=${.CURDIR}/../..
+
+.PATH: ${SYSDIR}/compat/cloudabi64
+.PATH: ${SYSDIR}/${MACHINE}/cloudabi64
KMOD= cloudabi64
SRCS= cloudabi64_fd.c cloudabi64_module.c cloudabi64_poll.c \
cloudabi64_sock.c cloudabi64_syscalls.c cloudabi64_sysent.c \
cloudabi64_sysvec.c cloudabi64_thread.c
+OBJS= cloudabi64_vdso_blob.o
+CLEANFILES=cloudabi64_vdso.o
+
+.if ${MACHINE_CPUARCH} == "aarch64"
+VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_aarch64.c
+OUTPUT_TARGET=elf64-littleaarch64
+BINARY_ARCHITECTURE=aarch64
+.elif ${MACHINE_CPUARCH} == "amd64"
+VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_x86_64.c
+OUTPUT_TARGET=elf64-x86-64-freebsd
+BINARY_ARCHITECTURE=i386
+.endif
+
+cloudabi64_vdso.o: ${VDSO_SRCS}
+ ${CC} -shared -nostdinc -nostdlib \
+ -Wl,-T${SYSDIR}/compat/cloudabi64/cloudabi64_vdso.lds.s \
+ -D_KERNEL -I. -I${SYSDIR} -I${SYSDIR}/contrib/cloudabi \
+ -O2 -fomit-frame-pointer \
+ ${VDSO_SRCS} -o ${.TARGET}
+
+cloudabi64_vdso_blob.o: cloudabi64_vdso.o
+ ${OBJCOPY} --input-target binary \
+ --output-target ${OUTPUT_TARGET} \
+ --binary-architecture ${BINARY_ARCHITECTURE} \
+ cloudabi64_vdso.o ${.TARGET}
+
.include <bsd.kmod.mk>