Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # List of files in the vdso, has to be asm only for now
  2. KCOV_INSTRUMENT := n
  3. obj-vdso32 = gettimeofday.o clock_getres.o clock_gettime.o note.o getcpu.o
  4. # Build rules
  5. targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
  6. obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
  7. KBUILD_AFLAGS_31 := $(filter-out -m64,$(KBUILD_AFLAGS))
  8. KBUILD_AFLAGS_31 += -m31 -s
  9. KBUILD_CFLAGS_31 := $(filter-out -m64,$(KBUILD_CFLAGS))
  10. KBUILD_CFLAGS_31 += -m31 -fPIC -shared -fno-common -fno-builtin
  11. KBUILD_CFLAGS_31 += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
  12. $(call cc-ldoption, -Wl$(comma)--hash-style=both)
  13. $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_31)
  14. $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_31)
  15. obj-y += vdso32_wrapper.o
  16. extra-y += vdso32.lds
  17. CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
  18. # Disable gcov profiling and ubsan for VDSO code
  19. GCOV_PROFILE := n
  20. UBSAN_SANITIZE := n
  21. # Force dependency (incbin is bad)
  22. $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
  23. # link rule for the .so file, .lds has to be first
  24. $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32)
  25. $(call if_changed,vdso32ld)
  26. # strip rule for the .so file
  27. $(obj)/%.so: OBJCOPYFLAGS := -S
  28. $(obj)/%.so: $(obj)/%.so.dbg FORCE
  29. $(call if_changed,objcopy)
  30. # assembly rules for the .S files
  31. $(obj-vdso32): %.o: %.S
  32. $(call if_changed_dep,vdso32as)
  33. # actual build commands
  34. quiet_cmd_vdso32ld = VDSO32L $@
  35. cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
  36. quiet_cmd_vdso32as = VDSO32A $@
  37. cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
  38. # install commands for the unstripped file
  39. quiet_cmd_vdso_install = INSTALL $@
  40. cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
  41. vdso32.so: $(obj)/vdso32.so.dbg
  42. @mkdir -p $(MODLIB)/vdso
  43. $(call cmd,vdso_install)
  44. vdso_install: vdso32.so