[llvm] [LoongArch] Emit R_LARCH_RELAX when expanding some LoadAddress (PR #72961)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 03:49:22 PST 2023


================
@@ -1,66 +1,110 @@
 # RUN: llvm-mc --triple=loongarch64 %s | FileCheck %s
+# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax %s -o %t
+# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
+# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.relax
+# RUN: llvm-readobj -r %t.relax | FileCheck %s --check-prefixes=RELOC,RELAX
 
 la.abs $a0, sym_abs
 # CHECK:      lu12i.w $a0, %abs_hi20(sym_abs)
 # CHECK-NEXT: ori $a0, $a0, %abs_lo12(sym_abs)
 # CHECK-NEXT: lu32i.d $a0, %abs64_lo20(sym_abs)
 # CHECK-NEXT: lu52i.d $a0, $a0, %abs64_hi12(sym_abs)
+# RELOC:      R_LARCH_ABS_HI20 sym_abs 0x0
----------------
SixWeining wrote:

It's better to add start/end flags like: 
```
# RELOC:          Relocations [
# RELOC-NEXT:       Section ({{.*}}) .rela.text {

... your check goes here

# RELOC-NEXT:       }
# RELOC-NEXT:     ]
```

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


More information about the llvm-commits mailing list