This is an archive of the discontinued LLVM Phabricator instance.

[lld][ARM] Add support for 16-bit thumb group relocations
ClosedPublic

Authored by john.brawn on Jun 21 2023, 2:56 AM.

Details

Summary

This adds support for the following relocations:

  • R_ARM_THM_ALU_ABS_G0_NC
  • R_ARM_THM_ALU_ABS_G1_NC
  • R_ARM_THM_ALU_ABS_G2_NC
  • R_ARM_THM_ALU_ABS_G3

Diff Detail

Event Timeline

john.brawn created this revision.Jun 21 2023, 2:56 AM
john.brawn requested review of this revision.Jun 21 2023, 2:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 2:56 AM
peter.smith accepted this revision.Jun 21 2023, 6:57 AM

One tiny nit aside, looks good to me. Please leave some time for MaskRay to take a look.

For reference: the R_ARM_THM_ALU_ABS_G* relocations are defined in the Static Thumb16 Relocations table https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5615static-thumb16-relocations .

lld/ELF/Arch/ARM.cpp
698

All the other uses of ~ in the file are of the form & ~0x00ff . Would be good to keep it consistent.

This revision is now accepted and ready to land.Jun 21 2023, 6:57 AM
MaskRay accepted this revision.Jun 21 2023, 9:46 PM

One tiny nit aside, looks good to me. Please leave some time for MaskRay to take a look.

For reference: the R_ARM_THM_ALU_ABS_G* relocations are defined in the Static Thumb16 Relocations table https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5615static-thumb16-relocations .

Thanks. Looks good to me as well. It would be good to place the link to the summary/commit message.

lld/ELF/Arch/ARM.cpp
690

This may be an instance that duplicating write16(loc, (read16(loc) &~ 0x00ff) | (val & 0xff)); is better than a chain of [[fallthrough]];...

If the case code is close enough, we should not worry much that we made a mistake in the formula.

lld/test/ELF/arm-thumb-alu.s
43

Add -NEXT for all these continuation lines. This will make FileCheck report a better error when something goes wrong.

52

2-space indentation is more common.

This revision was landed with ongoing or failed builds.Jun 23 2023, 5:43 AM
This revision was automatically updated to reflect the committed changes.