All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: dl8bcu@dl8bcu.de
Cc: rth@twiddle.net, ink@jurassic.park.msu.ru,
	linux-scsi@vger.kernel.org, linux-alpha@vger.kernel.org
Subject: Re: Build error: `.exit.text' referenced in section `.rodata'
Date: Mon, 12 May 2008 09:01:44 -0500	[thread overview]
Message-ID: <1210600904.3078.1.camel@localhost.localdomain> (raw)
In-Reply-To: <20080512115255.GA16942@ds20.borg.net>

On Mon, 2008-05-12 at 11:52 +0000, Thorsten Kranzkowski wrote:
> On Sun, May 11, 2008 at 07:20:07PM +0000, Thorsten Kranzkowski wrote:
> > On Sun, May 11, 2008 at 11:55:07AM -0500, James Bottomley wrote:
> > > On Sun, 2008-05-11 at 15:19 +0000, Thorsten Kranzkowski wrote:
> > > > Hello,
> > > > 
> > > > compiling 2.6.26-rc1 (latest git) on an Alpha DS20 (ev6, everything built in,
> > > > gcc version 4.1.2) fails with the following link errors:
> > > > 
> > > >   CC      init/version.o
> > > >   LD      init/built-in.o
> > > >   LD      .tmp_vmlinux1
> > > > `.exit.text' referenced in section `.rodata' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
> > 
> > 
> > > > I believe the problem is static int sd_major(int major_idx) being inlined
> > > > into exit_sd(). IIUC the switch statement therein uses sort of a jump table.
> > > > And the targets of this jump table can not be resolved because the section
> > > > they live in is just discarded.
> > > 
> > > It's plausible.  However, my version of gcc (4.2.3) doesn't actually
> > > inline this; even when I force it to by adding the inline directive to
> > > sd_major() I don't see the problem.  I suspect it might be a gcc bug
> > > 
> > > > 
> > > > applying this patch makes the problem go away:
> > > > 
> > > > Signed-off-by: Thorsten Kranzkowski <dl8bcu@dl8bcu.de>
> > > > 
> > > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> > > > index 01cefbb..adf79ad 100644
> > > > --- a/drivers/scsi/sd.c
> > > > +++ b/drivers/scsi/sd.c
> > > > @@ -1913,7 +1913,7 @@ err_out:
> > > >   *
> > > >   *	Note: this function unregisters this driver from the scsi mid-level.
> > > >   **/
> > > > -static void __exit exit_sd(void)
> > > > +static void exit_sd(void)
> > > 
> > > We can't really do this because that text genuinely does belong in the
> > > exit section.  We might be able to fix it up on the alpha by just adding
> > > the noinline directive to sd_major.  Does this work?
> > 
> > Yes, this works as well! Thanks!
> > 
> >    text    data     bss     dec     hex filename
> > 6834571  504320  397508 7736399  760c4f vmlinux
> > 6835267  504056  397508 7736831  760dff vmlinux-exit_sd-not-in-.exit.text
> > 
> > Tested-by: Thorsten Kranzkowski <dl8bcu@dl8bcu.de>
> >  
> > Now I'll update gcc and try again with gcc 4.2.3.
> 
> 
> With gcc 4.2.3 I get the same error. The noinline patch fixes it again.
> 
>    text    data     bss     dec     hex filename
> 6721720  624416  397508 7743644  76289c vmlinux-gcc-4.2.3

OK, so it's an unfixed bug in gcc, and it looks to be specific to the
alpha backend.  if the compiler chooses to inline a function, it has to
respect the sectional (and other constraints) of the outer function.
Can someone file a bug report with the relevant compiler people?

Jmaes



  reply	other threads:[~2008-05-12 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11 15:19 Build error: `.exit.text' referenced in section `.rodata' Thorsten Kranzkowski
2008-05-11 16:55 ` James Bottomley
2008-05-11 19:20   ` Thorsten Kranzkowski
2008-05-12 11:52     ` Thorsten Kranzkowski
2008-05-12 14:01       ` James Bottomley [this message]
2008-05-13 14:31         ` Ivan Kokshaysky
2008-05-13 14:59           ` James Bottomley
2008-05-13 20:06             ` Ivan Kokshaysky
2008-05-13 20:51               ` James Bottomley

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=1210600904.3078.1.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=dl8bcu@dl8bcu.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.