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