xref: /linux/arch/sh/kernel/vsyscall/Makefile (revision ff9a79307f89563da6d841da8b7cc4a0afceb0e2)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
28f5ef7c7SNicholas Pigginobj-y += vsyscall.o vsyscall-syscall.o vsyscall-syms.o
319f9a34fSPaul Mundt
499fe83abSMasahiro Yamada$(obj)/vsyscall-syscall.o: $(obj)/vsyscall-trapa.so
519f9a34fSPaul Mundt
619f9a34fSPaul Mundt# Teach kbuild about targets
799fe83abSMasahiro Yamadatargets += vsyscall-trapa.o vsyscall-traps.so
88f5ef7c7SNicholas Piggintargets += vsyscall-note.o vsyscall.lds vsyscall-dummy.o
919f9a34fSPaul Mundt
1019f9a34fSPaul Mundt# The DSO images are built using a special linker script
1119f9a34fSPaul Mundtquiet_cmd_syscall = SYSCALL $@
1219f9a34fSPaul Mundt      cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \
1319f9a34fSPaul Mundt			   -Wl,-T,$(filter-out FORCE,$^) -o $@
1419f9a34fSPaul Mundt
1519f9a34fSPaul Mundtexport CPPFLAGS_vsyscall.lds += -P -C -Ush
1619f9a34fSPaul Mundt
175b13f841SNick Desaulniersvsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 -Wl,--hash-style=sysv
1819f9a34fSPaul Mundt
1919f9a34fSPaul MundtSYSCFLAGS_vsyscall-trapa.so	= $(vsyscall-flags)
2019f9a34fSPaul Mundt
2119f9a34fSPaul Mundt$(obj)/vsyscall-trapa.so: \
22*b957df3bSMasahiro Yamada$(obj)/vsyscall-%.so: $(obj)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
2319f9a34fSPaul Mundt	$(call if_changed,syscall)
2419f9a34fSPaul Mundt
2519f9a34fSPaul Mundt# We also create a special relocatable object that should mirror the symbol
2619f9a34fSPaul Mundt# table and layout of the linked DSO.  With ld -R we can then refer to
2719f9a34fSPaul Mundt# these symbols in the kernel code rather than hand-coded addresses.
288f5ef7c7SNicholas PigginSYSCFLAGS_vsyscall-dummy.o = -r
29*b957df3bSMasahiro Yamada$(obj)/vsyscall-dummy.o: $(obj)/vsyscall.lds \
3019f9a34fSPaul Mundt			$(obj)/vsyscall-trapa.o $(obj)/vsyscall-note.o FORCE
3119f9a34fSPaul Mundt	$(call if_changed,syscall)
328f5ef7c7SNicholas Piggin
338f5ef7c7SNicholas PigginLDFLAGS_vsyscall-syms.o := -r -R
348f5ef7c7SNicholas Piggin$(obj)/vsyscall-syms.o: $(obj)/vsyscall-dummy.o FORCE
358f5ef7c7SNicholas Piggin	$(call if_changed,ld)
36