[SCSI] Avoid ld errors messages by marking sd_major noinline.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>

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:
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux