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