[llvm] [AVR] Wrap out-of-bounds relative jumps (PR #118015)
Ben Shi via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 23 17:12:01 PST 2024
================
@@ -86,13 +75,28 @@ static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
/// Adjusts the value of a relative branch target before fixup application.
static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
- uint64_t &Value, MCContext *Ctx = nullptr) {
+ uint64_t &Value, MCContext *Ctx) {
// Jumps are relative to the current instruction.
Value -= 2;
// We have one extra bit of precision because the value is rightshifted by
// one.
- signed_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
+ Size += 1;
+
+ if (!isIntN(Size, Value) &&
+ Ctx->getSubtargetInfo()->hasFeature(AVR::FeatureWrappingRjmp)) {
+ int32_t FlashSize = 0x2000;
----------------
benshi001 wrote:
`const int32`
https://github.com/llvm/llvm-project/pull/118015
More information about the llvm-commits
mailing list