[PATCH] D159082: [lld][RISCV] Fix --emit-relocs with relaxation

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 19:23:55 PDT 2023


MaskRay added a comment.

Nice!

> [lld][RISCV] Fix --emit-relocs with relaxation

Sorry for some bikeshedding. 
For projects like llvm,clang,lld, I think we omit `[lld]` unless we do treewide cleanup.
And a more specific tag is probably more common, like `[ELF]`.

I think "Implement" or "Support" is better than "Fix" as we don't claim that --emit-relocs for RISC-V is implemented.
We just don't report an error.

GNU ld changes `R_RISCV_RELAX` to `R_RISCV_NONE`. I think keeping `R_RISCV_RELAX` is better. Projects depending on the relocation type should be aware.



================
Comment at: lld/ELF/InputSection.cpp:364
+    struct MapRel {
+      ObjFile<ELFT> *file;
+      Relocation operator()(const RelTy &rel) const {
----------------
indicate nonnull-ness


================
Comment at: lld/test/ELF/riscv-relax-emit-relocs.s:13
+# RUN: llvm-objdump -dr --no-show-raw-insn -M no-aliases 64 | FileCheck %s
+
+## -r should keep original relocations.
----------------
We need `--no-relax` tests. 


================
Comment at: lld/test/ELF/riscv-relax-emit-relocs.s:39
+  call f
+  call f
+f:
----------------
Add alignment directives to create `R_RISCV_ALIGN`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159082



More information about the llvm-commits mailing list