Sources Bugzilla – Bug 11956
relocation truncated to fit R_MIPS_TLS_GD linking xulrunner
Last modified: 2010-10-20 15:34:08 UTC
Hello, since some time ago (I think all 2.20 versions suffer from this problem too) xulrunner from firefox 3.6.8 (and some older) don't link properly in mips. This happens compiling for ABI n32. r0bertz did some analysis about the problem already two or three months ago, in the binutils mailing list. And we still have not found any solution: http://old.nabble.com/R_MIPS_TLS_GD-reloc-overflow-when-linking->%3Dxulrunner-1.9.1.5-td26755056.html The last binutils I tried was a snapshot from the 12th of August. So here you have the symptom. When linking libxul.so, it reports: ../../staticlib/components/libxpconnect.a(xpcjsruntime.o): In function `XPCJSRuntime::GCCallback(JSContext*, JSGCStatus)': xpcjsruntime.cpp:(.text+0x1514): relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread' ../../staticlib/components/libxpconnect.a(xpcthreadcontext.o): In function `XPCPerThreadData::GetDataImpl(JSContext*)': xpcthreadcontext.cpp:(.text+0x834): relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread' ../../staticlib/components/libnecko.a(nsSocketTransportService2.o): In function `nsSocketTransportService::Shutdown()': nsSocketTransportService2.cpp:(.text+0x1890): relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread' ../../staticlib/components/libnecko.a(nsSocketTransportService2.o): In function `nsSocketTransportService::Init()': nsSocketTransportService2.cpp:(.text+0x19e4): relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread' ../../staticlib/components/libuconv.a(nsCharsetConverterManager.o): In function `nsCharsetConverterManager::GetCharsetAlias(char const*, nsACString_internal&)': nsCharsetConverterManager.cpp:(.text+0xa78): relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread' collect2: ld returned 1 exit status The objects linked have a gcc command-line like this: c++ -o nsRDFResource.o -c -fvisibility=hidden -DMOZ_ENABLE_GTK2 -DMOZ_PLUGINS -DMOZ_XPFE_COMPONENTS -DMOZ_XPINSTALL -DMOZ_JSDEBUGGER -DMOZ_PREF_EXTENSIONS -DMOZ_AUTH_EXTENSION -DMOZ_PERMISSIONS -DMOZ_UNIVERSALCHARDET -DMOZ_FILEVIEW -DMOZ_ENABLE_POSTSCRIPT -DMOZ_SPELLCHECK -DMOZ_ZIPWRITER -DMOZILLA_INTERNAL_API -DOSTYPE=\"Linux2.6.35\" -DOSARCH=Linux -D_IMPL_NS_COM -D_IMPL_NS_STRINGAPI -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -I../../intl/unicharutil/util -I../../config -I../../widget/src/windows -I../../widget/src/build -I. -I. -I../../dist/include -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-long-long -pedantic -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions -DMOZILLA_CLIENT -include ../../mozilla-config.h -Wp,-MD,.deps/nsRDFResource.pp nsRDFResource.cpp The 'c++' linking command line mentions: -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-long-long -pedantic -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions -fPIC -shared Regards, Lluís.
Additional information: I was using gcc 4.5.1, glibc 2.12.1, kernel headers from 2.6.32, all natively built. gcc by default produces code for mips3 n32.
The problem may be related to a TLS variable exported in a shared object (in the global-dynamic way). The TLS variable is gTLSIsMainThread, and the errors from ld come for all the places where it is used. The upstream mozilla people decided to disallow TLS completely on mips due to this binutils problem. More information here: https://bugzilla.mozilla.org/show_bug.cgi?id=528687
http://sourceware.org/ml/binutils/2010-09/msg00042.htm some new findings on the above link
sorry the link should be http://sourceware.org/ml/binutils/2010-09/msg00042.html