From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ralf Baechle Subject: [SCSI] Avoid ld errors messages by marking sd_major noinline. Date: Sat, 4 Mar 2006 17:12:27 +0000 Message-ID: <20060304171227.GA16799@linux-mips.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ftp.linux-mips.org ([194.74.144.162]:57494 "EHLO ftp.linux-mips.org") by vger.kernel.org with ESMTP id S1751884AbWCDRMf (ORCPT ); Sat, 4 Mar 2006 12:12:35 -0500 Received: from localhost.localdomain ([127.0.0.1]:3209 "EHLO bacchus.dhis.org") by ftp.linux-mips.org with ESMTP id S8133467AbWCDREU (ORCPT ); Sat, 4 Mar 2006 17:04:20 +0000 Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1]) by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k24HCR62023207 for ; Sat, 4 Mar 2006 17:12:27 GMT Received: (from ralf@localhost) by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k24HCRRb023206 for linux-scsi@vger.kernel.org; Sat, 4 Mar 2006 17:12:27 GMT Content-Disposition: inline Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: linux-scsi@vger.kernel.org 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 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) {