PageRenderTime 2169ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/arch/x86/vdso/Makefile

https://github.com/mcr/linux-2.6
Makefile | 141 lines | 84 code | 36 blank | 21 comment | 6 complexity | 8d0855d4e258dfe675ac863df90be818 MD5 | raw file
  1. #
  2. # Building vDSO images for x86.
  3. #
  4. VDSO64-$(CONFIG_X86_64) := y
  5. VDSO32-$(CONFIG_X86_32) := y
  6. VDSO32-$(CONFIG_COMPAT) := y
  7. vdso-install-$(VDSO64-y) += vdso.so
  8. vdso-install-$(VDSO32-y) += $(vdso32-images)
  9. # files to link into the vdso
  10. vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
  11. # files to link into kernel
  12. obj-$(VDSO64-y) += vma.o vdso.o
  13. obj-$(VDSO32-y) += vdso32.o vdso32-setup.o
  14. vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
  15. $(obj)/vdso.o: $(obj)/vdso.so
  16. targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
  17. export CPPFLAGS_vdso.lds += -P -C
  18. VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \
  19. -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
  20. $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
  21. $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
  22. $(call if_changed,vdso)
  23. $(obj)/%.so: OBJCOPYFLAGS := -S
  24. $(obj)/%.so: $(obj)/%.so.dbg FORCE
  25. $(call if_changed,objcopy)
  26. CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
  27. $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector)
  28. $(vobjs): KBUILD_CFLAGS += $(CFL)
  29. targets += vdso-syms.lds
  30. obj-$(VDSO64-y) += vdso-syms.lds
  31. #
  32. # Match symbols in the DSO that look like VDSO*; produce a file of constants.
  33. #
  34. sed-vdsosym := -e 's/^00*/0/' \
  35. -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
  36. quiet_cmd_vdsosym = VDSOSYM $@
  37. define cmd_vdsosym
  38. $(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
  39. endef
  40. $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
  41. $(call if_changed,vdsosym)
  42. #
  43. # Build multiple 32-bit vDSO images to choose from at boot time.
  44. #
  45. obj-$(VDSO32-y) += vdso32-syms.lds
  46. vdso32.so-$(VDSO32-y) += int80
  47. vdso32.so-$(CONFIG_COMPAT) += syscall
  48. vdso32.so-$(VDSO32-y) += sysenter
  49. vdso32-images = $(vdso32.so-y:%=vdso32-%.so)
  50. CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
  51. VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
  52. # This makes sure the $(obj) subdirectory exists even though vdso32/
  53. # is not a kbuild sub-make subdirectory.
  54. override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
  55. targets += vdso32/vdso32.lds
  56. targets += $(vdso32-images) $(vdso32-images:=.dbg)
  57. targets += vdso32/note.o $(vdso32.so-y:%=vdso32/%.o)
  58. extra-y += $(vdso32-images)
  59. $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)
  60. KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
  61. $(vdso32-images:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
  62. $(vdso32-images:%=$(obj)/%.dbg): asflags-$(CONFIG_X86_64) += -m32
  63. $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
  64. $(obj)/vdso32/vdso32.lds \
  65. $(obj)/vdso32/note.o \
  66. $(obj)/vdso32/%.o
  67. $(call if_changed,vdso)
  68. # Make vdso32-*-syms.lds from each image, and then make sure they match.
  69. # The only difference should be that some do not define VDSO32_SYSENTER_RETURN.
  70. targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds)
  71. quiet_cmd_vdso32sym = VDSOSYM $@
  72. define cmd_vdso32sym
  73. if LC_ALL=C sort -u $(filter-out FORCE,$^) > $(@D)/.tmp_$(@F) && \
  74. $(foreach H,$(filter-out FORCE,$^),\
  75. if grep -q VDSO32_SYSENTER_RETURN $H; \
  76. then diff -u $(@D)/.tmp_$(@F) $H; \
  77. else sed /VDSO32_SYSENTER_RETURN/d $(@D)/.tmp_$(@F) | \
  78. diff -u - $H; fi &&) : ;\
  79. then mv -f $(@D)/.tmp_$(@F) $@; \
  80. else rm -f $(@D)/.tmp_$(@F); exit 1; \
  81. fi
  82. endef
  83. $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
  84. $(call if_changed,vdso32sym)
  85. #
  86. # The DSO images are built using a special linker script.
  87. #
  88. quiet_cmd_vdso = VDSO $@
  89. cmd_vdso = $(CC) -nostdlib -o $@ \
  90. $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
  91. -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
  92. sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
  93. VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
  94. GCOV_PROFILE := n
  95. #
  96. # Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
  97. #
  98. quiet_cmd_vdso_install = INSTALL $@
  99. cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
  100. $(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
  101. @mkdir -p $(MODLIB)/vdso
  102. $(call cmd,vdso_install)
  103. PHONY += vdso_install $(vdso-install-y)
  104. vdso_install: $(vdso-install-y)
  105. clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*