All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: linux-scsi@vger.kernel.org
Subject: [SCSI] Avoid ld errors messages by marking sd_major noinline.
Date: Sat, 4 Mar 2006 17:16:09 +0000	[thread overview]
Message-ID: <20060304171609.GA23288@linux-mips.org> (raw)

Gcc may compile sd_major() using a jump table which it will put into
.rodata.  If also inline sd_major's function body into exit_sd() and
CONFIG_BLK_DEV_SD has been set to y ld is going to discard exit_sd's
code later at link time.  It won't discard the jump table if was put
into another section than .exit.data and so the remaining refernces
to sd_major's function body will result in about 100 lines of non-fatal
linker error messages.  This is avoided by marking sd_major noinline.

Observed on MIPS with GCC 4.0.2 and 4.1.0 but not 3.4.5 and seems
possible on other architectures such as i386.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 9d98723..f1af700 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -158,8 +158,16 @@ static struct scsi_driver sd_template = 
  * for major1, ... 
  * As we stay compatible with our numbering scheme, we can reuse 
  * the well-know SCSI majors 8, 65--71, 136--143.
+ *
+ * Gcc may compile sd_major() using a jump table which it will put into
+ * .rodata.  If also inline sd_major's function body into exit_sd() and
+ * CONFIG_BLK_DEV_SD has been set to y ld is going to discard exit_sd's
+ * code later at link time.  It won't discard the jump table if was put
+ * into another section than .exit.data and so the remaining refernces to
+ * sd_major's function body will result in about 100 lines of non-fatal
+ * linker error messages.  This is avoided by marking sd_major noinline.
  */
-static int sd_major(int major_idx)
+static noinline int sd_major(int major_idx)
 {
 	switch (major_idx) {
 	case 0:

             reply	other threads:[~2006-03-04 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-04 17:16 Ralf Baechle [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-03-04 17:12 [SCSI] Avoid ld errors messages by marking sd_major noinline Ralf Baechle
2006-03-04 17:15 ` Ralf Baechle

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=20060304171609.GA23288@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-scsi@vger.kernel.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 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.