1 2.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux 3.if ${MACHINE_CPUARCH} == "amd64" 4.PATH: ${SRCTOP}/sys/x86/linux 5.endif 6 7KMOD= linux64 8SRCS= linux_dummy_machdep.c \ 9 linux_elf64.c \ 10 linux_event.c \ 11 linux_file.c \ 12 linux_fork.c \ 13 linux_futex.c \ 14 linux_getcwd.c \ 15 linux_ioctl.c \ 16 linux_ipc.c \ 17 linux_machdep.c \ 18 linux_misc.c \ 19 linux_ptrace.c \ 20 linux_rseq.c \ 21 linux_signal.c \ 22 linux_socket.c \ 23 linux_stats.c \ 24 linux_syscalls.c \ 25 linux_sysctl.c \ 26 linux_sysent.c \ 27 linux_sysvec.c \ 28 linux_time.c \ 29 linux_vdso.c \ 30 linux_timer.c \ 31 linux_xattr.c \ 32 opt_ktrace.h \ 33 opt_inet6.h \ 34 opt_posix.h \ 35 bus_if.h \ 36 device_if.h \ 37 vnode_if.h \ 38 linux_support.S 39.if ${MACHINE_CPUARCH} == "amd64" 40SRCS+= linux_dummy_x86.c 41.endif 42DPSRCS= assym.inc linux_genassym.c 43 44# XXX: for assym.inc 45SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h 46 47CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ 48 genassym.o linux_vdso_gtod.o linux_vdso.so.o 49 50OBJS= linux_vdso.so 51 52linux_assym.h: linux_genassym.o 53 sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} 54 55.if ${MACHINE_CPUARCH} == "amd64" 56VDSOFLAGS=-mcmodel=small -msoft-float 57VDSODEPS=linux_vdso_gettc_x86.inc 58.elif ${MACHINE_CPUARCH} == "aarch64" 59# The Linux uses tiny memory model, but our ld does not know about 60# some of relocation types which is generated by cc 61VDSOFLAGS=-mgeneral-regs-only -mcmodel=small -ffixed-x18 62.endif 63 64linux_locore.o: linux_assym.h assym.inc 65 ${CC} -c -x assembler-with-cpp -DLOCORE \ 66 -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \ 67 -nostdinc -fasynchronous-unwind-tables \ 68 -fno-omit-frame-pointer -foptimize-sibling-calls \ 69 -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ 70 ${.IMPSRC} -o ${.TARGET} 71 72linux_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS} 73 ${CC} -c -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \ 74 -nostdinc -fasynchronous-unwind-tables \ 75 -fno-omit-frame-pointer -foptimize-sibling-calls \ 76 -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ 77 ${.IMPSRC} -o ${.TARGET} 78 79linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o 80 ${LD} --shared --eh-frame-hdr -soname=linux-vdso.so.1 \ 81 --no-undefined --hash-style=both -warn-common -nostdlib \ 82 --strip-debug -s --build-id=sha1 -Bsymbolic \ 83 -T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \ 84 -o ${.TARGET} ${.ALLSRC:M*.o} 85 86.if ${MACHINE_CPUARCH} == "aarch64" 87OBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64 88.elif ${MACHINE_CPUARCH} == "amd64" 89OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64 90.else 91.error ${MACHINE_CPUARCH} not yet supported by linux64 92.endif 93 94linux_vdso.so: linux_vdso.so.o 95 ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \ 96 linux_vdso.so.o ${.TARGET} 97 ${STRIPBIN} -N _binary_linux_vdso_so_o_size ${.TARGET} 98 99linux_support.o: linux_support.S assym.inc linux_assym.h 100 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 101 ${.ALLSRC:M*.S:u} -o ${.TARGET} 102 103linux_genassym.o: offset.inc 104 ${CC} -c ${CFLAGS:N-flto*:N-fno-common:N-fsanitize*:N-fno-sanitize*} \ 105 -fcommon ${.IMPSRC} 106 107.if !defined(KERNBUILDDIR) 108.warning Building Linuxulator outside of a kernel does not make sense 109.endif 110 111EXPORT_SYMS= YES 112 113.include <bsd.kmod.mk> 114