forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xtensa] Improve fixup error messages in asm backend.
Add different diagnotstics messages for different branch relocations fixups.
- Loading branch information
Showing
3 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
0001-Xtensa-Improve-fixup-error-messages-in-asm-backend.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
From c8f321e8f88802dd427bc9772da171d5c889a77d Mon Sep 17 00:00:00 2001 | ||
From: Andrei Safronov <[email protected]> | ||
Date: Thu, 9 Mar 2023 10:30:04 +0300 | ||
Subject: [PATCH] [Xtensa] Improve fixup error messages in asm backend. | ||
|
||
--- | ||
.../Xtensa/MCTargetDesc/XtensaAsmBackend.cpp | 14 +++++++------- | ||
1 file changed, 7 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp | ||
index 4039804b1b58..6981c82e768f 100644 | ||
--- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp | ||
+++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp | ||
@@ -93,7 +93,7 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value, | ||
case Xtensa::fixup_xtensa_branch_6: { | ||
Value -= 4; | ||
if (!isInt<6>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "branch 6-bit fixup value out is of range"); | ||
unsigned Hi2 = (Value >> 4) & 0x3; | ||
unsigned Lo4 = Value & 0xf; | ||
return (Hi2 << 4) | (Lo4 << 12); | ||
@@ -101,36 +101,36 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value, | ||
case Xtensa::fixup_xtensa_branch_8: | ||
Value -= 4; | ||
if (!isInt<8>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "branch 8-bit fixup value out of range"); | ||
return (Value & 0xff); | ||
case Xtensa::fixup_xtensa_branch_12: | ||
Value -= 4; | ||
if (!isInt<12>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "branch 12-bit fixup value out of range"); | ||
return (Value & 0xfff); | ||
case Xtensa::fixup_xtensa_jump_18: | ||
Value -= 4; | ||
if (!isInt<18>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "jump fixup value out of range"); | ||
return (Value & 0x3ffff); | ||
case Xtensa::fixup_xtensa_call_18: | ||
Value -= 4; | ||
if (!isInt<20>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "call fixup value out of range"); | ||
if (Value & 0x3) | ||
Ctx.reportError(Fixup.getLoc(), "fixup value must be 4-byte aligned"); | ||
return (Value & 0xffffc) >> 2; | ||
case Xtensa::fixup_xtensa_loop_8: | ||
Value -= 4; | ||
if (!isUInt<8>(Value)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "loop fixup value out of range"); | ||
return (Value & 0xff); | ||
case Xtensa::fixup_xtensa_l32r_16: | ||
unsigned Offset = Fixup.getOffset(); | ||
if (Offset & 0x3) | ||
Value -= 4; | ||
if (!isInt<18>(Value) && (Value & 0x20000)) | ||
- Ctx.reportError(Fixup.getLoc(), "fixup value out of range"); | ||
+ Ctx.reportError(Fixup.getLoc(), "l32r fixup value out of range"); | ||
if (Value & 0x3) | ||
Ctx.reportError(Fixup.getLoc(), "fixup value must be 4-byte aligned"); | ||
return (Value & 0x3fffc) >> 2; | ||
-- | ||
2.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters