1# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax %s -o %t 2# RUN: llvm-readobj -r -x .alloc_w %t | FileCheck --check-prefixes=CHECK,NORELAX %s 3# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.relax 4# RUN: llvm-readobj -r -x .alloc_w %t.relax | FileCheck --check-prefixes=CHECK,RELAX %s 5 6# RUN: not llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax --defsym ERR=1 %s -o /dev/null 2>&1 | \ 7# RUN: FileCheck %s --check-prefix=ERR 8# RUN: not llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax --defsym ERR=1 %s -o /dev/null 2>&1 | \ 9# RUN: FileCheck %s --check-prefix=ERR 10 11# CHECK: Relocations [ 12# CHECK-NEXT: .rela.alloc_w { 13# RELAX-NEXT: 0x0 R_LARCH_ADD_ULEB128 w1 0x0 14# RELAX-NEXT: 0x0 R_LARCH_SUB_ULEB128 w 0x0 15# RELAX-NEXT: 0x1 R_LARCH_ADD_ULEB128 w2 0x0 16# RELAX-NEXT: 0x1 R_LARCH_SUB_ULEB128 w1 0x0 17# CHECK-NEXT: 0x2 R_LARCH_PCALA_HI20 foo 0x0 18# RELAX-NEXT: 0x2 R_LARCH_RELAX - 0x0 19# CHECK-NEXT: 0x6 R_LARCH_PCALA_LO12 foo 0x0 20# RELAX-NEXT: 0x6 R_LARCH_RELAX - 0x0 21# RELAX-NEXT: 0xA R_LARCH_ADD_ULEB128 w2 0x0 22# RELAX-NEXT: 0xA R_LARCH_SUB_ULEB128 w1 0x0 23# RELAX-NEXT: 0xB R_LARCH_ADD_ULEB128 w2 0x78 24# RELAX-NEXT: 0xB R_LARCH_SUB_ULEB128 w1 0x0 25# RELAX-NEXT: 0xD R_LARCH_ADD_ULEB128 w1 0x0 26# RELAX-NEXT: 0xD R_LARCH_SUB_ULEB128 w2 0x0 27# RELAX-NEXT: 0x17 R_LARCH_ADD_ULEB128 w3 0x6F 28# RELAX-NEXT: 0x17 R_LARCH_SUB_ULEB128 w2 0x0 29# RELAX-NEXT: 0x18 R_LARCH_ADD_ULEB128 w3 0x71 30# RELAX-NEXT: 0x18 R_LARCH_SUB_ULEB128 w2 0x0 31# CHECK-NEXT: } 32# CHECK-NEXT: ] 33 34# CHECK: Hex dump of section '.alloc_w': 35# NORELAX-NEXT: 0x00000000 02080c00 001a8c01 c0020880 01f8ffff 36# NORELAX-NEXT: 0x00000010 ffffffff ffff017f 8101 37# RELAX-NEXT: 0x00000000 00000c00 001a8c01 c0020080 00808080 38# RELAX-NEXT: 0x00000010 80808080 80800000 8000 39 40.section .alloc_w,"ax",@progbits; w: 41.uleb128 w1-w # w1 is later defined in the same section 42.uleb128 w2-w1 # w1 and w2 are separated by a linker relaxable instruction 43w1: 44 la.pcrel $t0, foo 45w2: 46.uleb128 w2-w1 # 0x08 47.uleb128 w2-w1+120 # 0x0180 48.uleb128 -(w2-w1) # 0x01fffffffffffffffff8 49.uleb128 w3-w2+111 # 0x7f 50.uleb128 w3-w2+113 # 0x0181 51w3: 52 53.ifdef ERR 54# ERR: :[[#@LINE+1]]:16: error: .uleb128 expression is not absolute 55.uleb128 extern-w # extern is undefined 56# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute 57.uleb128 w-extern 58# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute 59.uleb128 x-w # x is later defined in another section 60 61.section .alloc_x,"aw",@progbits; x: 62# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute 63.uleb128 y-x 64.section .alloc_y,"aw",@progbits; y: 65# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute 66.uleb128 x-y 67 68# ERR: :[[#@LINE+1]]:10: error: .uleb128 expression is not absolute 69.uleb128 extern 70# ERR: :[[#@LINE+1]]:10: error: .uleb128 expression is not absolute 71.uleb128 y 72.endif 73