On Sun, Nov 25, 2012 at 02:02:05PM -0500, David Edelsohn wrote:
> I have been working to enable native thread-local storage on AIX. One
> problem I encountered is the AIX assembler has difficulty with the
> anchor symbol for TLS CSECTs. While the section anchors machinery
> uses a separate pool for TLS entries, should section anchor blocks be
> used for TLS symbols at all?
>
> powerpc-linux uses GOT annotations directly and never places TLS
> symbols in the TOC at all. Section anchors seem to be avoided by TLS
> code already. The appended patch rejects TLS symbols for object
> blocks in general. I could add a target hook, but I wanted to propose
> this policy in general before pursing a target-specific hook.
>
> Thanks, David
>
> * varasm.c: (use_blocks_for_decl_p): Do not place thread-local symbols
> refs in object blocks.
>
> Index: varasm.c
> ===================================================================
> --- varasm.c (revision 193785)
> +++ varasm.c (working copy)
> @@ -1108,6 +1108,10 @@
> if (DECL_INITIAL (decl) == decl)
> return false;
>
> + /* Do not place thread-local symbols refs in the object blocks. */
> + if (DECL_TLS_MODEL (decl) != 0)
> + return false;
Do you want to handle TLS_MODEL_EMULATED that way? If not, the test
should be DECL_THREAD_LOCAL_P (decl) (I believe you want that),
if yes, perhaps DECL_TLS_MODEL (decl) != TLS_MODEL_NONE.
Jakub