Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Gcc 4.2.2 broken for kernel builds
@ 2007-10-12 17:22 Ralf Baechle
  2007-10-12 17:48 ` David Daney
  2007-10-12 22:42 ` David Daney
  0 siblings, 2 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-10-12 17:22 UTC (permalink / raw)
  To: linux-mips

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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 17:22 Gcc 4.2.2 broken for kernel builds Ralf Baechle
@ 2007-10-12 17:48 ` David Daney
  2007-10-12 17:53   ` Ralf Baechle
  2007-10-12 22:42 ` David Daney
  1 sibling, 1 reply; 14+ messages in thread
From: David Daney @ 2007-10-12 17:48 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

Ralf Baechle wrote:
> 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 ...
> 

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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 17:48 ` David Daney
@ 2007-10-12 17:53   ` Ralf Baechle
  2007-10-12 18:33     ` David Daney
  2007-10-12 18:45     ` Martin Michlmayr
  0 siblings, 2 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-10-12 17:53 UTC (permalink / raw)
  To: David Daney; +Cc: linux-mips

On Fri, Oct 12, 2007 at 10:48:54AM -0700, David Daney wrote:
> From: David Daney <ddaney@avtrex.com>
> Date: Fri, 12 Oct 2007 10:48:54 -0700
> To: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> Subject: Re: Gcc 4.2.2 broken for kernel builds
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Ralf Baechle wrote:
> >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 ...
> >
> 
> 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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 17:53   ` Ralf Baechle
@ 2007-10-12 18:33     ` David Daney
  2007-10-12 18:49       ` Ralf Baechle
  2007-10-12 18:45     ` Martin Michlmayr
  1 sibling, 1 reply; 14+ messages in thread
From: David Daney @ 2007-10-12 18:33 UTC (permalink / raw)
  To: Ralf Baechle, MIPS Linux List

Ralf Baechle wrote:
> On Fri, Oct 12, 2007 at 10:48:54AM -0700, David Daney wrote:
>> From: David Daney <ddaney@avtrex.com>
>> Date: Fri, 12 Oct 2007 10:48:54 -0700
>> To: Ralf Baechle <ralf@linux-mips.org>
>> Cc: linux-mips@linux-mips.org
>> Subject: Re: Gcc 4.2.2 broken for kernel builds
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Ralf Baechle wrote:
>>> 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 ...
>>>
>> 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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 17:53   ` Ralf Baechle
  2007-10-12 18:33     ` David Daney
@ 2007-10-12 18:45     ` Martin Michlmayr
  1 sibling, 0 replies; 14+ messages in thread
From: Martin Michlmayr @ 2007-10-12 18:45 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, linux-mips

* Ralf Baechle <ralf@linux-mips.org> [2007-10-12 18:53]:
> > >  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.
-- 
Martin Michlmayr
http://www.cyrius.com/

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 18:33     ` David Daney
@ 2007-10-12 18:49       ` Ralf Baechle
  2007-10-12 19:14         ` Martin Michlmayr
  0 siblings, 1 reply; 14+ messages in thread
From: Ralf Baechle @ 2007-10-12 18:49 UTC (permalink / raw)
  To: David Daney; +Cc: MIPS Linux List

On Fri, Oct 12, 2007 at 11:33:44AM -0700, David Daney wrote:
> From: David Daney <ddaney@avtrex.com>
> Date: Fri, 12 Oct 2007 11:33:44 -0700
> To: Ralf Baechle <ralf@linux-mips.org>,
> 	MIPS Linux List <linux-mips@linux-mips.org>
> Subject: Re: Gcc 4.2.2 broken for kernel builds
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Ralf Baechle wrote:
> >On Fri, Oct 12, 2007 at 10:48:54AM -0700, David Daney wrote:
> >>From: David Daney <ddaney@avtrex.com>
> >>Date: Fri, 12 Oct 2007 10:48:54 -0700
> >>To: Ralf Baechle <ralf@linux-mips.org>
> >>Cc: linux-mips@linux-mips.org
> >>Subject: Re: Gcc 4.2.2 broken for kernel builds
> >>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>
> >>Ralf Baechle wrote:
> >>>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 ...
> >>>
> >>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.

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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 18:49       ` Ralf Baechle
@ 2007-10-12 19:14         ` Martin Michlmayr
  2007-10-12 19:16           ` Ralf Baechle
  2007-10-12 20:33           ` Martin Michlmayr
  0 siblings, 2 replies; 14+ messages in thread
From: Martin Michlmayr @ 2007-10-12 19:14 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, MIPS Linux List

* Ralf Baechle <ralf@linux-mips.org> [2007-10-12 19:49]:
> > 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.
-- 
Martin Michlmayr
http://www.cyrius.com/

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 19:14         ` Martin Michlmayr
@ 2007-10-12 19:16           ` Ralf Baechle
  2007-10-13 10:51             ` Richard Sandiford
  2007-10-24 19:46             ` Martin Michlmayr
  2007-10-12 20:33           ` Martin Michlmayr
  1 sibling, 2 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-10-12 19:16 UTC (permalink / raw)
  To: Martin Michlmayr; +Cc: David Daney, MIPS Linux List

On Fri, Oct 12, 2007 at 09:14:46PM +0200, Martin Michlmayr wrote:

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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 19:14         ` Martin Michlmayr
  2007-10-12 19:16           ` Ralf Baechle
@ 2007-10-12 20:33           ` Martin Michlmayr
  1 sibling, 0 replies; 14+ messages in thread
From: Martin Michlmayr @ 2007-10-12 20:33 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, MIPS Linux List

* Martin Michlmayr <tbm@cyrius.com> [2007-10-12 21:14]:
> 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);
}

-- 
Martin Michlmayr
http://www.cyrius.com/

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 17:22 Gcc 4.2.2 broken for kernel builds Ralf Baechle
  2007-10-12 17:48 ` David Daney
@ 2007-10-12 22:42 ` David Daney
  1 sibling, 0 replies; 14+ messages in thread
From: David Daney @ 2007-10-12 22:42 UTC (permalink / raw)
  To: Ralf Baechle, MIPS Linux List

Ralf Baechle wrote:
> 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

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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 19:16           ` Ralf Baechle
@ 2007-10-13 10:51             ` Richard Sandiford
  2007-10-15 14:59               ` Maciej W. Rozycki
  2007-10-24 19:46             ` Martin Michlmayr
  1 sibling, 1 reply; 14+ messages in thread
From: Richard Sandiford @ 2007-10-13 10:51 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Martin Michlmayr, David Daney, MIPS Linux List

Ralf Baechle <ralf@linux-mips.org> writes:
> On Fri, Oct 12, 2007 at 09:14:46PM +0200, Martin Michlmayr wrote:
>> > 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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-13 10:51             ` Richard Sandiford
@ 2007-10-15 14:59               ` Maciej W. Rozycki
  2007-10-15 16:19                 ` Richard Sandiford
  0 siblings, 1 reply; 14+ messages in thread
From: Maciej W. Rozycki @ 2007-10-15 14:59 UTC (permalink / raw)
  To: Richard Sandiford
  Cc: Ralf Baechle, Martin Michlmayr, David Daney, MIPS Linux List

On Sat, 13 Oct 2007, Richard Sandiford wrote:

> 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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-15 14:59               ` Maciej W. Rozycki
@ 2007-10-15 16:19                 ` Richard Sandiford
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Sandiford @ 2007-10-15 16:19 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Ralf Baechle, Martin Michlmayr, David Daney, MIPS Linux List

"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> On Sat, 13 Oct 2007, Richard Sandiford wrote:
>> 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

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

* Re: Gcc 4.2.2 broken for kernel builds
  2007-10-12 19:16           ` Ralf Baechle
  2007-10-13 10:51             ` Richard Sandiford
@ 2007-10-24 19:46             ` Martin Michlmayr
  1 sibling, 0 replies; 14+ messages in thread
From: Martin Michlmayr @ 2007-10-24 19:46 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, MIPS Linux List

* Ralf Baechle <ralf@linux-mips.org> [2007-10-12 20:16]:
> > 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.
-- 
Martin Michlmayr
http://www.cyrius.com/

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

end of thread, other threads:[~2007-10-24 19:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-12 17:22 Gcc 4.2.2 broken for kernel builds Ralf Baechle
2007-10-12 17:48 ` David Daney
2007-10-12 17:53   ` Ralf Baechle
2007-10-12 18:33     ` David Daney
2007-10-12 18:49       ` Ralf Baechle
2007-10-12 19:14         ` Martin Michlmayr
2007-10-12 19:16           ` Ralf Baechle
2007-10-13 10:51             ` Richard Sandiford
2007-10-15 14:59               ` Maciej W. Rozycki
2007-10-15 16:19                 ` Richard Sandiford
2007-10-24 19:46             ` Martin Michlmayr
2007-10-12 20:33           ` Martin Michlmayr
2007-10-12 18:45     ` Martin Michlmayr
2007-10-12 22:42 ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox