-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 35317 |
| Resolution | FIXED |
| Resolved on | Nov 22, 2017 10:17 |
| Version | 5.0 |
| OS | All |
| Blocks | #33840 |
| CC | @rengolin,@TNorthover,@tstellar |
| Fixed by commit(s) | r318788 r318854 |
Extended Description
On CloudABI, I've observed crashes of processes on AArch64 when using Clang 5.0, though Clang 4.0 works perfectly fine. This is due to the changes made in SVN r298851.
On CloudABI, crt0 is responsible for allocating TLS and updating TPIDR_EL0 accordingly. Once completed, it will initialise some of the objects stored in TLS for the initial thread.
Setting up TLS:
- https://github.com/NuxiNL/cloudlibc/blob/master/src/crt/crt0.c#L381-L387
- https://github.com/NuxiNL/cloudlibc/blob/master/src/common/tls.h#L18-L28
Initialising TLS objects for the initial thread:
With the changes made in r298851, mrs TPIDR_EL0 is marked as having no side-effects whatsoever. This is too strong, because an msr TPIDR_EL0 can affect the register's value. In other words, it is all right to combine and reorder mrs TPIDR_EL0 instructions, but we shouldn't be doing this across the msr.
I can imagine that the optimisation provided by r298851 would be worth having. If we want to leave it intact, wouldn't it make more sense to revert to the old behaviour, but assume that functions called in other compilation units will not clobber TPIDR_EL0?
If it is hard to fix this on short notice, could we please revert this change for 5.0.1?