public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Michal Marek <mmarek@suse.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
	linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 2/2] kbuild: modversions for exported asm symbols
Date: Wed, 19 Oct 2016 16:59:42 +0200	[thread overview]
Message-ID: <7315031.MmlhY1rulM@wuerfel> (raw)
In-Reply-To: <24ebaba8-d20c-bc2e-8430-599cab2dbb33@suse.com>

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

  reply	other threads:[~2016-10-19 14:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 12:43 [PATCH 0/2] kbuild: CRC versions for asm functions Nicholas Piggin
2016-10-15 12:43 ` [PATCH 1/2] kbuild: modpost warn if export version crc is missing Nicholas Piggin
2016-10-15 12:43 ` [PATCH 2/2] kbuild: modversions for exported asm symbols Nicholas Piggin
2016-10-19 14:50   ` Michal Marek
2016-10-19 14:59     ` Arnd Bergmann [this message]
2016-10-20  3:58       ` Nicholas Piggin
2016-10-20  8:03         ` Arnd Bergmann
2016-10-22 15:36           ` Michal Marek
2016-10-31 11:14             ` Nicholas Piggin
2016-11-01 14:19               ` Michal Marek
2016-11-01 14:21                 ` Michal Marek
2016-11-01 14:36                 ` Nicholas Piggin
2016-11-01 14:44                   ` Michal Marek
2016-11-01 15:50                   ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7315031.MmlhY1rulM@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=npiggin@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox