Skip to contentSkip to conversation

Makefile.build: make KBUILD_SYMTYPES work again

PATCH Don Zickus 2 participants 2 messages May 24, 2010 – Jun 4, 2010 Kbuild

lore
Share & tools
lore

Don Zickus

author
#0 lore raw

commit 37a8d9f67f18de1e2cbc7387311ce22d4dbff518 tried to combine some duplicate code and accidentally broke how KBUILD_SYMTYPES worked

This fixes the code to match the original intention by the author who originally added the code I believe.

The fixes include:
- removing extra whitespaces in the if-statements
- moving the if-statement from around the -r to the -T
- adding a second arg to cmd_gensymtypes to simplify the options passed to genksyms.

Tested by instrumenting genksyms and seeing what options were passed in during a make, KBUILD_SYMTYPES make, and when a foo.symref was created.

Everything compiled and looked ok.

---
 scripts/Makefile.build |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
scripts/Makefile.build +13 -13
index 0b94d2f..f5fe50a 100644
@@ -156,14 +156,14 @@ $(obj)/%.i: $(src)/%.c FORCE
 
 cmd_gensymtypes =                                                           \
     $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \
-    $(GENKSYMS) -T $@ -a $(ARCH)                                            \
+    $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH)                              \
      $(if $(KBUILD_PRESERVE),-p)                                            \
-     $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null)))
+     -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
 
 quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
 cmd_cc_symtypes_c =                                                         \
     set -e;                                                                 \
-    $(call cmd_gensymtypes, true) >/dev/null;                               \
+    $(call cmd_gensymtypes,true,$@) >/dev/null;                             \
     test -s $@ || rm -f $@
 
 $(obj)/%.symtypes : $(src)/%.c FORCE
@@ -192,16 +192,16 @@ else
 #   the actual value of the checksum generated by genksyms
 
 cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
-cmd_modversions =							\
-	if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then	\
-		$(call cmd_gensymtypes, $(KBUILD_SYMTYPES))		\
-		    > $(@D)/.tmp_$(@F:.o=.ver);				\
-									\
-		$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) 		\
-			-T $(@D)/.tmp_$(@F:.o=.ver);			\
-		rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver);	\
-	else								\
-		mv -f $(@D)/.tmp_$(@F) $@;				\
+cmd_modversions =								\
+	if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then		\
+		$(call cmd_gensymtypes,$(KBUILD_SYMTYPES),$(@:.o=.symtypes))	\
+		    > $(@D)/.tmp_$(@F:.o=.ver);					\
+										\
+		$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) 			\
+			-T $(@D)/.tmp_$(@F:.o=.ver);				\
+		rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver);		\
+	else									\
+		mv -f $(@D)/.tmp_$(@F) $@;					\
 	fi;
 endif
 
Signature · 1 line
1.7.0.1
#1 lore raw
Quoted 12 lines · Don Zickus

commit 37a8d9f67f18de1e2cbc7387311ce22d4dbff518 tried to combine some duplicate code and accidentally broke how KBUILD_SYMTYPES worked

This fixes the code to match the original intention by the author who originally added the code I believe.

The fixes include:
- removing extra whitespaces in the if-statements
- moving the if-statement from around the -r to the -T
- adding a second arg to cmd_gensymtypes to simplify the options passed to genksyms.

Quoted 6 lines

Tested by instrumenting genksyms and seeing what options were passed in during a make, KBUILD_SYMTYPES make, and when a foo.symref was created.

Everything compiled and looked ok.

Thanks. I wrote a very similar patch last year which I thought to have sent to Sam, but it seems that I haven't (and since then I forgot about it). Applied now.

Michal