------- Comment #21 from iains at gcc dot gnu dot org 2010-05-19 14:48 ------- Created an attachment (id=20701) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20701&action=view) latest..
this is mostly there ... might be worth trying on other platforms for feedback. without the catch-net of expr.c (which covered up several things.. ) When stuff works here it seems to work across the board now (including lto, whopr). three issues: 1/ Finalization of emutls control vars. 2/ Failure to emit constructor for uninitialized control vars. 3/ Small buglet in emutls. strategy for (1) a) finalization of the control vars is cascaded from finalization of the user-land vars in varpool.c b) a mop-up pass is carried out in emutls_final() - this is needed to pick up vars introduced by late passes (in particular by OMP). c) The initializer for init vars is applied and decl-finalized as soon as it is presented (we keep a mark to notice if the user tries to re-init). d) I've reorganized the code in varpool_finalize_decl () to ensure that varpool_enqueue_needed_node () is not done until after all the checks have been carried out for 'needed'. e) Removed some redundant calls to varpool_assemble_pending_decls () from varpool_finalize_decl (). 2. (a) some code re-organization in varasm.c to put all the emutls stuff together. (b) re-wrote the emutls structure to put the pointer at the start. (c) all tls control vars are static and they all need to be constructed - (FWIW DECL_COMMON() was never set anyway)/ 3. I put some comments into emutls.c since I had to figure it out ... and a minor bug that would hit after you reached 32 emutls vars. ---- I'd welcome feedback on the approach(es) and whether it helps on other EMUTLS platforms. ---- What is **NOT** fixed: A>> there is still some leakage in OMP (some interaction with threadprivate) I will carry on looking at that ... B>> PR43602 -- the tree-profile pass generates gimple directly without considering that it might need to be further gimplifed... C>> PR44140 -- although it shows up in a tls test is not realted to these issues. -- iains at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #20688|0 |1 is obsolete| | Attachment #20693|0 |1 is obsolete| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44132