[PATCH] D71820: [lld][RISCV] Print error when encountering R_RISCV_ALIGN
James Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 18:51:44 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd1da63664f4e: [lld][RISCV] Print error when encountering R_RISCV_ALIGN (authored by jrtc27).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71820/new/
https://reviews.llvm.org/D71820
Files:
lld/ELF/Arch/RISCV.cpp
lld/test/ELF/riscv-reloc-align.s
Index: lld/test/ELF/riscv-reloc-align.s
===================================================================
--- /dev/null
+++ lld/test/ELF/riscv-reloc-align.s
@@ -0,0 +1,12 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax %s -o %t.o
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK: relocation R_RISCV_ALIGN requires unimplemented linker relaxation
+
+.global _start
+_start:
+ nop
+ .balign 8
+ nop
Index: lld/ELF/Arch/RISCV.cpp
===================================================================
--- lld/ELF/Arch/RISCV.cpp
+++ lld/ELF/Arch/RISCV.cpp
@@ -236,9 +236,15 @@
case R_RISCV_TPREL_LO12_S:
return R_TLS;
case R_RISCV_RELAX:
- case R_RISCV_ALIGN:
case R_RISCV_TPREL_ADD:
return R_NONE;
+ case R_RISCV_ALIGN:
+ // Not just a hint; always padded to the worst-case number of NOPs, so may
+ // not currently be aligned, and without linker relaxation support we can't
+ // delete NOPs to realign.
+ errorOrWarn(getErrorLocation(loc) + "relocation R_RISCV_ALIGN requires "
+ "unimplemented linker relaxation; recompile with -mno-relax");
+ return R_NONE;
default:
error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
") against symbol " + toString(s));
@@ -431,7 +437,6 @@
write64le(loc, val - dtpOffset);
break;
- case R_RISCV_ALIGN:
case R_RISCV_RELAX:
return; // Ignored (for now)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71820.239222.patch
Type: text/x-patch
Size: 1459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/483a9a38/attachment.bin>
More information about the llvm-commits
mailing list