@@ -151,17 +151,17 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
151151$(obj)/%.i: $(src)/%.c FORCE
152152 $(call if_changed_dep,cc_i_c)
153153
154+ cmd_gensymtypes = \
155+ $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
156+ $(GENKSYMS) -T $@ -a $(ARCH) \
157+ $(if $(KBUILD_PRESERVE),-p) \
158+ $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null)))
159+
154160quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
155- cmd_cc_symtypes_c = \
156- set -e; \
157- $(CPP) -D__GENKSYMS__ $(c_flags) $< \
158- | $(GENKSYMS) -T $@ \
159- -r $(firstword $(wildcard \
160- $(@:.symtypes=.symref) /dev/null)) \
161- $(if $(KBUILD_PRESERVE),-p) \
162- -a $(ARCH) \
163- >/dev/null; \
164- test -s $@ || rm -f $@
161+ cmd_cc_symtypes_c = \
162+ set -e; \
163+ $(call cmd_gensymtypes, true) >/dev/null; \
164+ test -s $@ || rm -f $@
165165
166166$(obj)/%.symtypes : $(src)/%.c FORCE
167167 $(call cmd,cc_symtypes_c)
@@ -191,14 +191,8 @@ else
191191cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
192192cmd_modversions = \
193193 if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
194- $(CPP) -D__GENKSYMS__ $(c_flags) $< \
195- | $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \
196- -T $(@:.o=.symtypes)) \
197- -r $(firstword $(wildcard \
198- $(@:.o=.symref) /dev/null)) \
199- $(if $(KBUILD_PRESERVE),-p) \
200- -a $(ARCH) \
201- > $(@D)/.tmp_$(@F:.o=.ver); \
194+ $(call cmd_gensymtypes, $(KBUILD_SYMTYPES)) \
195+ > $(@D)/.tmp_$(@F:.o=.ver); \
202196 \
203197 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
204198 -T $(@D)/.tmp_$(@F:.o=.ver); \
0 commit comments