This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Use SignExtend when reading R_386_PC8, R_386_PC16 addends.
ClosedPublic

Authored by grimar on Feb 3 2017, 5:40 AM.

Details

Summary

Previously we did not do that. For example, for R_386_PC8,
0xFF addend was not treated as 0xFFFFFFFF(-1),
but was 0x000000FF.

Recently added checks for R_386_PC8/R_386_PC16 failed because of calculation
overflow as a result.

Diff Detail

Event Timeline

grimar created this revision.Feb 3 2017, 5:40 AM
grimar edited the summary of this revision. (Show Details)Feb 3 2017, 5:45 AM
grimar updated this revision to Diff 86970.Feb 3 2017, 8:41 AM
  • Addressed comments, simplified testcase.
ruiu edited edge metadata.Feb 3 2017, 1:12 PM

This does the same thing as https://reviews.llvm.org/D29493. Please merge the two patches.

grimar updated this revision to Diff 87201.Feb 6 2017, 2:06 AM
grimar retitled this revision from [ELF] - Use SignExtend when reading R_386_PC8 addend. to [ELF] - Use SignExtend when reading R_386_PC8, R_386_PC16 addends..
grimar edited the summary of this revision. (Show Details)
  • Merged with D29493 (R_386_PC16 part)
  • Addressed review comments.
grimar updated this revision to Diff 87238.Feb 6 2017, 8:39 AM
  • Addressed review comments.
ruiu added a comment.Feb 6 2017, 9:51 AM

Don't you need to sign-extend not only these two but all operands that have signed values, do you?

This revision was automatically updated to reflect the committed changes.