This is an archive of the discontinued LLVM Phabricator instance.

[ELF][ARM] Represent R_ARM_LDO32 as R_DTPREL instead of R_ABS
ClosedPublic

Authored by MaskRay on Jul 3 2020, 10:06 AM.

Details

Summary

Follow-up to D82899. Note, we need to disable R_DTPREL relaxation
because ARM psABI does not define TLS relaxation.

Diff Detail

Event Timeline

MaskRay created this revision.Jul 3 2020, 10:06 AM

Thanks, will take a look over the weekend. Would like to make sure all is well running some TLS test cases on a native Arm machine, fully expect it to be OK.

psmith accepted this revision.Jul 6 2020, 2:06 AM

LGTM, it looks like it is difficult to generate local dynamic from clang, although it is possible with GCC. I was able to make a test application, that also had the advantage of working for shared libraries and PIE as R_ABS does not in that case.

This revision is now accepted and ready to land.Jul 6 2020, 2:06 AM
grimar added inline comments.Jul 6 2020, 2:29 AM
lld/ELF/Relocations.cpp
241

I've noticed that canRelax is always used with && !config->shared now.
So can it be:

bool canRelax = !config->shared && config->emachine != EM_ARM &&
                config->emachine != EM_HEXAGON &&
                config->emachine != EM_RISCV;
grimar accepted this revision.Jul 6 2020, 2:37 AM

LGTM too (perhaps, with the nit I've mentioned. Up to you).

MaskRay marked an inline comment as done.Jul 6 2020, 9:49 AM
MaskRay added inline comments.
lld/ELF/Relocations.cpp
241

I agree. canRelax does not capture the meaning precisely now. It actually means whether we can transit a TLS model for shared objects (general/local dynamic) to a TLS model for executables (initial/local exec). If we are going to rename the variable, that does not belong this change. I'll do that separately.

This revision was automatically updated to reflect the committed changes.