This is the mail archive of the
mailing list for the GCC project.
[PATCH] Section anchors and thread-local storage
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 25 Nov 2012 14:02:05 -0500
- Subject: [PATCH] Section anchors and thread-local storage
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.
* varasm.c: (use_blocks_for_decl_p): Do not place thread-local symbols
refs in object blocks.
--- varasm.c (revision 193785)
+++ varasm.c (working copy)
@@ -1108,6 +1108,10 @@
if (DECL_INITIAL (decl) == decl)
+ /* Do not place thread-local symbols refs in the object blocks. */
+ if (DECL_TLS_MODEL (decl) != 0)
+ return false;
/* If this decl is an alias, then we don't want to emit a
if (lookup_attribute ("alias", DECL_ATTRIBUTES (decl)))