mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Richard Henderson <rth@twiddle.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] alpha: link failure fix
Date: Sat, 21 Jun 2008 22:17:42 +0200	[thread overview]
Message-ID: <20080621201742.GA2061@uranus.ravnborg.org> (raw)
In-Reply-To: <20080620232621.GB8061@jurassic.park.msu.ru>

On Sat, Jun 21, 2008 at 03:26:21AM +0400, Ivan Kokshaysky wrote:
> With built-in scsi disk driver, the final link fails with a following
> error:
> `.exit.text' referenced in section `.rodata' of drivers/built-in.o:
> defined in discarded section `.exit.text' of drivers/built-in.o
> 
> This happens with -Os (CONFIG_CC_OPTIMIZE_FOR_SIZE=y) with all gcc-4
> versions, and also with -O2 and gcc-4.3.
> 
> The problem is in sd.c:sd_major() being inlined into __exit function
> exit_sd(), and the compiler generating a jump table in .rodata section
> for the 'switch' statement in sd_major(). So we have references to
> discarded section.
> 
> Fixed with a big hammer in the form of -fno-jump-tables.
> 
> Note that jump tables vs. discarded sections is a generic problem,
> other architectures are just lucky not to suffer from it.
Most other architectures would only notice when the exit function
is called because they do late discardning og the exit section.
alpha (and sparc) are some of the few architectures that discard exit
section at link time thus you will see this much sooner
than the others.

> But with
> a slightly more complex switch/case statement it can be reproduced
> on x86 as well. So maybe at some point we should consider
> -fno-jump-tables as a generic compile option...
Are the any size penalties here?
I assume there are a minimal performance penalty.

	Sam

  reply	other threads:[~2008-06-21 20:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 23:26 Ivan Kokshaysky
2008-06-21 20:17 ` Sam Ravnborg [this message]
2008-06-24 12:36   ` Ivan Kokshaysky

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=20080621201742.GA2061@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@linux-foundation.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@twiddle.net \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®