Last Comment Bug 528687 - Linking error on mips/mipsel with patch for bug 521750
: Linking error on mips/mipsel with patch for bug 521750
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: 1.9.1 Branch
: Other Linux
: -- normal (vote)
: mozilla1.9.3a5
Assigned To: Mike Hommey [:glandium]
:
Mentors:
http://sourceware.org/bugzilla/show_b...
Depends on: 728136
Blocks: 521750
  Show dependency treegraph
 
Reported: 2009-11-14 02:16 PST by Mike Hommey [:glandium]
Modified: 2012-02-17 07:36 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (522 bytes, patch)
2010-03-30 00:13 PDT, Mike Hommey [:glandium]
benjamin: review+
Details | Diff | Review

Description Mike Hommey [:glandium] 2009-11-14 02:16:43 PST
The change from bug 521750 broke builds on mips and mipsel with the following error message:

../../staticlib/components/libxpconnect.a(xpcjsruntime.o):/build/buildd/xulrunner-1.9.1.5/js/src/xpconnect/src/xpcjsruntime.cpp:487: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libxpconnect.a(xpcthreadcontext.o):/build/buildd/xulrunner-1.9.1.5/js/src/xpconnect/src/xpcthreadcontext.cpp:493: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libnecko.a(nsSocketTransportService2.o):/build/buildd/xulrunner-1.9.1.5/netwerk/base/src/nsSocketTransportService2.cpp:437: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libnecko.a(nsSocketTransportService2.o):/build/buildd/xulrunner-1.9.1.5/netwerk/base/src/nsSocketTransportService2.cpp:383: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsJSEnvironment.o): In function `DOMGCCallback':
/build/buildd/xulrunner-1.9.1.5/dom/src/base/nsJSEnvironment.cpp:3694: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsDOMScriptObjectFactory.o):/build/buildd/xulrunner-1.9.1.5/dom/src/base/nsDOMScriptObjectFactory.cpp:384: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsDOMThreadService.o):/build/buildd/xulrunner-1.9.1.5/dom/src/threads/nsDOMThreadService.cpp:1153: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsDOMThreadService.o):/build/buildd/xulrunner-1.9.1.5/dom/src/threads/nsDOMThreadService.cpp:687: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsDOMWorkerXHRProxy.o):/build/buildd/xulrunner-1.9.1.5/dom/src/threads/nsDOMWorkerXHRProxy.cpp:901: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
../../staticlib/components/libgklayout.a(nsDOMWorkerXHRProxy.o):/build/buildd/xulrunner-1.9.1.5/dom/src/threads/nsDOMWorkerXHRProxy.cpp:871: relocation truncated to fit: R_MIPS_TLS_GD against `gTLSIsMainThread'
collect2: ld returned 1 exit status

I guess this happens on trunk, too.
Comment 1 Mike Hommey [:glandium] 2009-11-22 13:39:36 PST
So far, investigation seems to indicate this is a bug in binutils with R_MIPS_TLS_GD relocations, which are related to the use of __thread.

I tried several things, one of which was replacing the inline NS_IsMainThread function with a normal function call, which reduced significantly the amount of R_MIPS_TLS_GD relocations. This unfortunately didn't help.

It seems the issue is R_MIPS_TLS_GD relocations not being well supported when the GOTs are significantly filled up. For example, reducing the number of static components does help (especially excluding libgklayout).

So, until binutils is fixed, it looks like the best to do is to simply undefine NS_TLS for mips/mipsel. How would you prefer that to be done ?
Comment 2 Mike Hommey [:glandium] 2010-03-30 00:13:03 PDT
Created attachment 435832 [details] [diff] [review]
Patch
Comment 3 Benjamin Smedberg [:bsmedberg] 2010-04-08 09:15:33 PDT
Comment on attachment 435832 [details] [diff] [review]
Patch

Please add a comment referencing this bug and/or the binutils bug.
Comment 4 Mike Hommey [:glandium] 2010-04-20 00:56:45 PDT
http://hg.mozilla.org/mozilla-central/rev/bfe106e6ca9a
Comment 5 Philip Chee 2012-02-17 07:36:33 PST
According to http://sourceware.org/ml/binutils/2010-09/msg00042.html

"But after changing the max_count in got_per_bfd_arg from 16377 to 12000,
all relocation overflows disappear.

Then I found 12639 is the largest allowable value."

Note You need to log in before you can comment on or make changes to this bug.