Message ID | 20161031221445.34e50e69@roar.ozlabs.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 2016-10-31 12:14, Nicholas Piggin wrote: > +# This is convoluted. The .S file must first be preprocessed to run guards and > +# expand names, then the resulting exports must be constructed into plain > +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed > +# to make the genksyms input. > # > # These mirror gensymtypes_c and co above, keep them in synch. > cmd_gensymtypes_S = \ > (echo "\#include <linux/kernel.h>" ; \ > echo "\#include <asm/asm-prototypes.h>" ; \ > - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ > + $(CPP) $(a_flags) $< | \ > + grep ^___EXPORT_SYMBOL | \ > + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ Is this sed pass necessary? Just add -D__GENKSYMS__ also to the first cpp run and EXPORT_SYMBOL will stay intact. Anyway, I'm going to merge your patch 2/2 now. Michal > $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ > $(GENKSYMS) $(if $(1), -T $(2)) \ > $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ > -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2016-11-01 15:19, Michal Marek wrote: > On 2016-10-31 12:14, Nicholas Piggin wrote: >> +# This is convoluted. The .S file must first be preprocessed to run guards and >> +# expand names, then the resulting exports must be constructed into plain >> +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed >> +# to make the genksyms input. >> # >> # These mirror gensymtypes_c and co above, keep them in synch. >> cmd_gensymtypes_S = \ >> (echo "\#include <linux/kernel.h>" ; \ >> echo "\#include <asm/asm-prototypes.h>" ; \ >> - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ >> + $(CPP) $(a_flags) $< | \ >> + grep ^___EXPORT_SYMBOL | \ >> + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ > > Is this sed pass necessary? Just add -D__GENKSYMS__ also to the first > cpp run and EXPORT_SYMBOL will stay intact. > > Anyway, I'm going to merge your patch 2/2 now. Now I noticed you posted a combined patch today. What do you thing about removing the sed call in favor of -D__GENKSYMS__? Thanks, Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 1 Nov 2016 15:19:59 +0100 Michal Marek <mmarek@suse.com> wrote: > On 2016-10-31 12:14, Nicholas Piggin wrote: > > +# This is convoluted. The .S file must first be preprocessed to run guards and > > +# expand names, then the resulting exports must be constructed into plain > > +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed > > +# to make the genksyms input. > > # > > # These mirror gensymtypes_c and co above, keep them in synch. > > cmd_gensymtypes_S = \ > > (echo "\#include <linux/kernel.h>" ; \ > > echo "\#include <asm/asm-prototypes.h>" ; \ > > - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ > > + $(CPP) $(a_flags) $< | \ > > + grep ^___EXPORT_SYMBOL | \ > > + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ > > Is this sed pass necessary? Just add -D__GENKSYMS__ also to the first > cpp run and EXPORT_SYMBOL will stay intact. I can't see how it would work if asm-generic/export.h doesn't have any tests for GENKSYMS. > Anyway, I'm going to merge your patch 2/2 now. Okay. We should come to some resolution of the preprocessing issue too. I'm logging off for tonight, but if you want to tweak or redo the incremental patch, feel free. Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2016-11-01 15:36, Nicholas Piggin wrote: > On Tue, 1 Nov 2016 15:19:59 +0100 > Michal Marek <mmarek@suse.com> wrote: > >> On 2016-10-31 12:14, Nicholas Piggin wrote: >>> +# This is convoluted. The .S file must first be preprocessed to run guards and >>> +# expand names, then the resulting exports must be constructed into plain >>> +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed >>> +# to make the genksyms input. >>> # >>> # These mirror gensymtypes_c and co above, keep them in synch. >>> cmd_gensymtypes_S = \ >>> (echo "\#include <linux/kernel.h>" ; \ >>> echo "\#include <asm/asm-prototypes.h>" ; \ >>> - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ >>> + $(CPP) $(a_flags) $< | \ >>> + grep ^___EXPORT_SYMBOL | \ >>> + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ >> >> Is this sed pass necessary? Just add -D__GENKSYMS__ also to the first >> cpp run and EXPORT_SYMBOL will stay intact. > > I can't see how it would work if asm-generic/export.h doesn't have any > tests for GENKSYMS. You are right, these would have to be added first to mimic the <linux/export.h> behavior. Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2016-11-01 15:36, Nicholas Piggin wrote: > On Tue, 1 Nov 2016 15:19:59 +0100 > Michal Marek <mmarek@suse.com> wrote: > >> On 2016-10-31 12:14, Nicholas Piggin wrote: >>> +# This is convoluted. The .S file must first be preprocessed to run guards and >>> +# expand names, then the resulting exports must be constructed into plain >>> +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed >>> +# to make the genksyms input. >>> # >>> # These mirror gensymtypes_c and co above, keep them in synch. >>> cmd_gensymtypes_S = \ >>> (echo "\#include <linux/kernel.h>" ; \ >>> echo "\#include <asm/asm-prototypes.h>" ; \ >>> - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ >>> + $(CPP) $(a_flags) $< | \ >>> + grep ^___EXPORT_SYMBOL | \ >>> + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ >> >> Is this sed pass necessary? Just add -D__GENKSYMS__ also to the first >> cpp run and EXPORT_SYMBOL will stay intact. > > I can't see how it would work if asm-generic/export.h doesn't have any > tests for GENKSYMS. > >> Anyway, I'm going to merge your patch 2/2 now. > > Okay. We should come to some resolution of the preprocessing issue too. > I'm logging off for tonight, but if you want to tweak or redo the > incremental patch, feel free. I applied the folded patch as is. The preprocessing is not pretty, but the 4.9 regression is more important to be fixed. Thanks, Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 2e512a2..6beeb9e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -321,12 +321,19 @@ $(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) # or a file that it includes, in order to get versioned symbols. We build a # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from # the .S file (with trailing ';'), and run genksyms on that, to extract vers. +# +# This is convoluted. The .S file must first be preprocessed to run guards and +# expand names, then the resulting exports must be constructed into plain +# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed +# to make the genksyms input. # # These mirror gensymtypes_c and co above, keep them in synch. cmd_gensymtypes_S = \ (echo "\#include <linux/kernel.h>" ; \ echo "\#include <asm/asm-prototypes.h>" ; \ - grep EXPORT_SYMBOL $< | sed 's/$$/;/' ) | \ + $(CPP) $(a_flags) $< | \ + grep ^___EXPORT_SYMBOL | \ + sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \ $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ $(GENKSYMS) $(if $(1), -T $(2)) \ $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \