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

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

 



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.

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



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux