BeSimpleBeGood
BeSimpleBeGood

Reputation: 21

when linking an executable for mips,I got this error relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_COLLATE'

../../lib/prebuild-octeon/libpq.a(thread.o): In function `pqGetpwuid':
thread.c:(.text+0x1c): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
../../lib/prebuild-octeon/libpq.a(ip.o): In function `pg_getaddrinfo_all':
ip.c:(.text+0x738): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/Cavium_Networks/OCTEON-SDK-2.3/tools-gcc-4.3/bin/../mips64-octeon-linux-gnu/sys-root/usr/lib/../lib64/libc.a(check_fds.o): In function `check_one_fd':
/usr/local/Cavium_Networks/toolchain/glibc/csu/check_fds.c:44: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `__libc_errno'
/usr/local/Cavium_Networks/OCTEON-SDK-2.3/tools-gcc-4.3/bin/../mips64-octeon-linux-gnu/sys-root/usr/lib/../lib64/libc.a(errno-loc.o): In function `__errno_location':
/usr/local/Cavium_Networks/toolchain/glibc/csu/errno-loc.c:36: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `__libc_errno'
/usr/local/Cavium_Networks/OCTEON-SDK-2.3/tools-gcc-4.3/bin/../mips64-octeon-linux-gnu/sys-root/usr/lib/../lib64/libc.a(setlocale.o): In function `setlocale':
/usr/local/Cavium_Networks/toolchain/glibc/locale/setlocale.c:306: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `__libc_errno'
/usr/local/Cavium_Networks/OCTEON-SDK-2.3/tools-gcc-4.3/bin/../mips64-octeon-linux-gnu/sys-root/usr/lib/../lib64/libc.a(setlocale.o): In function `_nl_locale_subfreeres':
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:42: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_COLLATE'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:68: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_CTYPE'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:140: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_MONETARY'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:192: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_NUMERIC'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:206: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_TIME'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:254: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_MESSAGES'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:265: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `_nl_current_LC_PAPER'
/usr/local/Cavium_Networks/toolchain/glibc/locale/categories.def:274: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status

ld version:

GNU ld (Cavium Inc. Version: 2_3_0 build 116) 2.19

how can i to fix it?

Upvotes: 2

Views: 1415

Answers (2)

mfro
mfro

Reputation: 3335

first: you'll probably need to link with -static-libgcc

This might or might not fix your second problem also: GOT overflow.

If the error still persists (you'll probably compiling pic code?), you might get away recompiling everything with -mxgot

Upvotes: 0

markgz
markgz

Reputation: 6266

The root cause of the problem is likely shown by this error message:

../../lib/prebuild-octeon/libpq.a(thread.o): In function `pqGetpwuid':
thread.c:(.text+0x1c): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

You are statically linking something that doesn't want to be statically linked.

But what the linker error messages seem to be telling you is that the global offset table has overflowed. I think there is space for only 64K entries in the GOT.

Upvotes: 1

Related Questions