Linux MIPS Architecture development
 help / color / mirror / Atom feed
* relocation truncated to fit
@ 2005-05-25  8:51 Jerry
  2005-05-25 10:49 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Jerry @ 2005-05-25  8:51 UTC (permalink / raw)
  To: linux-mips


Hello.
I failed to compile 2.4 kernel with "sound" option, it fails on
command:

mipsel-linux-ld -m elf32ltsmip -G 0 -static -n -T arch/mips/ld.script arch/mips/kernel/head.o arch/mips/kernel/init_task.o init/main.o init/version.o init/do_mounts.o \
        --start-group \
        arch/mips/kernel/kernel.o arch/mips/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o arch/mips/math-emu/fpu_emulator.o arch/mips/pci/pci-core.o \
         drivers/char/char.o drivers/block/block.o drivers/misc/misc.o drivers/net/net.o drivers/sound/sounddrivers.o drivers/pci/driver.o drivers/video/video.o drivers/media/media.o \
        net/network.o \
        arch/mips/lib/lib.a /work/video/kernel/lib/lib.a arch/mips/au1000/pb1200/pb1200.o arch/mips/au1000/common/au1000.o \
        --end-group \
        -o vmlinux
drivers/sound/sounddrivers.o: In function `sound_insert_unit':
sound_core.c:(.text+0x1ac): undefined reference to `strcpy'
sound_core.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_26 against `strcpy'
make[1]: *** [vmlinux] Ошибка 1
make[1]: Leaving directory `/work/video/kernel'
make: *** [vmlinux] Ошибка 2

It's not a "sound drivers" problem, howewer without it kernel compiles
and run succesfully. Seems like gcc/bunitils bug/feature. What have to
be done to eliminate this error?

GNU ld version 2.15.96 20050308
gcc version 3.4.3


   ()_()
 -( ^,^ )- -[21398845]- -<The Bat! 3.0.1.33>- -<25/05/2005 11:39>-
  (") (")

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

* Re: relocation truncated to fit
  2005-05-25  8:51 relocation truncated to fit Jerry
@ 2005-05-25 10:49 ` Ralf Baechle
  2005-05-25 12:39   ` Kumba
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2005-05-25 10:49 UTC (permalink / raw)
  To: Jerry; +Cc: linux-mips

On Wed, May 25, 2005 at 11:51:43AM +0300, Jerry wrote:

> drivers/sound/sounddrivers.o: In function `sound_insert_unit':
> sound_core.c:(.text+0x1ac): undefined reference to `strcpy'
> sound_core.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_26 against `strcpy'
> make[1]: *** [vmlinux] Ошибка 1
> make[1]: Leaving directory `/work/video/kernel'
> make: *** [vmlinux] Ошибка 2
> 
> It's not a "sound drivers" problem, howewer without it kernel compiles
> and run succesfully. Seems like gcc/bunitils bug/feature. What have to
> be done to eliminate this error?
> 
> GNU ld version 2.15.96 20050308
> gcc version 3.4.3

Don't use gcc 3.4 to compile Linux 2.4.  It may work for some kernel
configurations but it will fail for others.

  Ralf

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

* Re: relocation truncated to fit
  2005-05-25 10:49 ` Ralf Baechle
@ 2005-05-25 12:39   ` Kumba
  2005-05-25 13:07     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Kumba @ 2005-05-25 12:39 UTC (permalink / raw)
  To: Jerry; +Cc: Ralf Baechle, linux-mips

Ralf Baechle wrote:
> On Wed, May 25, 2005 at 11:51:43AM +0300, Jerry wrote:
> 
> 
>>drivers/sound/sounddrivers.o: In function `sound_insert_unit':
>>sound_core.c:(.text+0x1ac): undefined reference to `strcpy'
>>sound_core.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_26 against `strcpy'
>>make[1]: *** [vmlinux] Ошибка 1
>>make[1]: Leaving directory `/work/video/kernel'
>>make: *** [vmlinux] Ошибка 2
>>
>>It's not a "sound drivers" problem, howewer without it kernel compiles
>>and run succesfully. Seems like gcc/bunitils bug/feature. What have to
>>be done to eliminate this error?
>>
>>GNU ld version 2.15.96 20050308
>>gcc version 3.4.3
> 
> 
> Don't use gcc 3.4 to compile Linux 2.4.  It may work for some kernel
> configurations but it will fail for others.
> 
>   Ralf

I would've thought this was fixed in 2.4.x now.  You might try using newer 
sources.  The below patch fixes the issue:

http://dev.gentoo.org/~kumba/tmp/gcc-strcpy-fix.patch


As the original patch I found stated about gcc-3.4.x:

From: Jan Hubicka <jh@suse.cz>

GCC now converts sprintf (a,"%s",b) to strcpy.  This lose on kernel as
strcpy is not inlined and not present in library, so one gets linker
failure.  It seems to make sense to apply this optimization by hand.


--Kumba

-- 
"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

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

* Re: relocation truncated to fit
  2005-05-25 12:39   ` Kumba
@ 2005-05-25 13:07     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2005-05-25 13:07 UTC (permalink / raw)
  To: Kumba; +Cc: Jerry, linux-mips

On Wed, May 25, 2005 at 08:39:10AM -0400, Kumba wrote:
> Date:	Wed, 25 May 2005 08:39:10 -0400
> From:	Kumba <kumba@gentoo.org>
> To:	Jerry <jerry@wicomtechnologies.com>
> CC:	Ralf Baechle <ralf@linux-mips.org>,
> 	linux-mips <linux-mips@linux-mips.org>
> Subject: Re: relocation truncated to fit
> Content-Type:	text/plain; charset=UTF-8;
> 
> Ralf Baechle wrote:
> > On Wed, May 25, 2005 at 11:51:43AM +0300, Jerry wrote:
> > 
> > 
> >>drivers/sound/sounddrivers.o: In function `sound_insert_unit':
> >>sound_core.c:(.text+0x1ac): undefined reference to `strcpy'
> >>sound_core.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_26 against `strcpy'
> >>make[1]: *** [vmlinux] Ошибка 1
> >>make[1]: Leaving directory `/work/video/kernel'
> >>make: *** [vmlinux] Ошибка 2
> >>
> >>It's not a "sound drivers" problem, howewer without it kernel compiles
> >>and run succesfully. Seems like gcc/bunitils bug/feature. What have to
> >>be done to eliminate this error?
> >>
> >>GNU ld version 2.15.96 20050308
> >>gcc version 3.4.3
> > 
> > 
> > Don't use gcc 3.4 to compile Linux 2.4.  It may work for some kernel
> > configurations but it will fail for others.
> > 
> >   Ralf
> 
> I would've thought this was fixed in 2.4.x now.  You might try using newer 
> sources.  The below patch fixes the issue:
> 
> http://dev.gentoo.org/~kumba/tmp/gcc-strcpy-fix.patch
> 
> 
> As the original patch I found stated about gcc-3.4.x:
> 
> From: Jan Hubicka <jh@suse.cz>
> 
> GCC now converts sprintf (a,"%s",b) to strcpy.  This lose on kernel as
> strcpy is not inlined and not present in library, so one gets linker
> failure.  It seems to make sense to apply this optimization by hand.

That fixes just the tip of the iceberg.  You want to rebuild with
-ffreestanding which 2.6 already does.  With that applied still some
2.4 kernel configurations will run into a bunch of other gcc 3.4-related
bug and not last loads of warnings.

  Ralf

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

end of thread, other threads:[~2005-05-25 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25  8:51 relocation truncated to fit Jerry
2005-05-25 10:49 ` Ralf Baechle
2005-05-25 12:39   ` Kumba
2005-05-25 13:07     ` Ralf Baechle

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