[PATCH] D71820: [lld][RISCV] Print error when encountering R_RISCV_ALIGN

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 17:14:00 PST 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/Arch/RISCV.cpp:231
   case R_RISCV_TPREL_ADD:
     return R_HINT;
+  case R_RISCV_ALIGN:
----------------
I think `R_HINT` is not useful, so I created D71822.


================
Comment at: lld/ELF/Arch/RISCV.cpp:236
+    // delete NOPs to realign.
+    error(getErrorLocation(loc) +
+          "relocation R_RISCV_ALIGN requires unimplemented linker relaxation"
----------------
If you think there are needs (which I think so) to test lld on existing `R_RISCV_ALIGN` relocations,
use `errorOrWarn` so that errors can be downgraded to warnings with --noinhibit-exec.


================
Comment at: lld/ELF/Arch/RISCV.cpp:439
   case R_RISCV_JUMP_SLOT:
+  // Should have already given an error in getRelExpr
+  case R_RISCV_ALIGN:
----------------
Full stop, though the examples above and below (they are inconsistent with other places) do not use it...


================
Comment at: lld/test/ELF/riscv-reloc-align.s:3
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=+relax %s -o %t.o
+# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
----------------
`-unknown-elf` is implied, I think.


================
Comment at: lld/test/ELF/riscv-reloc-align.s:4
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=+relax %s -o %t.o
+# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+
----------------
`-o /dev/null`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71820





More information about the llvm-commits mailing list