gcc currently generates code that assumes a TOC is smaller than 64k.  A large
TOC requires ld to partition the TOC into groups smaller than 64k with TOC
pointer adjusting stubs inserted on calls between functions using differing TOC
groups.  That works reasonably well except that code generated by gcc for all
TLS models besides local exec uses @got relocs, and these generate GOT entries
that are placed in the first TOC group.  The net result is that functions using
a TOC group other than the first can't access their GOT entries.  ld ought to
generate multiple GOT entries, one in each group.

Also, ld's partitioning of functions into TOC groups could be better.  Current
glibc bsd-_setjmp.o contains a function of just two instructions, "li r1,1; b
__vmx__sigsetjmp_ent;".  Since this object file uses no TOC entries, the
function can be placed in any TOC group, but will cause an error if it happens
to be placed in a different TOC group to __vmx__sigsetjmp_ent as the linker
cannot insert TOC pointer adjusting stubs on plain branches (tail calls).

-- 
           Summary: Automatic multiple TOC and __thread problems
           Product: binutils
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: amodra at gmail dot com
        ReportedBy: amodra at gmail dot com
                CC: bug-binutils at gnu dot org
GCC target triplet: powerpc64-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=11217

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to