Implement static TLS model for ARM. This includes handling of R_ARM_TLS_IE32 and R_ARM_TLS_LE32 relocs.
Details
Diff Detail
Event Timeline
lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp | ||
---|---|---|
394 | Off topic, but I always wonder if we want to sprinkle debug outputs like this in the ELF writers. They are longer than actual code and might be too verbose. | |
lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp | ||
116 | Can you move the definition of ARMGotAtomContent here as a static local variable? | |
205 | Can ref.target() return a null pointer? If not, you want to use dyn_cast instead of dyn_cast_or_null. | |
lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h | ||
41 | If TP_TLS section is not found, it seems that this line will fail because tpOff has no value. Maybe you want to return a new _tpOff from the innermost block in the for loop and replace this line with llvm_unreachable? Also you might want to use early return. |
lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp | ||
---|---|---|
116 | Good. | |
205 | I think it shouldn't return null pointer. Some implementations use dyn_cast_or_null, this might have confused me. Will change to dyn_cast. | |
lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h | ||
41 | You're right that it's better to have llvm_unreachable than fail with unknown error. Will change. |
lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp | ||
---|---|---|
394 | I occasionally read them to find values used for some related groups of relocs when I don't want to debug or see that this will be faster than debugging. |
Updated:
- reworked the code of tp_off calculation
- replaced dyn_cast_or_null with dyn_cast
Didn't change atom content variables to be static class variables because it becomes inconsistent with other platforms, and there are more places to change, so the diff will grow for no reason. I can update it further in a separate commit if requested.
Updated:
- removed const and mutable in getTPOffset and made style cleanup
- made global variables static and out of anonymous namespace
- use early return in handleTLSIE32
lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h | ||
---|---|---|
33 | I will do that, but I think lazy initialization is the case where using mutables does make sense. |
Off topic, but I always wonder if we want to sprinkle debug outputs like this in the ELF writers. They are longer than actual code and might be too verbose.