blob: e7bff0fbac235715ca5e8601d510414c38e56a9c [file] [log] [blame]
Andi Kleen2aae9502007-07-21 17:10:01 +02001#
2# x86-64 vDSO.
3#
4
5# files to link into the vdso
6# vdso-start.o has to be first
7vobjs-y := vdso-start.o vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
8
9# files to link into kernel
10obj-y := vma.o vdso.o vdso-syms.o
11
12vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
13
14$(obj)/vdso.o: $(obj)/vdso.so
15
Roland McGrathf79eb832007-10-17 18:04:32 +020016targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) vdso-syms.o
Andi Kleen2aae9502007-07-21 17:10:01 +020017
18# The DSO images are built using a special linker script.
19quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@
22
Sam Ravnborgd746d642007-11-12 20:14:19 +010023export CPPFLAGS_vdso.lds += -P -C
Andi Kleen2aae9502007-07-21 17:10:01 +020024
25vdso-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
28SYSCFLAGS_vdso.so = $(vdso-flags)
Roland McGrathf79eb832007-10-17 18:04:32 +020029SYSCFLAGS_vdso.so.dbg = $(vdso-flags)
Andi Kleen2aae9502007-07-21 17:10:01 +020030
31$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
32
33$(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
Roland McGrathf79eb832007-10-17 18:04:32 +020034
35$(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
Andi Kleen2aae9502007-07-21 17:10:01 +020036 $(call if_changed,syscall)
37
Roland McGrathf79eb832007-10-17 18:04:32 +020038$(obj)/%.so: OBJCOPYFLAGS := -S
39$(obj)/%.so: $(obj)/%.so.dbg FORCE
40 $(call if_changed,objcopy)
41
Andi Kleen037e20a2007-07-22 21:13:11 +020042CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
Andi Kleen2aae9502007-07-21 17:10:01 +020043
Sam Ravnborga0f97e02007-10-14 22:21:35 +020044$(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
45$(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
Andi Kleen2aae9502007-07-21 17:10:01 +020046
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.
50extra-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
53
54SYSCFLAGS_vdso-syms.o = -r -d
55$(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE
56 $(call if_changed,syscall)
Roland McGrathf79eb832007-10-17 18:04:32 +020057
58quiet_cmd_vdso_install = INSTALL $@
59 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
60vdso.so:
61 @mkdir -p $(MODLIB)/vdso
62 $(call cmd,vdso_install)
63
64vdso_install: vdso.so