public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* relocation truncated to fit errors
@ 2006-04-01 15:29 Niklaus
  2006-04-01 19:54 ` Niklaus
  2006-04-03  6:31 ` Marius Groeger
  0 siblings, 2 replies; 13+ messages in thread
From: Niklaus @ 2006-04-01 15:29 UTC (permalink / raw)
  To: binutils, crossgcc

Hi,

I setup cross compilation environment for mips and did a make . Why do
i get the last following error relocation truncated to fit errors.

http://www.toppers.jp/download.cgi/jsp-1.4.1.tar.gz is the place where
i got the file.
The first steps are
tar xvzf jsp-1.4.1.tar.gz
cd jsp
./configure -C mips3 -S vr4131
cd cfg
make
cd ..
make depend
make


pro@deb:~/jsp$ make
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./kernel ./config/mips3/exception_vector.S
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
sample1.c
sample1.c: In function `task':
sample1.c:160: warning: division by zero
sample1.c:165: warning: division by zero
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./systask/timer.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./systask/serial.c
In file included from ./systask/serial.c:45:
./config/mips3/vr4131/hw_serial.h: In function `sio_cls_por':
./config/mips3/vr4131/hw_serial.h:115: warning: the address of
`vr4131_dsiu_openflag', will always evaluate as `true'
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./systask/logtask.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./library/log_output.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./library/vasyslog.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./library/t_perror.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./systask ./library/strerror.c
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
kernel_cfg.c
In file included from kernel_cfg.c:27:
./config/mips3/vr4131/hw_serial.h: In function `sio_cls_por':
./config/mips3/vr4131/hw_serial.h:115: warning: the address of
`vr4131_dsiu_openflag', will always evaluate as `true'
mips-deb-linux-gcc -S  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./kernel ./config/mips3/makeoffset.c
./utils/genoffset makeoffset.s > tmpfile3
mv tmpfile3 offset.h
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./kernel ./config/mips3/vr4131/sys_support.S
mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0 
-DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 
-I./kernel ./config/mips3/cpu_support.S
./config/mips3/cpu_support.S: Assembler messages:
./config/mips3/cpu_support.S:133: Warning: No .cprestore pseudo-op
used in PIC code
./config/mips3/cpu_support.S:148: Warning: No .cprestore pseudo-op
used in PIC code
./config/mips3/cpu_support.S:378: Warning: No .cprestore pseudo-op
used in PIC code
./config/mips3/cpu_support.S:238: Warning: Pretending global symbol
used as branch target is local.
./config/mips3/cpu_support.S:267: Warning: Pretending global symbol
used as branch target is local.
./config/mips3/cpu_support.S:561: Error: Cannot branch to undefined symbol.
make: *** [cpu_support.o] Error 1


the file cpu_support.S :561
i have  the instruction
j       call_texrtn

I commented it. I was not sure what i was doing.

Then i got some error saying "elf32-littlemips" , i changed it to
elf32-tradlittlemips because that was what ld supported as a target.
I got the following error . Can anyone help me why this occurs and how
to resolve this .



mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
-I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib 
-T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
                        exception_vector.o  sample1.o     timer.o
serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o 
kernel_cfg.o   libkernel.a   -lgcc
/home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
region ROM0 is full (jsp section .rodata.str1.4)
/home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
section .rodata.str1.4 [00000000a00004dc -> 00000000a0001046] overlaps
section .text [00000000a0000700 -> 00000000a0007faf]
/home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
jsp: section .text lma 0xa0000700 overlaps previous sections
/home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
jsp: section .rodata lma 0xa0007fb0 overlaps previous sections
exception_vector.o:./config/mips3/exception_vector.S:74: relocation
truncated to fit: R_MIPS_GOT16 against `reset'
exception_vector.o:./config/mips3/exception_vector.S:80: relocation
truncated to fit: R_MIPS_GOT16 against `reset'
exception_vector.o:./config/mips3/exception_vector.S:96: relocation
truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
exception_vector.o:./config/mips3/exception_vector.S:112: relocation
truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
exception_vector.o:./config/mips3/exception_vector.S:128: relocation
truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
exception_vector.o:./config/mips3/exception_vector.S:144: relocation
truncated to fit: R_MIPS_GOT16 against `_kernel_general_exception'
libkernel.a(start.o):./config/mips3/start.S:69: relocation truncated
to fit: R_MIPS_GOT16 against `_stack_top'
libkernel.a(start.o):./config/mips3/start.S:73: relocation truncated
to fit: R_MIPS_GOT16 against `_gp'
libkernel.a(start.o):./config/mips3/start.S:114: relocation truncated
to fit: R_MIPS_GOT16 against `hardware_init_hook'
libkernel.a(start.o):./config/mips3/start.S:124: relocation truncated
to fit: R_MIPS_GOT16 against `__bss_start'
libkernel.a(start.o):./config/mips3/start.S:125: additional relocation
overflows omitted from the output
collect2: ld returned 1 exit status
make: *** [jsp] Error 1


Regards
Nik

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

* Re: relocation truncated to fit errors
  2006-04-01 15:29 relocation truncated to fit errors Niklaus
@ 2006-04-01 19:54 ` Niklaus
  2006-04-03  6:31 ` Marius Groeger
  1 sibling, 0 replies; 13+ messages in thread
From: Niklaus @ 2006-04-01 19:54 UTC (permalink / raw)
  To: binutils, crossgcc

On 4/1/06, Niklaus <niklaus@gmail.com> wrote:
> Hi,
>
> I setup cross compilation environment for mips and did a make . Why do
> i get the last following error relocation truncated to fit errors.
>
> http://www.toppers.jp/download.cgi/jsp-1.4.1.tar.gz is the place where
> i got the file.
> The first steps are
> tar xvzf jsp-1.4.1.tar.gz
> cd jsp
> ./configure -C mips3 -S vr4131
> cd cfg
> make
> cd ..
> make depend
> make
>
>
> pro@deb:~/jsp$ make
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./kernel ./config/mips3/exception_vector.S
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> sample1.c
> sample1.c: In function `task':
> sample1.c:160: warning: division by zero
> sample1.c:165: warning: division by zero
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./systask/timer.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./systask/serial.c
> In file included from ./systask/serial.c:45:
> ./config/mips3/vr4131/hw_serial.h: In function `sio_cls_por':
> ./config/mips3/vr4131/hw_serial.h:115: warning: the address of
> `vr4131_dsiu_openflag', will always evaluate as `true'
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./systask/logtask.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./library/log_output.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./library/vasyslog.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./library/t_perror.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./systask ./library/strerror.c
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> kernel_cfg.c
> In file included from kernel_cfg.c:27:
> ./config/mips3/vr4131/hw_serial.h: In function `sio_cls_por':
> ./config/mips3/vr4131/hw_serial.h:115: warning: the address of
> `vr4131_dsiu_openflag', will always evaluate as `true'
> mips-deb-linux-gcc -S  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./kernel ./config/mips3/makeoffset.c
> ./utils/genoffset makeoffset.s > tmpfile3
> mv tmpfile3 offset.h
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./kernel ./config/mips3/vr4131/sys_support.S
> mips-deb-linux-gcc -c  -msoft-float -mgp32 -g -O2 -mips3 -G 0
> -DGDB_STUB -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3
> -I./kernel ./config/mips3/cpu_support.S
> ./config/mips3/cpu_support.S: Assembler messages:
> ./config/mips3/cpu_support.S:133: Warning: No .cprestore pseudo-op
> used in PIC code
> ./config/mips3/cpu_support.S:148: Warning: No .cprestore pseudo-op
> used in PIC code
> ./config/mips3/cpu_support.S:378: Warning: No .cprestore pseudo-op
> used in PIC code
> ./config/mips3/cpu_support.S:238: Warning: Pretending global symbol
> used as branch target is local.
> ./config/mips3/cpu_support.S:267: Warning: Pretending global symbol
> used as branch target is local.
> ./config/mips3/cpu_support.S:561: Error: Cannot branch to undefined symbol.
> make: *** [cpu_support.o] Error 1
>
>
> the file cpu_support.S :561
> i have  the instruction
> j       call_texrtn
>
> I commented it. I was not sure what i was doing.
>
> Then i got some error saying "elf32-littlemips" , i changed it to
> elf32-tradlittlemips because that was what ld supported as a target.
> I got the following error . Can anyone help me why this occurs and how
> to resolve this .
>
>
>
> mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
> -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib
> -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
>                         exception_vector.o  sample1.o     timer.o
> serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o
> kernel_cfg.o   libkernel.a   -lgcc
> /home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
> region ROM0 is full (jsp section .rodata.str1.4)
> /home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
> section .rodata.str1.4 [00000000a00004dc -> 00000000a0001046] overlaps
> section .text [00000000a0000700 -> 00000000a0007faf]
> /home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
> jsp: section .text lma 0xa0000700 overlaps previous sections
> /home/pro/crossenv/bin/../lib/gcc/mips-deb-linux/3.4.6/../../../../mips-deb-linux/bin/ld:
> jsp: section .rodata lma 0xa0007fb0 overlaps previous sections
> exception_vector.o:./config/mips3/exception_vector.S:74: relocation
> truncated to fit: R_MIPS_GOT16 against `reset'
> exception_vector.o:./config/mips3/exception_vector.S:80: relocation
> truncated to fit: R_MIPS_GOT16 against `reset'
> exception_vector.o:./config/mips3/exception_vector.S:96: relocation
> truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
> exception_vector.o:./config/mips3/exception_vector.S:112: relocation
> truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
> exception_vector.o:./config/mips3/exception_vector.S:128: relocation
> truncated to fit: R_MIPS_GOT16 against `_kernel_cpu_experr'
> exception_vector.o:./config/mips3/exception_vector.S:144: relocation
> truncated to fit: R_MIPS_GOT16 against `_kernel_general_exception'
> libkernel.a(start.o):./config/mips3/start.S:69: relocation truncated
> to fit: R_MIPS_GOT16 against `_stack_top'
> libkernel.a(start.o):./config/mips3/start.S:73: relocation truncated
> to fit: R_MIPS_GOT16 against `_gp'
> libkernel.a(start.o):./config/mips3/start.S:114: relocation truncated
> to fit: R_MIPS_GOT16 against `hardware_init_hook'
> libkernel.a(start.o):./config/mips3/start.S:124: relocation truncated
> to fit: R_MIPS_GOT16 against `__bss_start'
> libkernel.a(start.o):./config/mips3/start.S:125: additional relocation
> overflows omitted from the output
> collect2: ld returned 1 exit status
> make: *** [jsp] Error 1
>
Please note i used the -Wa,-xgot options to compile still it failed.
Can someone suggest me a work around. Is there anyway i can increase
the size. If yes where in gcc . Any help would be greatly appreciated.
>
> Regards
> Nik
>

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

* Re: relocation truncated to fit errors
  2006-04-01 15:29 relocation truncated to fit errors Niklaus
  2006-04-01 19:54 ` Niklaus
@ 2006-04-03  6:31 ` Marius Groeger
  2006-04-03  7:01   ` Niklaus
  1 sibling, 1 reply; 13+ messages in thread
From: Marius Groeger @ 2006-04-03  6:31 UTC (permalink / raw)
  To: Niklaus; +Cc: binutils, crossgcc

On Sat, 1 Apr 2006, Niklaus wrote:

> I setup cross compilation environment for mips and did a make . Why do
> i get the last following error relocation truncated to fit errors.
...
> mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
> -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib 
> -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
>                         exception_vector.o  sample1.o     timer.o
> serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o 
> kernel_cfg.o   libkernel.a   -lgcc

What exact --configure target did you use for your cross compiler? It looks
like you've been using mips-linux or mips64-linux. Now, by selecting this
target, you'll get a libgcc which is compiled with -fPIC. Such a libgcc is
meant to be used in Linux userspace and will require a proper initialisation
of the global pointer (symbol _gp IIRC). I'm not sure you're providing that.
What's more, I think it'll also require the main program components be
linked with -fPIC as well, which you are not doing.

I'm aware that this is no directly usable help for you. All I can advise is
to carefully analyse (X-objdump -fph .. and X-objdump -d ..) ALL objects
you're linking to make sure they're compatible with each other.

Regards,
Marius

-- 
Marius Groeger <mgroeger@sysgo.com>
SYSGO AG                      Embedded and Real-Time Software
Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com

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

* Re: relocation truncated to fit errors
  2006-04-03  6:31 ` Marius Groeger
@ 2006-04-03  7:01   ` Niklaus
  2006-04-03 13:52     ` Marius Groeger
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus @ 2006-04-03  7:01 UTC (permalink / raw)
  To: Marius Groeger; +Cc: binutils, crossgcc

On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
> On Sat, 1 Apr 2006, Niklaus wrote:
>
> > I setup cross compilation environment for mips and did a make . Why do
> > i get the last following error relocation truncated to fit errors.
> ...
> > mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
> > -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib
> > -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
> >                         exception_vector.o  sample1.o     timer.o
> > serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o
> > kernel_cfg.o   libkernel.a   -lgcc
>
> What exact --configure target did you use for your cross compiler? It looks
Yes target was mips-deb-linux.
What other targets does it support or do you recommend. I know that it
supports mips64 .

> like you've been using mips-linux or mips64-linux. Now, by selecting this
> target, you'll get a libgcc which is compiled with -fPIC. Such a libgcc is
> meant to be used in Linux userspace and will require a proper initialisation
> of the global pointer (symbol _gp IIRC).

Good piece of information.  I tried writing a hello world program and
few others , it compiled file and i got the a.out. file showed it as
an mips executable.

How do we provide the global pointer _gp.

>I'm not sure you're providing that.
> What's more, I think it'll also require the main program components be
> linked with -fPIC as well, which you are not doing.
>
I am not very sure about this. Can you tell me where i can find more
details about this.

> I'm aware that this is no directly usable help for you. All I can advise is
> to carefully analyse (X-objdump -fph .. and X-objdump -d ..) ALL objects
> you're linking to make sure they're compatible with >each other.
How to check this if they are compatible.

I thought the error was in the linker script but wasn't very sure.

Thanks very much for the help and handholding so far.

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

* Re: relocation truncated to fit errors
  2006-04-03  7:01   ` Niklaus
@ 2006-04-03 13:52     ` Marius Groeger
  2006-04-03 14:22       ` Niklaus
  0 siblings, 1 reply; 13+ messages in thread
From: Marius Groeger @ 2006-04-03 13:52 UTC (permalink / raw)
  To: Niklaus; +Cc: binutils, crossgcc

On Mon, 3 Apr 2006, Niklaus wrote:

> Good piece of information.  I tried writing a hello world program and
> few others , it compiled file and i got the a.out. file showed it as
> an mips executable.
>
> How do we provide the global pointer _gp.

You need some linker script magic for that. As a totally random 
-- albeit visual -- example, take ...ldscripts/elf32ltsmip.x:

   .data1          : { *(.data1) }
   . = .;
   _gp = ALIGN(16) + 0x7ff0;
   .got            : { *(.got.plt) *(.got) }
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so

This will define _gp in a way that it gives you a +/- 0x7ff0 range into the
data segment. I'm not really knowledgable as to the gazillion aspects of
current binutils linker script options, but this should at least give you
some kind of a starting point.

>> I'm not sure you're providing that.
>> What's more, I think it'll also require the main program components be
>> linked with -fPIC as well, which you are not doing.
>>
> I am not very sure about this. Can you tell me where i can find more
> details about this.

info gcc (and make sure you're browsing the info pages of your cross gcc,
not the one installed on your development host!)

>> I'm aware that this is no directly usable help for you. All I can advise is
>> to carefully analyse (X-objdump -fph .. and X-objdump -d ..) ALL objects
>> you're linking to make sure they're compatible with >each other.
> How to check this if they are compatible.

Like I mentioned: run your cross objdump on the object files or the libgcc.a
and scan the object's flags. With the -d option, you'll get a dissassembly.
Looking more closely into that, you should find that all compiled C
functions start with initializing the _gp pointer.

> Thanks very much for the help and handholding so far.

Not to worry -- I'm still not feeling like I provide much help here. I'm
afraid you'll have to do quite some digging on your own here...

Regards,
Marius

-- 
Marius Groeger <mgroeger@sysgo.com>
SYSGO AG                      Embedded and Real-Time Software
Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com

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

* Re: relocation truncated to fit errors
  2006-04-03 13:52     ` Marius Groeger
@ 2006-04-03 14:22       ` Niklaus
  2006-04-03 15:25         ` Marius Groeger
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus @ 2006-04-03 14:22 UTC (permalink / raw)
  To: Marius Groeger; +Cc: binutils, crossgcc

On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
> On Mon, 3 Apr 2006, Niklaus wrote:
>
> > Good piece of information.  I tried writing a hello world program and
> > few others , it compiled file and i got the a.out. file showed it as
> > an mips executable.
> >
> > How do we provide the global pointer _gp.
>
> You need some linker script magic for that. As a totally random
> -- albeit visual -- example, take ...ldscripts/elf32ltsmip.x:
>
>    .data1          : { *(.data1) }
>    . = .;
>    _gp = ALIGN(16) + 0x7ff0;
>    .got            : { *(.got.plt) *(.got) }
>    /* We want the small data sections together, so single-instruction offsets
>       can access them all, and initialized data all before uninitialized, so
>
> This will define _gp in a way that it gives you a +/- 0x7ff0 range into the
> data segment. I'm not really knowledgable as to the gazillion aspects of
> current binutils linker script options, but this should at least give you
> some kind of a starting point.
>
> >> I'm not sure you're providing that.
> >> What's more, I think it'll also require the main program components be
> >> linked with -fPIC as well, which you are not doing.
> >>
> > I am not very sure about this. Can you tell me where i can find more
> > details about this.
>
> info gcc (and make sure you're browsing the info pages of your cross gcc,
> not the one installed on your development host!)
>
> >> I'm aware that this is no directly usable help for you. All I can advise is
> >> to carefully analyse (X-objdump -fph .. and X-objdump -d ..) ALL objects
> >> you're linking to make sure they're compatible with >each other.
> > How to check this if they are compatible.
>
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$
mips-deb-linux-objdump -d libgcc.a  | grep __gp
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$
mips-deb-linux-objdump -d libgcc.a  | egrep __gp
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$

In archive libgcc.a:

_muldi3.oS:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <__muldi3>:
   0:   00870018        mult    a0,a3
   4:   00005012        mflo    t2
        ...
  10:   00a70019        multu   a1,a3
  14:   00001010        mfhi    v0
  18:   00001812        mflo    v1
        ...
  24:   00a60018        mult    a1,a2
  28:   00003012        mflo    a2
  2c:   00ca3021        addu    a2,a2,t2
  30:   03e00008        jr      ra
  34:   00c21021        addu    v0,a2,v0
        ...

_negdi2.oS:     file format elf32-tradbigmips

--More--

I don't find any __gp.


> Like I mentioned: run your cross objdump on the object files or the libgcc.a
> and scan the object's flags. With the -d option, you'll get a dissassembly.
> Looking more closely into that, you should find that all compiled C
> functions start with initializing the _gp pointer.
>
> > Thanks very much for the help and handholding so far.
>
> Not to worry -- I'm still not feeling like I provide much help here. I'm
> afraid you'll have to do quite some digging on your own here...
>
> Regards,
> Marius
>
> --
> Marius Groeger <mgroeger@sysgo.com>
> SYSGO AG                      Embedded and Real-Time Software
> Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
> www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com
>
>

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

* Re: relocation truncated to fit errors
  2006-04-03 14:22       ` Niklaus
@ 2006-04-03 15:25         ` Marius Groeger
  2006-04-03 15:29           ` Niklaus
  0 siblings, 1 reply; 13+ messages in thread
From: Marius Groeger @ 2006-04-03 15:25 UTC (permalink / raw)
  To: Niklaus; +Cc: binutils, crossgcc

On Mon, 3 Apr 2006, Niklaus wrote:

> I don't find any __gp.

How about _gp (w/o underscore)?

Regards,
Marius

-- 
Marius Groeger <mgroeger@sysgo.com>
SYSGO AG                      Embedded and Real-Time Software
Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com

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

* Re: relocation truncated to fit errors
  2006-04-03 15:25         ` Marius Groeger
@ 2006-04-03 15:29           ` Niklaus
  2006-04-05 13:45             ` Richard Sandiford
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus @ 2006-04-03 15:29 UTC (permalink / raw)
  To: Marius Groeger; +Cc: binutils, crossgcc

On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
> On Mon, 3 Apr 2006, Niklaus wrote:
>
> > I don't find any __gp.
>
> How about _gp (w/o underscore)?
>
None
pro@deb:~/scripe/cross$ ./bin/mips-deb-linux-objdump -d
./lib/gcc/mips-deb-linux /3.4.6/libgcc.a  | grep gp | more
   0:   3c1c0000        lui     gp,0x0
   4:   279c0000        addiu   gp,gp,0
   8:   0399e021        addu    gp,gp,t9
   c:   8f860000        lw      a2,0(gp)
  44:   8f820000        lw      v0,0(gp)
   0:   3c1c0000        lui     gp,0x0
   4:   279c0000        addiu   gp,gp,0
   8:   0399e021        addu    gp,gp,t9
   c:   8f820000        lw      v0,0(gp)
  cc:   8f820000        lw      v0,0(gp)
   0:   3c1c0000        lui     gp,0x0
   4:   279c0000        addiu   gp,gp,0
   8:   0399e021        addu    gp,gp,t9
   c:   8f820000        lw      v0,0(gp)
  34:   8f820000        lw      v0,0(gp)
   0:   3c1c0000        lui     gp,0x0
   4:   279c0000        addiu   gp,gp,0
   8:   0399e021        addu    gp,gp,t9
   c:   8f820000        lw      v0,0(gp)
  2c:   8f820000        lw      v0,0(gp)
   0:   3c1c0000        lui     gp,0x0
   4:   279c0000        addiu   gp,gp,0
   8:   0399e021        addu    gp,gp,t9
pro@deb:~/scripe/cross$ ./bin/mips-deb-linux-objdump -d
./lib/gcc/mips-deb-linux/3.4.6/libgcc.a  | grep _gp
pro@deb:~/scripe/cross$

> Regards,
> Marius
>
> --
> Marius Groeger <mgroeger@sysgo.com>
> SYSGO AG                      Embedded and Real-Time Software
> Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
> www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com
>
>

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

* Re: relocation truncated to fit errors
  2006-04-03 15:29           ` Niklaus
@ 2006-04-05 13:45             ` Richard Sandiford
  2006-04-05 13:47               ` Niklaus
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Sandiford @ 2006-04-05 13:45 UTC (permalink / raw)
  To: Niklaus; +Cc: Marius Groeger, binutils, crossgcc

Niklaus <niklaus@gmail.com> writes:
> On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
>> On Mon, 3 Apr 2006, Niklaus wrote:
>>
>> > I don't find any __gp.
>>
>> How about _gp (w/o underscore)?
>>
> None
> pro@deb:~/scripe/cross$ ./bin/mips-deb-linux-objdump -d

Use -dr instead of -d.  You should then find that:

> ./lib/gcc/mips-deb-linux /3.4.6/libgcc.a  | grep gp | more
>    0:   3c1c0000        lui     gp,0x0
>    4:   279c0000        addiu   gp,gp,0

...these insns have relocations against _gp_disp.  The linker will
turn _gp_disp into an offset from _gp.

I'm still not sure what it is you're trying to do though.  What is
your target system?  VR413x GNU/Linux?  Or something else?
(I'm saying this as a binutils@ rathern than crossgcc@ reader btw.)

The command line:

> mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
> -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib 
> -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
>                        exception_vector.o  sample1.o     timer.o
> serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o 
> kernel_cfg.o   libkernel.a   -lgcc

(in particular the vr4131_elf_gdb.ld bit) suggests that you're trying
to use a *-elf (bare-metal) linker script with a GNU/Linux compiler,
so I wasn't sure whether your target really was GNU/Linux or not.

Richard

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

* Re: relocation truncated to fit errors
  2006-04-05 13:45             ` Richard Sandiford
@ 2006-04-05 13:47               ` Niklaus
  2006-04-05 13:58                 ` Daniel Jacobowitz
  2006-04-05 15:10                 ` Richard Sandiford
  0 siblings, 2 replies; 13+ messages in thread
From: Niklaus @ 2006-04-05 13:47 UTC (permalink / raw)
  To: binutils, crossgcc, richard

On 4/5/06, Richard Sandiford <richard@codesourcery.com> wrote:
> Niklaus <niklaus@gmail.com> writes:
> > On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
> >> On Mon, 3 Apr 2006, Niklaus wrote:
> >>
> >> > I don't find any __gp.
> >>
> >> How about _gp (w/o underscore)?
> >>
> > None
> > pro@deb:~/scripe/cross$ ./bin/mips-deb-linux-objdump -d
>
> Use -dr instead of -d.  You should then find that:
>
> > ./lib/gcc/mips-deb-linux /3.4.6/libgcc.a  | grep gp | more
> >    0:   3c1c0000        lui     gp,0x0
> >    4:   279c0000        addiu   gp,gp,0
>
> ...these insns have relocations against _gp_disp.  The linker will
> turn _gp_disp into an offset from _gp.
>
Yes it did indeed show up as you said.
   0:   3c1c0000        lui     gp,0x0
                        0: R_MIPS_HI16  _gp_disp
   4:   279c0000        addiu   gp,gp,0
                        4: R_MIPS_LO16  _gp_disp

> I'm still not sure what it is you're trying to do though.  What is
> your target system?  VR413x GNU/Linux?  Or something else?
> (I'm saying this as a binutils@ rathern than crossgcc@ reader btw.)
>
My toolchain was compiled with target system as mips-deb-linux.The
compiled executable is to be loaded on a vr4131 system.
 Is there anything wrong or that is to be changed.  Any suggestions
would be helpful.

./mips-deb-linux-ld: supported targets: elf32-tradbigmips
elf32-tradlittlemips ecoff-bigmips ecoff-littlemips elf32-ntradbigmips
elf64-tradbigmips elf32-ntradlittlemips elf64-tradlittlemips
elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex
binary ihex
./mips-deb-linux-ld: supported emulations: elf32btsmip elf32ltsmip
elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip

> The command line:
>
> > mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
> > -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib
> > -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
> >                        exception_vector.o  sample1.o     timer.o
> > serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o
> > kernel_cfg.o   libkernel.a   -lgcc
>
> (in particular the vr4131_elf_gdb.ld bit) suggests that you're trying
> to use a *-elf (bare-metal) linker script with a GNU/Linux compiler,
> so I wasn't sure whether your target really was GNU/Linux or not.
>
I am using a crosscompiler to build the toppers jsp kernel
http://www.toppers.jp/download.cgi/jsp-1.4.2.tar.gz
The kernel is to be used on vr4131 system.
The target system is vr4131 .I build the cross toolchain with target
mips-deb-linux.
Is there anything wrong or that is to be modified.

> Richard
>

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

* Re: relocation truncated to fit errors
  2006-04-05 13:47               ` Niklaus
@ 2006-04-05 13:58                 ` Daniel Jacobowitz
  2006-04-05 14:20                   ` Niklaus
  2006-04-05 15:10                 ` Richard Sandiford
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2006-04-05 13:58 UTC (permalink / raw)
  To: Niklaus; +Cc: binutils, crossgcc, richard

On Wed, Apr 05, 2006 at 07:15:05PM +0530, Niklaus wrote:
> > (in particular the vr4131_elf_gdb.ld bit) suggests that you're trying
> > to use a *-elf (bare-metal) linker script with a GNU/Linux compiler,
> > so I wasn't sure whether your target really was GNU/Linux or not.
> >
> I am using a crosscompiler to build the toppers jsp kernel
> http://www.toppers.jp/download.cgi/jsp-1.4.2.tar.gz
> The kernel is to be used on vr4131 system.
> The target system is vr4131 .I build the cross toolchain with target
> mips-deb-linux.
> Is there anything wrong or that is to be modified.

Is it supposed to run in userspace under a GNU/Linux kernel?  If not,
you should probably use a mips-elf toolchain, not a mips-linux
toolchain.

JSP looks like a standalone RTOS kernel, so you should be using
mips-elf.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: relocation truncated to fit errors
  2006-04-05 13:58                 ` Daniel Jacobowitz
@ 2006-04-05 14:20                   ` Niklaus
  0 siblings, 0 replies; 13+ messages in thread
From: Niklaus @ 2006-04-05 14:20 UTC (permalink / raw)
  To: Niklaus, binutils, crossgcc

On 4/5/06, Daniel Jacobowitz <drow@false.org> wrote:
> On Wed, Apr 05, 2006 at 07:15:05PM +0530, Niklaus wrote:
> > > (in particular the vr4131_elf_gdb.ld bit) suggests that you're trying
> > > to use a *-elf (bare-metal) linker script with a GNU/Linux compiler,
> > > so I wasn't sure whether your target really was GNU/Linux or not.
> > >
> > I am using a crosscompiler to build the toppers jsp kernel
> > http://www.toppers.jp/download.cgi/jsp-1.4.2.tar.gz
> > The kernel is to be used on vr4131 system.
> > The target system is vr4131 .I build the cross toolchain with target
> > mips-deb-linux.
> > Is there anything wrong or that is to be modified.
>
> Is it supposed to run in userspace under a GNU/Linux kernel?  If not,
> you should probably use a mips-elf toolchain, not a mips-linux
> toolchain.
>
 It is not supposed to run in userspace.  Yes i think i should
probably use a mips-elf toolchain. Moreover i am running it under a
simulator like mips64, should i use the mips-elf toolchain or
mips-deb-linux toolchain

> JSP looks like a standalone RTOS kernel, so you should be using
> mips-elf.

Yes it is a standalone RTOS kernel. So the configure target  should be
mips-elf.

>
> --
> Daniel Jacobowitz
> CodeSourcery
>

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

* Re: relocation truncated to fit errors
  2006-04-05 13:47               ` Niklaus
  2006-04-05 13:58                 ` Daniel Jacobowitz
@ 2006-04-05 15:10                 ` Richard Sandiford
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Sandiford @ 2006-04-05 15:10 UTC (permalink / raw)
  To: Niklaus; +Cc: binutils, crossgcc

Niklaus <niklaus@gmail.com> writes:
>> > mips-deb-linux-gcc  -msoft-float -mgp32 -g -O2 -mips3 -G 0  -DGDB_STUB
>> > -I. -I./include  -I./config/mips3/vr4131 -I./config/mips3 -nostdlib
>> > -T ./config/mips3/vr4131/vr4131_elf_gdb.ld -o jsp \
>> >                        exception_vector.o  sample1.o     timer.o
>> > serial.o logtask.o log_output.o vasyslog.o t_perror.o strerror.o
>> > kernel_cfg.o   libkernel.a   -lgcc
>>
>> (in particular the vr4131_elf_gdb.ld bit) suggests that you're trying
>> to use a *-elf (bare-metal) linker script with a GNU/Linux compiler,
>> so I wasn't sure whether your target really was GNU/Linux or not.
>>
> I am using a crosscompiler to build the toppers jsp kernel
> http://www.toppers.jp/download.cgi/jsp-1.4.2.tar.gz
> The kernel is to be used on vr4131 system.
> The target system is vr4131 .I build the cross toolchain with target
> mips-deb-linux.
> Is there anything wrong or that is to be modified.

It sounds like you should be using either mips-elf or mips64-elf,
depending on whether you want 32-bit or 64-bit code.  From the
options quoted above (particularly -mgp32), I'm assuming you
actually want 32-bit code, so it should be mips-elf.

Note that modern versions of gcc support -march=vr4130.  It's
probably worth using that instead of -mips3: it should produce
significantly better code.  Indeed, if you configure gcc using
--with-arch=vr4130, -march=vr4130 will actually be the default,
and all the gcc target libraries will take advantage of the
VR4130 extensions.

Richard

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

end of thread, other threads:[~2006-04-05 14:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-01 15:29 relocation truncated to fit errors Niklaus
2006-04-01 19:54 ` Niklaus
2006-04-03  6:31 ` Marius Groeger
2006-04-03  7:01   ` Niklaus
2006-04-03 13:52     ` Marius Groeger
2006-04-03 14:22       ` Niklaus
2006-04-03 15:25         ` Marius Groeger
2006-04-03 15:29           ` Niklaus
2006-04-05 13:45             ` Richard Sandiford
2006-04-05 13:47               ` Niklaus
2006-04-05 13:58                 ` Daniel Jacobowitz
2006-04-05 14:20                   ` Niklaus
2006-04-05 15:10                 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).