xref: /freebsd/sys/modules/linux64/Makefile (revision f11c79fc0046c1579faf7cdf6505c51846cc5709)
1.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux
2.if ${MACHINE_CPUARCH} == "amd64"
3.PATH: ${SRCTOP}/sys/x86/linux
4.endif
5
6KMOD=	linux64
7SRCS=	linux_dummy_machdep.c \
8	linux_elf64.c \
9	linux_event.c \
10	linux_file.c \
11	linux_fork.c \
12	linux_futex.c \
13	linux_getcwd.c \
14	linux_ioctl.c \
15	linux_ipc.c \
16	linux_machdep.c \
17	linux_misc.c \
18	linux_ptrace.c \
19	linux_rseq.c \
20	linux_signal.c \
21	linux_socket.c \
22	linux_stats.c \
23	linux_syscalls.c \
24	linux_sysctl.c \
25	linux_sysent.c \
26	linux_sysvec.c \
27	linux_time.c \
28	linux_vdso.c \
29	linux_timer.c \
30	linux_xattr.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	linux_vdso_inc.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
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
85linux_vdso_inc.o: linux_vdso.so.o
86
87linux_support.o: linux_support.S assym.inc linux_assym.h
88	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
89	    ${.ALLSRC:M*.S:u} -o ${.TARGET}
90
91linux_genassym.o: offset.inc
92	${CC} -c ${NOSAN_CFLAGS:N-flto*:N-fno-common} -fcommon ${.IMPSRC}
93
94.if !defined(KERNBUILDDIR)
95.warning Building Linuxulator outside of a kernel does not make sense
96.endif
97
98EXPORT_SYMS=	YES
99
100.include <bsd.kmod.mk>
101