public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Matt Mackall <mpm@selenic.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	samr@ravnborg.org
Subject: Re: hwrng: virtio - Rename driver object to remove section mismatch warning
Date: Sat, 12 Dec 2009 01:21:48 +0100	[thread overview]
Message-ID: <20091212002148.GA9586@merkur.ravnborg.org> (raw)
In-Reply-To: <20091211120849.012c43d8.randy.dunlap@oracle.com>

On Fri, Dec 11, 2009 at 12:08:49PM -0800, Randy Dunlap wrote:
> On Fri, 11 Dec 2009 13:25:57 -0600 Matt Mackall wrote:
> 
> > On Fri, 2009-12-11 at 23:36 +0800, Herbert Xu wrote:
> > > Hi:
> > > 
> > > Finally found the cause of the section mismatch warning in hwrng.
> > > Apparently in addition to __devexit_p we now have to name the
> > > variable in a certain way.
> > 
> > That's fairly appalling. Any idea why?
> 
> (I haven't read the rest of this thread..)
> 
> scripts/mod/modpost.c looks for certain variable names to identify
> variables that can have references to other (non-data) sections.
> It's mostly explained there.

Another option is to annotate the relevant variable.

>From init.h:
/* modpost check for section mismatches during the kernel build.
 * A section mismatch happens when there are references from a
 * code or data section to an init section (both code or data).
 * The init sections are (for most archs) discarded by the kernel
 * when early init has completed so all such references are potential bugs.
 * For exit sections the same issue exists.
 * The following markers are used for the cases where the reference to
 * the *init / *exit section (code or data) is valid and will teach
 * modpost not to issue a warning.
 * The markers follow same syntax rules as __init / __initdata. */
#define __ref            __section(.ref.text) noinline
#define __refdata        __section(.ref.data)
#define __refconst       __section(.ref.rodata)

	Sam

  reply	other threads:[~2009-12-12  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 15:36 hwrng: virtio - Rename driver object to remove section mismatch warning Herbert Xu
2009-12-11 19:25 ` Matt Mackall
2009-12-11 20:08   ` Randy Dunlap
2009-12-12  0:21     ` Sam Ravnborg [this message]
2009-12-12  0:33       ` Matt Mackall
2009-12-12  7:21         ` Sam Ravnborg

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=20091212002148.GA9586@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=randy.dunlap@oracle.com \
    --cc=rusty@rustcorp.com.au \
    --cc=samr@ravnborg.org \
    /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