Re: [PATCH 2/2] kbuild: modversions for exported asm symbols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 19 Oct 2016 16:59:42 +0200
Arnd Bergmann <arnd@xxxxxxxx> wrote:

> On Wednesday, October 19, 2016 4:50:26 PM CEST Michal Marek wrote:
> > Dne 15.10.2016 v 14:43 Nicholas Piggin napsal(a):  
> > > +# .S file exports must have their C prototypes defined in asm/asm-prototypes.h
> > > +# 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.
> > > +#
> > > +# 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) -D__GENKSYMS__ $(c_flags) -xc - |                                \
> > > +    $(GENKSYMS) $(if $(1), -T $(2))                                         \
> > > +     $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))             \
> > > +     $(if $(KBUILD_PRESERVE),-p)                                            \
> > > +     -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))  
> > 
> > I think it would be cleaner to add the #include to the .S files
> > themselves and grep for both EXPORT_SYMBOL and #include here. The reason
> > is that some files might need additional #includes to allow genksyms to
> > properly expand some function prototypes.
> >   
> 
> This is something I tried earlier, and it wasn't pretty: Some of the assembler
> files rely on -D__ASSEMBLER__  to be set in order to read the right headers,
> but setting that macro means that all of the declarations get skipped.
> 
> I ended up testing for -D__GENKSYMS__ in each .S file, which was also
> rather ugly.

Yeah, I had the same idea as you and Michal too. It's conceptually nicer,
but in practice it turned into a mess. If some architectures wanted to start
protecting their .h files and including them into .S for the prototypes, we
could start parsing those too. Should we do the quick and dirty way for 4.9?

Thanks,
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux