This patch adds linker relaxation support for RISC-V to LLD. It contains a framework for relocation relaxation as well as support for relaxing R_RISCV_CALL relocations. This can be optionally enabled using the LLD “-relax” flag also added in this patch.
This patch is very similar in nature to https://reviews.llvm.org/D77694. Large amounts of this code were already written when this patch was posted however able to make use of some of the code in there for parts not yet implemented. Thank you for this @jrtc27. In a future patch, I plan to use this to integrate R_RISCV_ALIGN support.