Until very recently, Sun ld required different code sequences for 32-bit TLS GD
and LD thand GNU ld, as documented in The Linker and Libraries Guide:
This went unnoticed for a long time since no GCC testcase exercised those TLS
This changed with the gcc patch discussed at
So to handle Solaris < 11 and older OpenSolaris releases, gas should add support
for those relocs to fix the resulting testsuite failures.
I have a patch for @tlsldmplt ready since that's the part that cannot be worked
around, but will extend it to also handle @tlsgdplt.
Created attachment 6293 [details]
The patch above worked for me. It allowed gcc mainline bootstraps with the
patched gas and Sun ld to complete without regressions on i386-pc-solaris2.
and i386-pc-solaris2.1, fixing the current TLS LD related testcase failures.
It currently lacks testcases, and it appears that it cannot be installed on
it's own: the resulting gld knows enough about the new relocs for the link tests
in gcc/configure.ac to succeed incorrectly, breaking the build later on.
I'll work on the ld side (PR ld/12996) later, but had a very hard time producing
anything even remotely useful when I last tried.