[uClibc]Difficulty linking uClibc test apps

Eldridge Mount eldridge at labxtechnologies.com
Wed Jan 8 20:48:30 UTC 2003


Okay, solved my own dilemma for the time being
 the problem was a result
of having the Generate Position-Independent Code option checked, even
though I was not building a shared object.  Which brings me to the next
issue; I can link against uClibc statically, but when I attempt to build
uClibc with shared library support (again, this is for the ColdFire
5272), I get similar errors when the build tries to create libc as a
shared object from libc.a:

make[1]: Entering directory `/home/emount/src/uClibc-0.9.16/libc'
m68k-elf-ar rv ./tmp/libgcc-need.a
Finding missing symbols in libc.a ...
    partial linking...
No missing symbols found.
m68k-elf-ld  -s -shared --warn-common --warn-once -z combreloc
-soname=libc.so.0 -o libuClibc-0.9.16.so \
	--whole-archive ./tmp/libgcc-need.a libc.a --no-whole-archive \
	-init __uClibc_init ..//libc/misc/internals/interp.o \
	/usr/local/lib/gcc-lib/m68k-elf/2.95.3/libgcc.a
libc.a(regex.o)(.text+0xd76): relocation truncated to fit: R_68K_PLT16
islower
libc.a(regex.o)(.text+0xda8): relocation truncated to fit: R_68K_PLT16
ispunct
libc.a(regex.o)(.text+0xe16): relocation truncated to fit: R_68K_PLT16
islower
libc.a(regex.o)(.text+0x14f8): relocation truncated to fit: R_68K_PLT16
realloc
libc.a(regex.o)(.text+0x1592): relocation truncated to fit: R_68K_PLT16
realloc
libc.a(regex.o)(.text+0x174e): relocation truncated to fit: R_68K_PLT16
realloc
libc.a(regex.o)(.text+0x17da): relocation truncated to fit: R_68K_PLT16
realloc


 and so on.  I noticed that during the entire build process, there are
no architecture switches passed to the compiler; out of curiousity, I
tried adding –m5307 to the build and got some VERY interesting results
when it tried to build ldso:

make[2]: Entering directory `/home/emount/src/uClibc-0.9.16/ldso/ldso'
echo "const char *_dl_progname=\""ld-uClibc.so.0"\";" > ldso.h
echo "#include \"m68k/elfinterp.c\"" >> ldso.h
m68k-elf-gcc "-Wall" -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing  -Os -fno-builtin -nostdinc  -D_LIBC  -m5307
-Wa,--bitwise-or -I"/home/emount/src/uClinux-dist/linux-2.4.x"/include
-I../../include -I. -I/usr/local/lib/gcc-lib/m68k-elf/2.95.3/include
-DNDEBUG -fPIC -I. -I./m68k -I../libdl -c m68k/resolve.S -o
m68k/resolve.o
m68k/resolve.S: Assembler messages:
m68k/resolve.S:11: Error: operands mismatch -- statement `moveml
%a0/%a1,%sp at -' ignored
m68k/resolve.S:13: Error: invalid instruction for this architecture;
needs 68020 or 68030 or 68040 or 68060 or cpu32 -- statement `bsrl
_dl_linux_resolver at PLTPC' ignored
m68k/resolve.S:17: Error: operands mismatch -- statement `moveml
%sp at +,%a0/%a1' ignored
m68k/resolve.S:19: Error: invalid operand mode for this architecture;
needs 68020 or higher -- statement `jmp @(%d0)' ignored
make[2]: *** [m68k/resolve.o] Error 1
make[2]: Leaving directory `/home/emount/src/uClibc-0.9.16/ldso/ldso'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/emount/src/uClibc-0.9.16/ldso'
make: *** [_dir_ldso] Error 2

Is it possible that the patches for GCC 2.95.3 for ColdFire do not
properly implement the –fPIC option?  I’m copying this to the uClinux
development group as well, since I obtained the toolchain from
www.uclinux.org.  My apologies if this has already been discussed and/or
beaten to death.

- regards,
Eldridge Mount
Lab X Technologies, LLC

-----Original Message-----
From: uclibc-admin at uclibc.org [mailto:uclibc-admin at uclibc.org] On Behalf
Of Eldridge Mount
Sent: Wednesday, January 08, 2003 11:01 AM
To: uclibc at uclibc.org
Subject: [uClibc]Difficulty linking uClibc test apps

Hello,
I’ve been having difficulty linking even a relatively simple app against
uClibc, so I turned to the test applications.  I am using uClibc-0.9.16,
and the GCC 2.95.3 toolchain for the Motorola ColdFire M5272.  I’m also
using Cygwin as my host development platform, and have been able to
build the uClinux kernel & user apps against uC-libc & boot it up on my
M5272C3 development board.  Here’s what I get when trying to build the
first test app (args) against uClibc:
 
> make TARGET_ARCH=m68k
 
../../extra/gcc-uClibc/m68k-uclibc-gcc -Wall -Os -fomit-frame-pointer
--uclibc-use-build-dir -c arg_test.c -o arg_test.o
../../extra/gcc-uClibc/m68k-uclibc-gcc -s -Wl,-warn-common --static
--uclibc-use-build-dir arg_test.o -o arg_test 
/home/emount/src/uClibc-0.9.16/lib/libc.a(__uClibc_main.o): In function
`__uClibc_start_main':
__uClibc_main.o(.text+0xa8): relocation truncated to fit: R_68K_PLT16
__h_errno_location
collect2: ld returned 1 exit status
 
Typically, I would expect relocation truncated errors to occur when
linking reeeeeallly large binaries, and the –Wl,relax option can take
care of those.  These are similar to the errors I was getting trying to
link my own applications; it seems that any reference to anything in
libc ends up getting truncated.  What’s going on here?  The only
reference I can find to these types of errors in mailing list archives
are valid problems where references are being made across miles and
miles of code space, figuratively speaking.
 
- regards,
Eldridge Mount
Lab X Technologies, LLC





More information about the uClibc mailing list