diff options
| author | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-07 15:33:32 -0400 |
|---|---|---|
| committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-13 16:26:21 -0400 |
| commit | 4a556f4f56da3110b27e265b79f0e7582115445c (patch) | |
| tree | f5af0b865c867160855e4722b49d7e850dddf944 /arch/tile/kernel/vdso/Makefile | |
| parent | 0c1d1917c547c8e787fb58e20e2de577453c980c (diff) | |
tile: implement gettimeofday() via vDSO
This change creates the framework for vDSO calls, makes the existing
rt_sigreturn() mechanism use it, and adds a fast gettimeofday().
Now that we need to expose the vDSO address to userspace, we add
AT_SYSINFO_EHDR to the set of aux entries provided to userspace.
(You can disable any extra vDSO support by booting with vdso=0,
but the rt_sigreturn vDSO page will still be provided.)
Note that glibc has supported the tile vDSO since release 2.17.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel/vdso/Makefile')
| -rw-r--r-- | arch/tile/kernel/vdso/Makefile | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/arch/tile/kernel/vdso/Makefile b/arch/tile/kernel/vdso/Makefile new file mode 100644 index 000000000000..e2b7a2f4ee41 --- /dev/null +++ b/arch/tile/kernel/vdso/Makefile | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | # Symbols present in the vdso | ||
| 2 | vdso-syms = rt_sigreturn gettimeofday | ||
| 3 | |||
| 4 | # Files to link into the vdso | ||
| 5 | obj-vdso = $(patsubst %, v%.o, $(vdso-syms)) | ||
| 6 | |||
| 7 | # Build rules | ||
| 8 | targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds | ||
| 9 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) | ||
| 10 | |||
| 11 | # vdso32 is only for tilegx -m32 compat task. | ||
| 12 | VDSO32-$(CONFIG_COMPAT) := y | ||
| 13 | |||
| 14 | obj-y += vdso.o | ||
| 15 | obj-$(VDSO32-y) += vdso32.o | ||
| 16 | extra-y += vdso.lds | ||
| 17 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | ||
| 18 | |||
| 19 | # vDSO code runs in userspace and -pg doesn't help with profiling anyway. | ||
| 20 | CFLAGS_REMOVE_vdso.o = -pg | ||
| 21 | CFLAGS_REMOVE_vdso32.o = -pg | ||
| 22 | CFLAGS_REMOVE_vrt_sigreturn.o = -pg | ||
| 23 | CFLAGS_REMOVE_vrt_sigreturn32.o = -pg | ||
| 24 | CFLAGS_REMOVE_vgettimeofday.o = -pg | ||
| 25 | CFLAGS_REMOVE_vgettimeofday32.o = -pg | ||
| 26 | |||
| 27 | ifdef CONFIG_FEEDBACK_COLLECT | ||
| 28 | # vDSO code runs in userspace, not collecting feedback data. | ||
| 29 | CFLAGS_REMOVE_vdso.o = -ffeedback-generate | ||
| 30 | CFLAGS_REMOVE_vdso32.o = -ffeedback-generate | ||
| 31 | CFLAGS_REMOVE_vrt_sigreturn.o = -ffeedback-generate | ||
| 32 | CFLAGS_REMOVE_vrt_sigreturn32.o = -ffeedback-generate | ||
| 33 | CFLAGS_REMOVE_vgettimeofday.o = -ffeedback-generate | ||
| 34 | CFLAGS_REMOVE_vgettimeofday32.o = -ffeedback-generate | ||
| 35 | endif | ||
| 36 | |||
| 37 | # Disable gcov profiling for VDSO code | ||
| 38 | GCOV_PROFILE := n | ||
| 39 | |||
| 40 | # Force dependency | ||
| 41 | $(obj)/vdso.o: $(obj)/vdso.so | ||
| 42 | |||
| 43 | # link rule for the .so file, .lds has to be first | ||
| 44 | SYSCFLAGS_vdso.so.dbg = $(c_flags) | ||
| 45 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) | ||
| 46 | $(call if_changed,vdsold) | ||
| 47 | |||
| 48 | |||
| 49 | # We also create a special relocatable object that should mirror the symbol | ||
| 50 | # table and layout of the linked DSO. With ld -R we can then refer to | ||
| 51 | # these symbols in the kernel code rather than hand-coded addresses. | ||
| 52 | extra-y += vdso-syms.o | ||
| 53 | $(obj)/built-in.o: $(obj)/vdso-syms.o | ||
| 54 | $(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o | ||
| 55 | |||
| 56 | SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ | ||
| 57 | $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | ||
| 58 | SYSCFLAGS_vdso_syms.o = -r | ||
| 59 | $(obj)/vdso-syms.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE | ||
| 60 | $(call if_changed,vdsold) | ||
| 61 | |||
| 62 | |||
| 63 | # strip rule for the .so file | ||
| 64 | $(obj)/%.so: OBJCOPYFLAGS := -S | ||
| 65 | $(obj)/%.so: $(obj)/%.so.dbg FORCE | ||
| 66 | $(call if_changed,objcopy) | ||
| 67 | |||
| 68 | # actual build commands | ||
| 69 | # The DSO images are built using a special linker script | ||
| 70 | # Add -lgcc so tilepro gets static muldi3 and lshrdi3 definitions. | ||
| 71 | # Make sure only to export the intended __vdso_xxx symbol offsets. | ||
| 72 | quiet_cmd_vdsold = VDSOLD $@ | ||
| 73 | cmd_vdsold = $(CC) $(KCFLAGS) -nostdlib $(SYSCFLAGS_$(@F)) \ | ||
| 74 | -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp -lgcc && \ | ||
| 75 | $(CROSS_COMPILE)objcopy \ | ||
| 76 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ | ||
| 77 | |||
| 78 | # install commands for the unstripped file | ||
| 79 | quiet_cmd_vdso_install = INSTALL $@ | ||
| 80 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | ||
| 81 | |||
| 82 | vdso.so: $(obj)/vdso.so.dbg | ||
| 83 | @mkdir -p $(MODLIB)/vdso | ||
| 84 | $(call cmd,vdso_install) | ||
| 85 | |||
| 86 | vdso32.so: $(obj)/vdso32.so.dbg | ||
| 87 | $(call cmd,vdso_install) | ||
| 88 | |||
| 89 | vdso_install: vdso.so | ||
| 90 | vdso32_install: vdso32.so | ||
| 91 | |||
| 92 | |||
| 93 | KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) | ||
| 94 | KBUILD_AFLAGS_32 += -m32 -s | ||
| 95 | KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) | ||
| 96 | KBUILD_CFLAGS_32 += -m32 -fPIC -shared | ||
| 97 | |||
| 98 | obj-vdso32 = $(patsubst %, v%32.o, $(vdso-syms)) | ||
| 99 | obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) | ||
| 100 | |||
| 101 | targets += $(obj-vdso32) vdso32.so vdso32.so.dbg | ||
| 102 | |||
| 103 | $(obj-vdso32:%=%): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) | ||
| 104 | $(obj-vdso32:%=%): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) | ||
| 105 | |||
| 106 | $(obj)/vgettimeofday32.o: $(obj)/vgettimeofday.c | ||
| 107 | $(call if_changed,cc_o_c) | ||
| 108 | |||
| 109 | $(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S | ||
| 110 | $(call if_changed,as_o_S) | ||
| 111 | |||
| 112 | # Force dependency | ||
| 113 | $(obj)/vdso32.o: $(obj)/vdso32.so | ||
| 114 | |||
| 115 | SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \ | ||
| 116 | $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | ||
| 117 | $(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32) | ||
| 118 | $(call if_changed,vdsold) | ||
