Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. obj-y += vsyscall.o vsyscall-syscall.o
  2. $(obj)/vsyscall-syscall.o: \
  3. $(foreach F,trapa,$(obj)/vsyscall-$F.so)
  4. # Teach kbuild about targets
  5. targets += $(foreach F,trapa,vsyscall-$F.o vsyscall-$F.so)
  6. targets += vsyscall-note.o vsyscall.lds
  7. # The DSO images are built using a special linker script
  8. quiet_cmd_syscall = SYSCALL $@
  9. cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \
  10. -Wl,-T,$(filter-out FORCE,$^) -o $@
  11. export CPPFLAGS_vsyscall.lds += -P -C -Ush
  12. vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
  13. $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
  14. SYSCFLAGS_vsyscall-trapa.so = $(vsyscall-flags)
  15. $(obj)/vsyscall-trapa.so: \
  16. $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
  17. $(call if_changed,syscall)
  18. # We also create a special relocatable object that should mirror the symbol
  19. # table and layout of the linked DSO. With ld -R we can then refer to
  20. # these symbols in the kernel code rather than hand-coded addresses.
  21. extra-y += vsyscall-syms.o
  22. $(obj)/built-in.o: $(obj)/vsyscall-syms.o
  23. $(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
  24. SYSCFLAGS_vsyscall-syms.o = -r
  25. $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
  26. $(obj)/vsyscall-trapa.o $(obj)/vsyscall-note.o FORCE
  27. $(call if_changed,syscall)