/arch/arm64/kernel/vdso/Makefile

https://github.com/kees/linux · Makefile · 87 lines · 48 code · 21 blank · 18 comment · 0 complexity · 43173752fbe425cb07fe64b9719ab11a MD5 · raw file

  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # Building a vDSO image for AArch64.
  4. #
  5. # Author: Will Deacon <will.deacon@arm.com>
  6. # Heavily based on the vDSO Makefiles for other archs.
  7. #
  8. # Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
  9. # the inclusion of generic Makefile.
  10. ARCH_REL_TYPE_ABS := R_AARCH64_JUMP_SLOT|R_AARCH64_GLOB_DAT|R_AARCH64_ABS64
  11. include $(srctree)/lib/vdso/Makefile
  12. obj-vdso := vgettimeofday.o note.o sigreturn.o
  13. # Build rules
  14. targets := $(obj-vdso) vdso.so vdso.so.dbg
  15. obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
  16. ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
  17. --build-id -n -T
  18. ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
  19. ccflags-y += -DDISABLE_BRANCH_PROFILING
  20. VDSO_LDFLAGS := -Bsymbolic
  21. CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
  22. KBUILD_CFLAGS += $(DISABLE_LTO)
  23. KASAN_SANITIZE := n
  24. UBSAN_SANITIZE := n
  25. OBJECT_FILES_NON_STANDARD := y
  26. KCOV_INSTRUMENT := n
  27. CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny
  28. ifneq ($(c-gettimeofday-y),)
  29. CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
  30. endif
  31. # Clang versions less than 8 do not support -mcmodel=tiny
  32. ifeq ($(CONFIG_CC_IS_CLANG), y)
  33. ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
  34. CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
  35. endif
  36. endif
  37. # Disable gcov profiling for VDSO code
  38. GCOV_PROFILE := n
  39. obj-y += vdso.o
  40. extra-y += vdso.lds
  41. CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
  42. # Force dependency (incbin is bad)
  43. $(obj)/vdso.o : $(obj)/vdso.so
  44. # Link rule for the .so file, .lds has to be first
  45. $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
  46. $(call if_changed,vdsold_and_vdso_check)
  47. # Strip rule for the .so file
  48. $(obj)/%.so: OBJCOPYFLAGS := -S
  49. $(obj)/%.so: $(obj)/%.so.dbg FORCE
  50. $(call if_changed,objcopy)
  51. # Generate VDSO offsets using helper script
  52. gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
  53. quiet_cmd_vdsosym = VDSOSYM $@
  54. cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
  55. include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
  56. $(call if_changed,vdsosym)
  57. # Actual build commands
  58. quiet_cmd_vdsold_and_vdso_check = LD $@
  59. cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
  60. # Install commands for the unstripped file
  61. quiet_cmd_vdso_install = INSTALL $@
  62. cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
  63. vdso.so: $(obj)/vdso.so.dbg
  64. @mkdir -p $(MODLIB)/vdso
  65. $(call cmd,vdso_install)
  66. vdso_install: vdso.so