Page MenuHomePhabricator

[X86][MC] no error diagnostic for out-of-range jrcxz/jecxz/jcxz
ClosedPublic

Authored by avl on Sun, Nov 24, 10:18 PM.

Details

Summary

This is the fix for PR24072:

X86 instructions jrcxz/jecxz/jcxz performs short jumps if rcx/ecx/cx register is 0
The maximum relative offset for a forward short jump is 127 Bytes (0x7F).
The maximum relative offset for a backward short jump is 128 Bytes (0x80).

Gnu assembler warns when the distance of the jump exceeds the maximum but llvm-as does not.

The fix for that problem was already presented for review : D36991
The llvm codebase changed since August of 2017, thus it does not pass
current check-all testing. I limited it for only PCRel fixups and to
not check not-resolved symbols.

Diff Detail

Event Timeline

avl created this revision.Sun, Nov 24, 10:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptSun, Nov 24, 10:18 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper added inline comments.Sun, Nov 24, 10:33 PM
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
122

I think the && should be at the end of the previous line. Can you run this through clang-format?

avl updated this revision to Diff 230894.Mon, Nov 25, 6:41 AM

addressed comment. applied clang-format. Thanks!

This revision is now accepted and ready to land.Mon, Nov 25, 10:31 AM
This revision was automatically updated to reflect the committed changes.