Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / arch / mips / vdso / Makefile
1 # Objects to go into the VDSO.
2 obj-vdso-y := elf.o gettimeofday.o sigreturn.o
3
4 # Common compiler flags between ABIs.
5 ccflags-vdso := \
6         $(filter -I%,$(KBUILD_CFLAGS)) \
7         $(filter -E%,$(KBUILD_CFLAGS)) \
8         $(filter -mmicromips,$(KBUILD_CFLAGS)) \
9         $(filter -march=%,$(KBUILD_CFLAGS))
10 cflags-vdso := $(ccflags-vdso) \
11         $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
12         -O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
13         -DDISABLE_BRANCH_PROFILING \
14         $(call cc-option, -fno-stack-protector)
15 aflags-vdso := $(ccflags-vdso) \
16         $(filter -I%,$(KBUILD_CFLAGS)) \
17         $(filter -E%,$(KBUILD_CFLAGS)) \
18         -D__ASSEMBLY__ -Wa,-gdwarf-2
19
20 #
21 # For the pre-R6 code in arch/mips/vdso/vdso.h for locating
22 # the base address of VDSO, the linker will emit a R_MIPS_PC32
23 # relocation in binutils > 2.25 but it will fail with older versions
24 # because that relocation is not supported for that symbol. As a result
25 # of which we are forced to disable the VDSO symbols when building
26 # with < 2.25 binutils on pre-R6 kernels. For more references on why we
27 # can't use other methods to get the base address of VDSO please refer to
28 # the comments on that file.
29 #
30 ifndef CONFIG_CPU_MIPSR6
31   ifeq ($(call ld-ifversion, -lt, 22500000, y),y)
32     $(warning MIPS VDSO requires binutils >= 2.25)
33     obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
34     ccflags-vdso += -DDISABLE_MIPS_VDSO
35   endif
36 endif
37
38 # VDSO linker flags.
39 VDSO_LDFLAGS := \
40         -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \
41         -nostdlib -shared \
42         $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
43         $(call cc-ldoption, -Wl$(comma)--build-id)
44
45 GCOV_PROFILE := n
46
47 #
48 # Shared build commands.
49 #
50
51 quiet_cmd_vdsold = VDSO    $@
52       cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
53                    -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
54
55 hostprogs-y := genvdso
56
57 quiet_cmd_genvdso = GENVDSO $@
58 define cmd_genvdso
59         cp $< $(<:%.dbg=%) && \
60         $(OBJCOPY) -S $< $(<:%.dbg=%) && \
61         $(obj)/genvdso $< $(<:%.dbg=%) $@ $(VDSO_NAME)
62 endef
63
64 #
65 # Build native VDSO.
66 #
67
68 native-abi := $(filter -mabi=%,$(KBUILD_CFLAGS))
69
70 targets += $(obj-vdso-y)
71 targets += vdso.lds vdso.so.dbg vdso.so vdso-image.c
72
73 obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o)
74
75 $(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi)
76 $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
77
78 $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
79
80 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
81         $(call if_changed,vdsold)
82
83 $(obj)/vdso-image.c: $(obj)/vdso.so.dbg $(obj)/genvdso FORCE
84         $(call if_changed,genvdso)
85
86 obj-y += vdso-image.o
87
88 #
89 # Build O32 VDSO.
90 #
91
92 # Define these outside the ifdef to ensure they are picked up by clean.
93 targets += $(obj-vdso-y:%.o=%-o32.o)
94 targets += vdso-o32.lds vdso-o32.so.dbg vdso-o32.so vdso-o32-image.c
95
96 ifdef CONFIG_MIPS32_O32
97
98 obj-vdso-o32 := $(obj-vdso-y:%.o=$(obj)/%-o32.o)
99
100 $(obj-vdso-o32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=32
101 $(obj-vdso-o32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=32
102
103 $(obj)/%-o32.o: $(src)/%.S FORCE
104         $(call if_changed_dep,as_o_S)
105
106 $(obj)/%-o32.o: $(src)/%.c FORCE
107         $(call cmd,force_checksrc)
108         $(call if_changed_rule,cc_o_c)
109
110 $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32
111 $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE
112         $(call if_changed_dep,cpp_lds_S)
113
114 $(obj)/vdso-o32.so.dbg: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE
115         $(call if_changed,vdsold)
116
117 $(obj)/vdso-o32-image.c: VDSO_NAME := o32
118 $(obj)/vdso-o32-image.c: $(obj)/vdso-o32.so.dbg $(obj)/genvdso FORCE
119         $(call if_changed,genvdso)
120
121 obj-y += vdso-o32-image.o
122
123 endif
124
125 #
126 # Build N32 VDSO.
127 #
128
129 targets += $(obj-vdso-y:%.o=%-n32.o)
130 targets += vdso-n32.lds vdso-n32.so.dbg vdso-n32.so vdso-n32-image.c
131
132 ifdef CONFIG_MIPS32_N32
133
134 obj-vdso-n32 := $(obj-vdso-y:%.o=$(obj)/%-n32.o)
135
136 $(obj-vdso-n32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=n32
137 $(obj-vdso-n32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=n32
138
139 $(obj)/%-n32.o: $(src)/%.S FORCE
140         $(call if_changed_dep,as_o_S)
141
142 $(obj)/%-n32.o: $(src)/%.c FORCE
143         $(call cmd,force_checksrc)
144         $(call if_changed_rule,cc_o_c)
145
146 $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32
147 $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE
148         $(call if_changed_dep,cpp_lds_S)
149
150 $(obj)/vdso-n32.so.dbg: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE
151         $(call if_changed,vdsold)
152
153 $(obj)/vdso-n32-image.c: VDSO_NAME := n32
154 $(obj)/vdso-n32-image.c: $(obj)/vdso-n32.so.dbg $(obj)/genvdso FORCE
155         $(call if_changed,genvdso)
156
157 obj-y += vdso-n32-image.o
158
159 endif
160
161 # FIXME: Need install rule for debug.
162 # Needs to deal with dependency for generation of dbg by cmd_genvdso...