Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / tile / kernel / vdso / Makefile
bloba025f63d54cd9609820c634da186a5e71a026375
1 # Symbols present in the vdso
2 vdso-syms = rt_sigreturn gettimeofday
4 # Files to link into the vdso
5 obj-vdso = $(patsubst %, v%.o, $(vdso-syms))
7 # Build rules
8 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds
9 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
11 # vdso32 is only for tilegx -m32 compat task.
12 VDSO32-$(CONFIG_COMPAT) := y
14 obj-y += vdso.o
15 obj-$(VDSO32-y) += vdso32.o
16 extra-y += vdso.lds
17 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
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
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
37 # Disable gcov profiling for VDSO code
38 GCOV_PROFILE := n
40 # Force dependency
41 $(obj)/vdso.o: $(obj)/vdso.so
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)
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
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)
63 # strip rule for the .so file
64 $(obj)/%.so: OBJCOPYFLAGS := -S
65 $(obj)/%.so: $(obj)/%.so.dbg FORCE
66 $(call if_changed,objcopy)
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 $@
78 # install commands for the unstripped file
79 quiet_cmd_vdso_install = INSTALL $@
80 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
82 vdso.so: $(obj)/vdso.so.dbg
83 @mkdir -p $(MODLIB)/vdso
84 $(call cmd,vdso_install)
86 vdso32.so: $(obj)/vdso32.so.dbg
87 $(call cmd,vdso_install)
89 vdso_install: vdso.so
90 vdso32_install: vdso32.so
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
98 obj-vdso32 = $(patsubst %, v%32.o, $(vdso-syms))
99 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
101 targets += $(obj-vdso32) vdso32.so vdso32.so.dbg
103 $(obj-vdso32:%=%): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
104 $(obj-vdso32:%=%): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
106 $(obj)/vgettimeofday32.o: $(obj)/vgettimeofday.c
107 $(call if_changed_rule,cc_o_c)
109 $(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S
110 $(call if_changed,as_o_S)
112 # Force dependency
113 $(obj)/vdso32.o: $(obj)/vdso32.so
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)