This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Fix inaccurate offsets in PC relative branch instructions
ClosedPublic

Authored by benshi001 on Feb 13 2023, 3:53 AM.

Details

Summary

In avr-gcc, the destination of rjmp label + offset is address
label + offset, while destination of rjmp . + offset is
address_of_rjmp + offset + 2.

Clang is in accordance with avr-gcc for rjmp label + offset, but
emits incorrect destination of rjmp . + offset to address_of_rjmp + offset,
in which the expected offset 2 is missing.

This patch fixes the above issue.

Fixes https://github.com/llvm/llvm-project/issues/60019

Diff Detail

Event Timeline

benshi001 created this revision.Feb 13 2023, 3:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 3:53 AM
benshi001 requested review of this revision.Feb 13 2023, 3:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 3:53 AM
benshi001 edited the summary of this revision. (Show Details)Feb 13 2023, 4:03 AM
benshi001 edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 13 2023, 11:11 PM
This revision was landed with ongoing or failed builds.Feb 14 2023, 12:22 AM
This revision was automatically updated to reflect the committed changes.