Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copied from arch/tile/kernel/vdso/Makefile
  2. # Symbols present in the vdso
  3. vdso-syms = rt_sigreturn
  4. vdso-syms += gettimeofday
  5. vdso-syms += clock_gettime
  6. vdso-syms += clock_getres
  7. vdso-syms += getcpu
  8. vdso-syms += flush_icache
  9. # Files to link into the vdso
  10. obj-vdso = $(patsubst %, %.o, $(vdso-syms))
  11. # Build rules
  12. targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
  13. obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
  14. obj-y += vdso.o vdso-syms.o
  15. CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
  16. # Disable gcov profiling for VDSO code
  17. GCOV_PROFILE := n
  18. # Force dependency
  19. $(obj)/vdso.o: $(obj)/vdso.so
  20. # link rule for the .so file, .lds has to be first
  21. SYSCFLAGS_vdso.so.dbg = $(c_flags)
  22. $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
  23. $(call if_changed,vdsold)
  24. # We also create a special relocatable object that should mirror the symbol
  25. # table and layout of the linked DSO. With ld -R we can then refer to
  26. # these symbols in the kernel code rather than hand-coded addresses.
  27. SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
  28. $(call cc-ldoption, -Wl$(comma)--hash-style=both)
  29. $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
  30. $(call if_changed,vdsold)
  31. LDFLAGS_vdso-syms.o := -r -R
  32. $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
  33. $(call if_changed,ld)
  34. # strip rule for the .so file
  35. $(obj)/%.so: OBJCOPYFLAGS := -S
  36. $(obj)/%.so: $(obj)/%.so.dbg FORCE
  37. $(call if_changed,objcopy)
  38. # actual build commands
  39. # The DSO images are built using a special linker script
  40. # Add -lgcc so rv32 gets static muldi3 and lshrdi3 definitions.
  41. # Make sure only to export the intended __vdso_xxx symbol offsets.
  42. quiet_cmd_vdsold = VDSOLD $@
  43. cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \
  44. -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \
  45. $(CROSS_COMPILE)objcopy \
  46. $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
  47. rm $@.tmp
  48. # install commands for the unstripped file
  49. quiet_cmd_vdso_install = INSTALL $@
  50. cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
  51. vdso.so: $(obj)/vdso.so.dbg
  52. @mkdir -p $(MODLIB)/vdso
  53. $(call cmd,vdso_install)
  54. vdso_install: vdso.so