Subject: what does "relocation truncated to fit: ELF_LITERAL winstr" from 'ld' mean?
To: NetBSD/alpha Discussion List <port-alpha@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: port-alpha
Date: 08/03/2003 19:01:47
Damn.  Seems the problem has something to do with static-linking, and so
far only on alpha (i.e. this is not a problem on sparc, or i386).

(for tech-toolchain readers I posted my first encounter with this
problem to port-alpha yesterday and this PM I've been trying a few more
approaches -- I'm ultimately trying to build a full alpha distribution
with '-g -static' for debugging)


$ cd usr.sbin/sushi
$ nbmakealpha all                                                                                  
/home/proven/woods/NetBSD-1.6.x-alpha-tools/bin/alpha--netbsd-gcc  -static -o sushi -nostdlib  /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crt0.o /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crtbegin.o sushi.o scandir.o menutree.o scanform.o run.o functions.o handlers.o blabel.o -lutil -lcdk -lform -lcurses -lm -L/home/proven/woods/NetBSD-1.6.x-alpha-obj/proven/work/woods/m-NetBSD-1.6/usr.sbin/pkg_install/lib -linstall -L/home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib  -lgcc -lc -lgcc /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crtend.o
/home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/libcurses.a(instr.o): In function `instr':
/proven/work/woods/m-NetBSD-1.6/lib/libcurses/instr.c:57: relocation truncated to fit: ELF_LITERAL winstr
/home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/libcurses.a(instr.o): In function `mvinstr':
/proven/work/woods/m-NetBSD-1.6/lib/libcurses/instr.c:76: relocation truncated to fit: ELF_LITERAL mvwinstr
/home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/libcurses.a(instr.o): In function `mvwinstr':
/proven/work/woods/m-NetBSD-1.6/lib/libcurses/instr.c:98: relocation truncated to fit: ELF_LITERAL winstr
collect2: ld returned 1 exit status
*** Error code 1

Stop.
nbmake: stopped in /proven/work/woods/m-NetBSD-1.6/usr.sbin/sushi

$ nbmakealpha all LDSTATIC=-g
/home/proven/woods/NetBSD-1.6.x-alpha-tools/bin/alpha--netbsd-gcc  -g -o sushi -nostdlib  /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crt0.o /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crtbegin.o sushi.o scandir.o menutree.o scanform.o run.o functions.o handlers.o blabel.o -lutil -lcdk -lform -lcurses -lm -L/home/proven/woods/NetBSD-1.6.x-alpha-obj/proven/work/woods/m-NetBSD-1.6/usr.sbin/pkg_install/lib -linstall -L/home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib  -lgcc -lc -lgcc /home/proven/woods/NetBSD-1.6.x-alpha-destdir/usr/lib/crtend.o


Further searching reveals that none of the functions mentioned in the
error messages are called by sushi or any of the libraries it calls.
The reason instr.o is loaded is because of several calls to mvwinnstr()
from sushi's run.c.

I thought at first there might be something odd because of the
.gnu.warning.* sections also in instr.o, but that doesn't seem to be the
case, at least not with a simplistic test, and besides there are four
such sections and only three errors (winstr is not mentioned in the
errors)

I don't know enough about ELF to know where to look next.

In the mean time I guess I'll just dynamically link sushi and go on to
see how well the rest of the build goes...

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>