This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld


On Mon, May 23, 2011 at 7:22 PM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> As described in
>
> ? ? ? ?[testsuite] Provide TLS access model testcases
> ? ? ? ?http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01601.html
>
> both the 32 and 64-bit TLS GD and LD execution tests fail on Solaris 2
> with Sun ld unless you have a very recent Solaris 11 version (snv_164).
>
> This happens because the code sequences emitted by GCC don't match those
> expected by Sun ld:
>
> ? ? ? ?32-bit x86: Thread-Local Variable Access
> ? ? ? ?http://download.oracle.com/docs/cd/E19963-01/html/819-0690/chapter8-20.html#gentextid-20367
>
> For GD, one needs to use call x@tlsgdplt here, but call ___tls_get_addr@plt
> works, too.
>
> For LD, one really needs call x@tlsldmplt.
>
> The corresponding R_386_TLS_GD_PLT and R_386_TLS_LDM_PLT relocations are
> not yet handled by binutils.
>
> ? ? ? ?x64: Thread-Local Variable Access
> ? ? ? ?http://download.oracle.com/docs/cd/E19963-01/html/819-0690/chapter8-20.html#chapter8-60
>
> For both GD and LD, one needs to use call __tls_get_addr@plt.
>
> The following patch handles this:
>
> * It autoconfigures support for the @tlsgdplt and @tlsldmplt
> ?relocations: Sun as supports them, while gas doesn't yet. ?I've got a
> ?patch in the works to fix this: while the gas part is easy, I have
> ?serious problems getting the ld side to work properly. ?Unfortunately,
> ?I doubt the binutils maintainers will accept such partial support for
> ?the relocs.
>
> * I'm using a new 'p' code to control the printing of @plt. ?'P' doesn't
> ?work since this is needed in both PIC and non-PIC code.

Since handling of "p" is not conditional (that is, controlled by some
compile flag), it is IMO better to just output correct assembly from
the insn pattern itself.  You will also output lower-case "@plt" which
is IIRC preferred by Sun assebler.

Something like attached (untested) patch.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]