I found this, while thinking about coroutines/fibbres/contexts:
Microsoft clearly cater for this, using /GT switch to ensure ‘the address of the TLS array must not be cached or optimized as a common subexpression across a function call’
The reddit link above suggest that:
- rustc doesn’t do this by default (fine)
- rustc has no option to do this
Is this a fundamental limitation of llvm, or of rustc, or just that its not considered?
It would be a handy feature, IMO. Interesting that I have not seen discussion of this relating to Boost context/coroutine/fibre since I would think it might apply anywhere that cannot or does not treat TLS base addresses as volatile.