This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by avl on Nov 24 2019, 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.Nov 24 2019, 10:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2019, 10:18 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper added inline comments.Nov 24 2019, 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.Nov 25 2019, 6:41 AM

addressed comment. applied clang-format. Thanks!

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