This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Don't change g_tls_size after initialization.
ClosedPublic

Authored by timshen on Jan 27 2017, 3:46 PM.

Details

Summary

g_tls_size is not supposed to be changed after initialization. It's not
atomic, not guarded by a lock, nor thread_local. But it's read by
multiple threads.

The reason why it's mutated is mips and powerpc64 specific. We can
implement the same funcitonality without mutating g_tls_size.

I'm not sure how to write a test for this. Please advice. Thanks!

Diff Detail

Repository
rL LLVM

Event Timeline

timshen created this revision.Jan 27 2017, 3:46 PM
kcc edited edge metadata.Jan 27 2017, 3:59 PM

All this code is under defined(mips) || defined(powerpc64)
which means that I don't really know it, sorry.

Please get LGTM from someone else who knows (ore pretends to know) Power and MIPS.

A test would be very very welcome, something with lots of threads, TLS, DSOs, and such.

timshen removed a subscriber: echristo.
echristo accepted this revision.Jan 30 2017, 4:14 PM

LGTM.

-eric

This revision is now accepted and ready to land.Jan 30 2017, 4:14 PM

I actually don't know how to write a test that stably reproduce the failure. Let me submit it first to see if it breaks anything.

This revision was automatically updated to reflect the committed changes.