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