xref: /linux/arch/sh/kernel/vsyscall/Makefile (revision 8f5ef7c74ac778a16a89bc054e316dcade304784)
1*8f5ef7c7SNicholas Pigginobj-y += vsyscall.o vsyscall-syscall.o vsyscall-syms.o
219f9a34fSPaul Mundt
319f9a34fSPaul Mundt$(obj)/vsyscall-syscall.o: \
419f9a34fSPaul Mundt	$(foreach F,trapa,$(obj)/vsyscall-$F.so)
519f9a34fSPaul Mundt
619f9a34fSPaul Mundt# Teach kbuild about targets
719f9a34fSPaul Mundttargets += $(foreach F,trapa,vsyscall-$F.o vsyscall-$F.so)
8*8f5ef7c7SNicholas 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
1719f9a34fSPaul Mundtvsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
18f86fd306SSam Ravnborg		$(call cc-ldoption, -Wl$(comma)--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.
29*8f5ef7c7SNicholas PigginSYSCFLAGS_vsyscall-dummy.o = -r
30*8f5ef7c7SNicholas 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)
33*8f5ef7c7SNicholas Piggin
34*8f5ef7c7SNicholas PigginLDFLAGS_vsyscall-syms.o := -r -R
35*8f5ef7c7SNicholas Piggin$(obj)/vsyscall-syms.o: $(obj)/vsyscall-dummy.o FORCE
36*8f5ef7c7SNicholas Piggin	$(call if_changed,ld)
37