当链接mips的可执行文件时,我将此错误重定位截断为适合:R_MIPS_TLS_GOTTPREL对`_nl_current_LC_COLLATE'

时间:2014-09-11 11:51:50

标签: c hyperlink mips linker-errors

../../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

我该如何解决?

2 个答案:

答案 0 :(得分:1)

此错误消息可能会显示问题的根本原因:

../../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

您静态链接了一些不希望静态链接的内容。

但链接器错误消息似乎告诉您的是全局偏移表已溢出。我认为GOT中只有64K条目的空间。

答案 1 :(得分:0)

首先:您可能需要与-static-libgcc

相关联

这可能会或可能不会解决您的第二个问题:GOT溢出。

如果错误仍然存​​在(您可能正在编译pic代码?),您可能会使用-mxgot重新编译所有内容