Skip to contentSkip to conversation

Gcc 4.2.2 broken for kernel builds

DISCUSSION Ralf Baechle 5 participants 14 messages Oct 12, 2007 – Oct 24, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1 make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Ralf

#1 lore raw
Quoted 10 lines · Ralf Baechle

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

Quoted 8 lines

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1 make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Could you file a bug report here:

http://gcc.gnu.org/bugzilla/

If you could include a pointer to the kernel sources you were using and perhaps attach your .config to the bug that might be useful as well.

Thanks,
David Daney

#2 lore raw
Quoted 28 lines · David Daney

From: David Daney <[email protected]>
Date: Fri, 12 Oct 2007 10:48:54 -0700
To: Ralf Baechle <[email protected]>
Cc: [email protected]
Subject: Re: Gcc 4.2.2 broken for kernel builds
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Quoted 11 lines · Ralf Baechle

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

Quoted 8 lines

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value
make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1
make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Quoted 6 lines

Could you file a bug report here:

http://gcc.gnu.org/bugzilla/

If you could include a pointer to the kernel sources you were using and perhaps attach your .config to the bug that might be useful as well.

If I had the time I'd have done that. Short of that posting a warning is what I can do.

Ralf

#3 lore raw
Quoted 27 lines · Ralf Baechle
Quoted 26 lines · David Daney

From: David Daney <[email protected]>
Date: Fri, 12 Oct 2007 10:48:54 -0700
To: Ralf Baechle <[email protected]>
Cc: [email protected]
Subject: Re: Gcc 4.2.2 broken for kernel builds
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Quoted 18 lines · Ralf Baechle

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1 make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Quoted 8 lines
Quoted 5 lines

Could you file a bug report here:

http://gcc.gnu.org/bugzilla/

If you could include a pointer to the kernel sources you were using and perhaps attach your .config to the bug that might be useful as well.

If I had the time I'd have done that. Short of that posting a warning is what I can do.

I opened this bug:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33755

As more information becomes available about this feel free to add it to the GCC bug report.

Thanks,
David Daney

#12 lore raw
In reply to Ralf Baechle
Quoted 6 lines · Ralf Baechle
Quoted 3 lines
Quoted 3 lines

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'

If I had the time I'd have done that. Short of that posting a warning is what I can do.

I cannot reproduce this (using gcc 4.2.2 and linux 2.6.22 with a Cobalt config). Can you append V=1 to make, run the gcc command by hand and append --save-temps. If you send me the .i file I'll make sure all information is added to the bug report David opened.

Signature · 2 lines
Martin Michlmayr
http://www.cyrius.com/
#4 lore raw
In reply to David Daney
Quoted 46 lines · David Daney

From: David Daney <[email protected]>
Date: Fri, 12 Oct 2007 11:33:44 -0700
To: Ralf Baechle <[email protected]>,
MIPS Linux List <[email protected]>
Subject: Re: Gcc 4.2.2 broken for kernel builds
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Quoted 30 lines · Ralf Baechle
Quoted 29 lines · David Daney

From: David Daney <[email protected]>
Date: Fri, 12 Oct 2007 10:48:54 -0700
To: Ralf Baechle <[email protected]>
Cc: [email protected]
Subject: Re: Gcc 4.2.2 broken for kernel builds
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Quoted 11 lines · Ralf Baechle

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

Quoted 8 lines

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value
make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1
make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Could you file a bug report here:

Quoted 7 lines
Quoted 4 lines

http://gcc.gnu.org/bugzilla/

If you could include a pointer to the kernel sources you were using and perhaps attach your .config to the bug that might be useful as well.

If I had the time I'd have done that. Short of that posting a warning is what I can do.

Quoted 6 lines

I opened this bug:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33755

As more information becomes available about this feel free to add it to the GCC bug report.

For the moment the receipe to reproduce is to checkout 7b94a571d6f31ac6303d62c2aafcae40b66f24a3 from the linux-mips.org kernel tree (that's on linux-2.6.18-stable) and build malta_defconfig with gcc 4.2.2 and binutils 2.17 or 2.18, both configured for mipsel-linux.

Ralf

#5 lore raw
Quoted 9 lines · Ralf Baechle
Quoted 4 lines

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33755

As more information becomes available about this feel free to add it to the GCC bug report.

For the moment the receipe to reproduce is to checkout 7b94a571d6f31ac6303d62c2aafcae40b66f24a3 from the linux-mips.org kernel tree (that's on linux-2.6.18-stable) and build malta_defconfig with gcc 4.2.2 and binutils 2.17 or 2.18, both configured for mipsel-linux.

Okay, I can see it. I'll submit a testcase.

Signature · 2 lines
Martin Michlmayr
http://www.cyrius.com/
#6 lore raw
Quoted 6 lines · Martin Michlmayr
Quoted 4 lines

For the moment the receipe to reproduce is to checkout 7b94a571d6f31ac6303d62c2aafcae40b66f24a3 from the linux-mips.org kernel tree (that's on linux-2.6.18-stable) and build malta_defconfig with gcc 4.2.2 and binutils 2.17 or 2.18, both configured for mipsel-linux.

Okay, I can see it. I'll submit a testcase.

Thanks :-)

Ralf

#11 lore raw
In reply to Martin Michlmayr
Quoted 1 line · Martin Michlmayr

Okay, I can see it. I'll submit a testcase.

I submitted the following:

(sid)335:tbm@swarm: ~] gcc-4.2 -c -march=mips32r2 -O2 pr33755.c
(sid)336:tbm@swarm: ~] ld -m elf32ltsmip -r pr33755.o
ld: pr33755.o: Can't find matching LO16 reloc against $LC0' for R_MIPS_GOT16 at 0x521490 in section .text' (sid)337:tbm@swarm: ~] cat pr33755.c
struct mtd_blktrans_ops
{
int (*readsect) (void);
int exiting;
};
static void do_blktrans_request (struct mtd_blktrans_ops *tr, long flags)
{
switch (flags & 1)

    {
    case 0:
      if (tr->readsect ())
        return;
    case 1:
      return;
    default:
      printk ("foo\n");
    }
}

mtd_blktrans_thread (struct mtd_blktrans_ops *tr)
{
long flags;
while (!tr->exiting)

      do_blktrans_request (tr, flags);
}
Signature · 2 lines
Martin Michlmayr
http://www.cyrius.com/
#13 lore raw
In reply to Ralf Baechle
Quoted 2 lines · Ralf Baechle

So it looks as if gcc 4.2.2 is broken for kernel builds resulting in the following error message with binutils 2.18:

It seems to be a GCC problem, not binutils related.

Have you successfully built with 4.2.0 or 4.2.1?

If it is a regression from a previous gcc-4.2.x version I would be inclined to fix it. But if all gcc-4.2.x are broken, I might recommend skipping this version and using 4.3 when it is released.

David Daney

Quoted 18 lines

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: drivers/mtd/.tmp_mtd_blkdevs.o: Can't find matching LO16 reloc against $LC6' for R_MIPS_HI16 at 0x9e0 in section .text'
CC drivers/mtd/chips/chipreg.o

Older binutils throw a more cryptic error message about the bad assembler code generated by gcc:

CC drivers/mtd/mtd_blkdevs.o
mipsel-linux-ld: final link failed: Bad value make[2]: *** [drivers/mtd/mtd_blkdevs.o] Error 1 make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Just as heads up ...

Ralf

#7 lore raw
In reply to Ralf Baechle
Quoted 9 lines · Ralf Baechle
Quoted 6 lines · Martin Michlmayr
Quoted 4 lines

For the moment the receipe to reproduce is to checkout 7b94a571d6f31ac6303d62c2aafcae40b66f24a3 from the linux-mips.org kernel tree (that's on linux-2.6.18-stable) and build malta_defconfig with gcc 4.2.2 and binutils 2.17 or 2.18, both configured for mipsel-linux.

Okay, I can see it. I'll submit a testcase.

Thanks :-)

FWIW, I've added some notes about the underlying cause. I think this could in principle happen with any gcc release.

Richard

#8 lore raw
Quoted 2 lines · Richard Sandiford

FWIW, I've added some notes about the underlying cause. I think this could in principle happen with any gcc release.

It has been seen with GCC 3.4 and IIRC SDE has a hack in binutils to
disable this error as a workaround. I guess the problem has always been there since explicit relocs were added to GCC; it is just it hardly ever happens.

Maciej

#9 lore raw
Quoted 8 lines · Maciej W. Rozycki
Quoted 2 lines · Richard Sandiford

FWIW, I've added some notes about the underlying cause. I think this could in principle happen with any gcc release.

It has been seen with GCC 3.4 and IIRC SDE has a hack in binutils to
disable this error as a workaround. I guess the problem has always been there since explicit relocs were added to GCC; it is just it hardly ever happens.

Agreed. And in options-speak, "explicit relocs" means both -mexplicit-relocs and -msplit-addresses. The associated gas warning was disabled in the initial revision of sourceware binutils:

1.1          (rth      03-May-99): #if 0 /* GCC code motion plus incomplete dead code elimination
1.1          (rth      03-May-99):       can leave a %hi without a %lo.  */
1.1          (rth      03-May-99):        if (pass == 1)
1.1          (rth      03-May-99):          as_warn_where (l->fixp->fx_file, l->fixp->fx_line,
1.1          (rth      03-May-99):                         _("Unmatched %%hi reloc"));
1.1          (rth      03-May-99): #endif

so I think this problem has been seen with GCC 2 as well as 3 and 4.

Richard

#10 lore raw
In reply to Ralf Baechle
Quoted 2 lines · Ralf Baechle
Quoted 1 line

Okay, I can see it. I'll submit a testcase.

Thanks :-)

Note that Richard fixed the bug in SVN today, so it will be in the next release of gcc 4.2.

Signature · 2 lines
Martin Michlmayr
http://www.cyrius.com/