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