linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [SCSI] Avoid ld errors messages by marking sd_major noinline.
@ 2006-03-04 17:16 Ralf Baechle
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2006-03-04 17:16 UTC (permalink / raw)
  To: linux-scsi

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:

^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [SCSI] Avoid ld errors messages by marking sd_major noinline.
@ 2006-03-04 17:12 Ralf Baechle
  2006-03-04 17:15 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2006-03-04 17:12 UTC (permalink / raw)
  To: linux-scsi

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..bee2d0d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -158,6 +158,14 @@ 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)
 {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-04 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-04 17:16 [SCSI] Avoid ld errors messages by marking sd_major noinline Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2006-03-04 17:12 Ralf Baechle
2006-03-04 17:15 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).