This is an archive of the discontinued LLVM Phabricator instance.

Add R_HEX_6_X relocation support
ClosedPublic

Authored by sidneym on Aug 8 2018, 7:27 AM.

Details

Summary

This adds support for the R_HEX_6_X relocation type. There are several relocations that have irregular relocation masks, R_HEX_6_X having by far the most.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sidneym created this revision.Aug 8 2018, 7:27 AM
ruiu added inline comments.Aug 8 2018, 11:25 AM
ELF/Arch/Hexagon.cpp
34

Move this into findMaskR6.

78

I'd use the plain C array: static const InstructionMask R6 = { ... };.

103

You should use error() to report an error that can be triggered by a bad input. llvm_unreachable is our version of assert() and that shouldn't be used other than reporting a bug of lld itself.

sidneym updated this revision to Diff 159781.Aug 8 2018, 1:45 PM

Implemented Rui's suggestions.

ruiu accepted this revision.Aug 8 2018, 1:49 PM

LGTM with these changes.

ELF/Arch/Hexagon.cpp
69

nit: remove the blank line.

78

I believe you can remove the struct keyword from this line in C++.

103

Error messages should start with a lowercase letter.

104

Remove Twine().. We have llvm::utohexstr and you can use that.

This revision is now accepted and ready to land.Aug 8 2018, 1:49 PM
sidneym updated this revision to Diff 159810.Aug 8 2018, 3:06 PM

Implement Rui's suggestions.

This revision was automatically updated to reflect the committed changes.