WindChaser
WindChaser

Reputation: 988

Emit only long jump instructions instead of short jump instructions for LLVM

Is there any easy way to make LLVM NOT emit short jump instructions with 1-byte-displacement, like 75 30 JNE +30, eb 1a JMP +1a, etc; instead only emit 4-byte-displacement jump instructions with 3-byte zero paddings, like 0f 85 30 00 00 00 JNE +30, e9 1a 00 00 00 JMPQ +1a, etc., under the x86_64 architecture?

Apparently, this would increase the code size.

Upvotes: 1

Views: 475

Answers (1)

Colin LeMahieu
Colin LeMahieu

Reputation: 618

In X86AsmBackend.cpp there is a function fixupNeedsRelaxation. If you always return true here it should always relax e.g. Change to a full displacement.

Upvotes: 4

Related Questions