public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax section"
@ 2000-12-21 14:47 Steve Tynor
  2001-01-10  0:43 ` [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax sect Jim Wilson
  2001-01-10  0:58 ` Steve Tynor
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Tynor @ 2000-12-21 14:47 UTC (permalink / raw)
  To: linux-ia64

Help!

I am suddenly getting link errors that I cannot explain nor work
around.  

I am using gcc -Wl,--relax -- which _used_ to work around these
relocation errors.

The errors come in two flavors: 

| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o: In function `func1':
| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o(.text+0x1046862): relocation truncated to fit: PCREL21B func2
| ...
| collect2: ld returned 1 exit status


and just plain:

| /usr/bin/ld: can't relax section: No such file or directory
| collect2: ld returned 1 exit status


These are linking different sets of .o files, but with essentially
identical command lines in each case: 

| gcc -Wl,--relax   -o ia64-linux/j2/Static_2_n ./Tjdb-static2/O.ia64-linux_n/plo_0.o ./Tjdb-static2/O.ia64-linux_n/plo_1.o ./Tjdb-static2/O.ia64-linux_n/plo_2.o ./Tjdb-static2/O.ia64-linux_n/P.COM_twr_test_suite/Interp-main.o  -L/u/tynor/Tower/java/ia64-linux/COM/twr/runtime/tjrtl/_OBJ-ia64-linux  /u/tynor/Tower/java/ia64-linux/COM/twr/runtime/tjrtl/_OBJ-ia64-linux/libtjrtl_n.a -rdynamic -lm -ldl -lpthread 


It seems to not matter what toolchain I use.  I've tried both the
bundled gcc:
	gcc version 2.9-ia64-000216-final
	GNU ld version 2.9-ia64-000216-final (with BFD 2.9-ia64-000216-final)
and a newer cygnus snapshot
        gcc version 2.96-ia64-000717 snap 000925
	GNU ld version 2.9-ia64-000717 (with BFD 2.9-ia64-000717))

Compiling with one and linking with the other; compiling and linking
with the same.  Makes no difference. Same link time errors in all four
variants.

Help!  I'm not running out of memory (real or virtual), or disk space.
What's wrong?


Thanks,

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Writing about music is like dancing about architecture. -- Frank Zappa

Steve Tynor		Email:   tynor@atlanta.twr.com
Tower Technology 	WWW:     http://www.towerj.com/



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

* Re: [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax sect
  2000-12-21 14:47 [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax section" Steve Tynor
@ 2001-01-10  0:43 ` Jim Wilson
  2001-01-10  0:58 ` Steve Tynor
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2001-01-10  0:43 UTC (permalink / raw)
  To: linux-ia64

>| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o: In function `func1':
>| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o(.text+0x1046862): relocation truncated to fit: PCREL21B func2
>| ...
>| collect2: ld returned 1 exit status

Do you have a testcase I can look at?  As far as I know, --relax still works.

This problem happens when you are calling a function that is too far away
for the offset in a br.call instruction.  Or jumping to a branch that is too
far away.  This could be a toolchain bug, or it could be a problem with the
program.

>| /usr/bin/ld: can't relax section: No such file or directory
>| collect2: ld returned 1 exit status

This was a temporary problem.  It occurs if you have a toolchain with Richard
Henderson's 2000-10-09 bfd patch for sorting unwind sections, but don't have
his 2000-10-24 bfd patch which makes it work.  I never released a toolchain
with the first patch but not the second.  Perhaps you got a toolchain from
someone else?  Or maybe you applied random patches from some mailing list
to your toolchain?

>        gcc version 2.96-ia64-000717 snap 000925
>	GNU ld version 2.9-ia64-000717 (with BFD 2.9-ia64-000717))

This is 2 months obsolete.  The 001117 snapshot should be used instead of this
one.

Jim


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

* Re: [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax sect
  2000-12-21 14:47 [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax section" Steve Tynor
  2001-01-10  0:43 ` [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax sect Jim Wilson
@ 2001-01-10  0:58 ` Steve Tynor
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Tynor @ 2001-01-10  0:58 UTC (permalink / raw)
  To: linux-ia64

Jim Wilson wrote:

| >| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o: In function `func1':
| >| ./Tjdb-interp2/O.ia64-linux_n/plo_0.o(.text+0x1046862): relocation truncated to fit: PCREL21B func2
| >| ...
| >| collect2: ld returned 1 exit status
| 
| Do you have a testcase I can look at?  As far as I know, --relax still works.
| 
| This problem happens when you are calling a function that is too far away
| for the offset in a br.call instruction.  Or jumping to a branch that is too
| far away.  This could be a toolchain bug, or it could be a problem with the
| program.

Aha! That explains it.  It turns out that the .o files causing the
problem are quite large (the result of linking a bunch of smaller ones
together with "ld -r ...".  By avoiding this and linking the smaller
.o's directly into the executable, I can work around the bug.

| 
| >| /usr/bin/ld: can't relax section: No such file or directory
| >| collect2: ld returned 1 exit status
| 
| This was a temporary problem.  It occurs if you have a toolchain with Richard
| Henderson's 2000-10-09 bfd patch for sorting unwind sections, but don't have
| his 2000-10-24 bfd patch which makes it work.  I never released a toolchain
| with the first patch but not the second.  Perhaps you got a toolchain from
| someone else?  Or maybe you applied random patches from some mailing list
| to your toolchain?

The 2.9 toolchain is stock as it came with TurboLinux 0825.  

The 2.96 toolchain was from your gcc-092500 snapshot with the glibc2.1.3
patch, "patch.022" and a gas and gcc patch that you sent me in email to
address a WAW/WAR dependency I reported a while back.

| 
| >        gcc version 2.96-ia64-000717 snap 000925
| >	GNU ld version 2.9-ia64-000717 (with BFD 2.9-ia64-000717))
| 
| This is 2 months obsolete.  The 001117 snapshot should be used instead of this
| one.

When our hardware is upgraded, we plan to move to newer kernels, newer
glibc's, and (I'm sure!) improved toolchains...

Thanks,
Steve


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

end of thread, other threads:[~2001-01-10  0:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-21 14:47 [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax section" Steve Tynor
2001-01-10  0:43 ` [Linux-ia64] ld --relax, yet still: "relocation truncated to fit: PCREL21B" or "can't relax sect Jim Wilson
2001-01-10  0:58 ` Steve Tynor

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