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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 20:46:21 PDT 2022


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.


================
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");
----------------
`% 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");
----------------
`% 4`


================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp:267
+    case LoongArch::B:
+      FixupKind = LoongArch::fixup_loongarch_b26;
     }
----------------
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
+
----------------
`|&` => `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
----------------
`#@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