Commit | Line | Data |
---|---|---|
f1c2bb8b RW |
1 | # |
2 | # Building vDSO images for x86. | |
3 | # | |
4 | ||
5 | VDSO64-y := y | |
6 | ||
7 | vdso-install-$(VDSO64-y) += vdso.so | |
8 | ||
9 | ||
10 | # files to link into the vdso | |
11 | vobjs-y := vdso-note.o um_vdso.o | |
12 | ||
13 | # files to link into kernel | |
14 | obj-$(VDSO64-y) += vdso.o vma.o | |
15 | ||
16 | vobjs := $(foreach F,$(vobjs-y),$(obj)/$F) | |
17 | ||
18 | $(obj)/vdso.o: $(obj)/vdso.so | |
19 | ||
20 | targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) | |
21 | ||
22 | export CPPFLAGS_vdso.lds += -P -C | |
23 | ||
24 | VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ | |
25 | -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 | |
26 | ||
27 | $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so | |
28 | ||
29 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE | |
30 | $(call if_changed,vdso) | |
31 | ||
32 | $(obj)/%.so: OBJCOPYFLAGS := -S | |
33 | $(obj)/%.so: $(obj)/%.so.dbg FORCE | |
34 | $(call if_changed,objcopy) | |
35 | ||
36 | # | |
37 | # Don't omit frame pointers for ease of userspace debugging, but do | |
38 | # optimize sibling calls. | |
39 | # | |
40 | CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ | |
41 | $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ | |
42 | -fno-omit-frame-pointer -foptimize-sibling-calls | |
43 | ||
44 | $(vobjs): KBUILD_CFLAGS += $(CFL) | |
45 | ||
46 | # | |
47 | # vDSO code runs in userspace and -pg doesn't help with profiling anyway. | |
48 | # | |
4d211093 AV |
49 | CFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage |
50 | CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage | |
f1c2bb8b RW |
51 | |
52 | targets += vdso-syms.lds | |
53 | obj-$(VDSO64-y) += vdso-syms.lds | |
54 | ||
55 | # | |
56 | # Match symbols in the DSO that look like VDSO*; produce a file of constants. | |
57 | # | |
58 | sed-vdsosym := -e 's/^00*/0/' \ | |
59 | -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p' | |
60 | quiet_cmd_vdsosym = VDSOSYM $@ | |
61 | define cmd_vdsosym | |
62 | $(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@ | |
63 | endef | |
64 | ||
65 | $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE | |
66 | $(call if_changed,vdsosym) | |
67 | ||
68 | # | |
69 | # The DSO images are built using a special linker script. | |
70 | # | |
71 | quiet_cmd_vdso = VDSO $@ | |
72 | cmd_vdso = $(CC) -nostdlib -o $@ \ | |
73 | $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ | |
74 | -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ | |
75 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' | |
76 | ||
77 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | |
78 | GCOV_PROFILE := n | |
79 | ||
80 | # | |
81 | # Install the unstripped copy of vdso*.so listed in $(vdso-install-y). | |
82 | # | |
83 | quiet_cmd_vdso_install = INSTALL $@ | |
84 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | |
85 | $(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE | |
86 | @mkdir -p $(MODLIB)/vdso | |
87 | $(call cmd,vdso_install) | |
88 | ||
89 | PHONY += vdso_install $(vdso-install-y) | |
90 | vdso_install: $(vdso-install-y) |