Re: Build error: `.exit.text' referenced in section `.rodata' | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Sun, May 11, 2008 at 11:55:07AM -0500, James Bottomley wrote:
> On Sun, 2008-05-11 at 15:19 +0000, Thorsten Kranzkowski wrote:
> > Hello,
> >
> > compiling 2.6.26-rc1 (latest git) on an Alpha DS20 (ev6, everything built in,
> > gcc version 4.1.2) fails with the following link errors:
> >
> > CC init/version.o
> > LD init/built-in.o
> > LD .tmp_vmlinux1
> > `.exit.text' referenced in section `.rodata' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
> > I believe the problem is static int sd_major(int major_idx) being inlined
> > into exit_sd(). IIUC the switch statement therein uses sort of a jump table.
> > And the targets of this jump table can not be resolved because the section
> > they live in is just discarded.
>
> It's plausible. However, my version of gcc (4.2.3) doesn't actually
> inline this; even when I force it to by adding the inline directive to
> sd_major() I don't see the problem. I suspect it might be a gcc bug
>
> >
> > applying this patch makes the problem go away:
> >
> > Signed-off-by: Thorsten Kranzkowski <dl8bcu@xxxxxxxxx>
> >
> > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> > index 01cefbb..adf79ad 100644
> > --- a/drivers/scsi/sd.c
> > +++ b/drivers/scsi/sd.c
> > @@ -1913,7 +1913,7 @@ err_out:
> > *
> > * Note: this function unregisters this driver from the scsi mid-level.
> > **/
> > -static void __exit exit_sd(void)
> > +static void exit_sd(void)
>
> We can't really do this because that text genuinely does belong in the
> exit section. We might be able to fix it up on the alpha by just adding
> the noinline directive to sd_major. Does this work?
Yes, this works as well! Thanks!
text data bss dec hex filename
6834571 504320 397508 7736399 760c4f vmlinux
6835267 504056 397508 7736831 760dff vmlinux-exit_sd-not-in-.exit.text
Tested-by: Thorsten Kranzkowski <dl8bcu@xxxxxxxxx>
Now I'll update gcc and try again with gcc 4.2.3.
> James
>
> ---
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 01cefbb..060ba18 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -280,7 +280,7 @@ static struct scsi_driver sd_template = {
> * As we stay compatible with our numbering scheme, we can reuse
> * the well-know SCSI majors 8, 65--71, 136--143.
> */
> -static int sd_major(int major_idx)
> +static noinline int sd_major(int major_idx)
> {
> switch (major_idx) {
> case 0:
>
>
Thorsten.
--
| Thorsten Kranzkowski Internet: dl8bcu@xxxxxxxxx |
| Mobile: ++49 170 1876134 Snail: Kiebitzstr. 14, 49324 Melle, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@xxxxxxxxxxxxxxxxxxxxxx [44.130.8.19] |
--
To unsubscribe from this list: 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
[Site Home] [Kernel Newbies] [Share Photos] [IDE] [Security] [Git] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux ATA RAID] [Samba] [Video 4 Linux] [Device Mapper] [Linux Resources]
![]() |