5 # files to link into the vdso
6 # vdso-start.o has to be first
7 vobjs-y := vdso-start.o vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
9 # files to link into kernel
10 obj-y := vma.o vdso.o vdso-syms.o
12 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
14 $(obj)/vdso.o: $(obj)/vdso.so
16 targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) vdso-syms.o
18 # The DSO images are built using a special linker script.
19 quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@
23 export CPPFLAGS_vdso.lds += -P -C
25 vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
27 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
28 SYSCFLAGS_vdso.so = $(vdso-flags)
29 SYSCFLAGS_vdso.so.dbg = $(vdso-flags)
31 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
33 $(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
35 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
36 $(call if_changed,syscall)
38 $(obj)/%.so: OBJCOPYFLAGS := -S
39 $(obj)/%.so: $(obj)/%.so.dbg FORCE
40 $(call if_changed,objcopy)
42 CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
44 $(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
45 $(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
47 # We also create a special relocatable object that should mirror the symbol
48 # table and layout of the linked DSO. With ld -R we can then refer to
49 # these symbols in the kernel code rather than hand-coded addresses.
50 extra-y += vdso-syms.o
51 $(obj)/built-in.o: $(obj)/vdso-syms.o
52 $(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
54 SYSCFLAGS_vdso-syms.o = -r -d
55 $(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE
56 $(call if_changed,syscall)
58 quiet_cmd_vdso_install = INSTALL $@
59 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
61 @mkdir -p $(MODLIB)/vdso
62 $(call cmd,vdso_install)