------- Comment #20 from jakub at gcc dot gnu dot org 2009-09-15 17:45 ------- See PR41353 for possible explanation. The last patch isn't complete there, I'll post a fixed one once I do some further .debug_info analysis. Anyway, that has nothing to do with this PR, a SYMBOL_REF for a tls symbol can make it into var location expressions and it is always the responsibility of dwarf2out.c to either do something with them or throw them away. Note that ___emutls_v.gomp_tls_data is definitely not what you want to reference, that's not where the actual value is stored, but instead where just some auxiliary info is recorded (pointer to the initial value of that variable, size/alignment info and some internal value where to find the object in a TLS block. For real TLS implementation dwarf2out.c emits DW_OP_GNU_push_tls_address, for emulated it apparently uses in some cases DW_OP_form_tls_address. If you make sure SYMBOL_REF_TLS_MODEL is set to SYMBOL_TLS_EMULATED on such SYMBOL_REFs, then dwarf2out.c will do the right thing.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41357