[lld] [LLD][RISCV] Fix incorrect call relaxation when mixing +c and -c objects (PR #73977)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 07:48:26 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>
+# CHECK-NEXT: 1264: addi zero, zero, 0
+
+# w/C
+#--- a.s
+ .text
+ .attribute 4, 16
+ .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
+
+# w/o C
+#--- b.s
+ .text
+ .attribute 4, 16
+ .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_zicsr2p0_zifencei2p0"
+ .p2align 5
+ .type foo, at function
+foo:
+ tail foo
+ nop
----------------
preames wrote:
Do you have a specific suggestion? I don't really see why I care that a nop could be produced by relaxation since I'm testing one particular case here, but I'm happy to adjust to your preference.
https://github.com/llvm/llvm-project/pull/73977
More information about the llvm-commits
mailing list