[PATCH] D132818: [LoongArch] Fixup value adjustment in applyFixup

Ray Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 23:37:20 PDT 2022


wangleiat added a comment.

Thanks for all the comments, I will fix them. :)



================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp:93
+      Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
+    if (Value & 0x3)
+      Ctx.reportError(Fixup.getLoc(), "fixup value must be 4-byte aligned");
----------------
MaskRay wrote:
> `% 4`. The compiler can optimize it
> `% 4`. The compiler can optimize it




================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp:100
+      Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
+    if (Value & 0x3)
+      Ctx.reportError(Fixup.getLoc(), "fixup value must be 4-byte aligned");
----------------
MaskRay wrote:
> `% 4`
> `% 4`




================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp:267
+    case LoongArch::B:
+      FixupKind = LoongArch::fixup_loongarch_b26;
     }
----------------
MaskRay wrote:
> break;
> break;




================
Comment at: llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s:1
+# RUN: not llvm-mc --triple=loongarch64 --filetype=obj %s -o /dev/null |& FileCheck %s
+
----------------
MaskRay wrote:
> `|&` => `2>&1 | `
> 
> Some people's default shell (e.g. some macOS) don't support `|&`
> `|&` => `2>&1 | `
> 
> Some people's default shell (e.g. some macOS) don't support `|&`




================
Comment at: llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s:3
+
+  beq $a0, $a1, far_distant # CHECK: :[[@LINE]]:3: error: fixup value out of range
+  bne $a0, $a1, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 4-byte aligned
----------------
MaskRay wrote:
> `#@LINE`
> 
> `@LINE` is deprecated
> `#@LINE`
> 
> `@LINE` is deprecated




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132818/new/

https://reviews.llvm.org/D132818



More information about the llvm-commits mailing list