[lld] [LLD][RISCV] Fix incorrect call relaxation when mixing +c and -c objects (PR #73977)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 09:55:07 PST 2023


================
@@ -0,0 +1,30 @@
+# REQUIRES: riscv
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax a.s -o a.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=-c,+relax b.s -o b.o
+
+# RUN: ld.lld a.o b.o --shared -o a
+# RUN: llvm-objdump -d --no-show-raw-insn -M no-aliases a | FileCheck %s
+
+## This needs to be a *uncompressed* jal instruction since it came from the
+## source file which does not enable C
+# CHECK-LABEL: <foo>:
+# CHECK-NEXT:    1260: jal zero, 0x1260 <foo>
----------------
MaskRay wrote:

Consider `-Ttext=0x10000` as many `riscv-relax-*` files use.

https://github.com/llvm/llvm-project/pull/73977


More information about the llvm-commits mailing list