brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · b765e3d Raw
82 lines · plain
1# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=-relax %s -o %t2# RUN: llvm-readobj -r -x .alloc_w %t| FileCheck %s3# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax %s -o %t.relax4# RUN: llvm-readobj -r -x .alloc_w %t.relax | FileCheck %s --check-prefixes=CHECK,RELAX5 6# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=-relax %s -o %t7# RUN: llvm-readobj -r -x .alloc_w %t | FileCheck %s8# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax %s -o %t.relax9# RUN: llvm-readobj -r -x .alloc_w %t.relax | FileCheck %s --check-prefixes=CHECK,RELAX10 11## Test temporary workaround for suppressting relocations for actually-non-foldable12## DWARF v5 DW_LLE_offset_pair/DW_RLE_offset_pair.13# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=-relax -riscv-uleb128-reloc=0 %s -o %t014# RUN: llvm-readobj -r -x .alloc_w %t0 | FileCheck %s --check-prefix=CHECK015# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax -riscv-uleb128-reloc=0 %s -o %t0.relax16# RUN: llvm-readobj -r -x .alloc_w %t0.relax | FileCheck %s --check-prefixes=CHECK0,RELAX017 18# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=-relax --defsym ERR=1 %s -o /dev/null 2>&1 | \19# RUN:   FileCheck %s --check-prefix=ERR20# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax --defsym ERR=1 %s -o /dev/null 2>&1 | \21# RUN:   FileCheck %s --check-prefix=ERR22 23# CHECK0:      Relocations [24# CHECK0-NEXT:   .rela.alloc_w {25# CHECK0-NEXT:     0x2 R_RISCV_CALL_PLT foo 0x026# RELAX0-NEXT:     0x2 R_RISCV_RELAX - 0x027# CHECK0-NEXT:   }28# CHECK0-NEXT: ]29 30# CHECK:      Relocations [31# CHECK-NEXT:   .rela.alloc_w {32# RELAX-NEXT:     0x0 R_RISCV_SET_ULEB128 w1 0x033# RELAX-NEXT:     0x0 R_RISCV_SUB_ULEB128 w 0x034# RELAX-NEXT:     0x1 R_RISCV_SET_ULEB128 w2 0x035# RELAX-NEXT:     0x1 R_RISCV_SUB_ULEB128 w1 0x036# CHECK-NEXT:     0x2 R_RISCV_CALL_PLT foo 0x037# RELAX-NEXT:     0x2 R_RISCV_RELAX - 0x038# RELAX-NEXT:     0xA R_RISCV_SET_ULEB128 w2 0x039# RELAX-NEXT:     0xA R_RISCV_SUB_ULEB128 w1 0x040# RELAX-NEXT:     0xB R_RISCV_SET_ULEB128 w2 0x7841# RELAX-NEXT:     0xB R_RISCV_SUB_ULEB128 w1 0x042# RELAX-NEXT:     0xD R_RISCV_SET_ULEB128 w1 0x043# RELAX-NEXT:     0xD R_RISCV_SUB_ULEB128 w2 0x044# CHECK-NEXT:   }45# CHECK-NEXT: ]46 47## R_RISCV_SET_ULEB128 relocated locations contain values not accounting for linker relaxation.48# CHECK:      Hex dump of section '.alloc_w':49# CHECK-NEXT: 0x00000000 02089700 0000e780 00000880 01f8ffff ................50# CHECK-NEXT: 0x00000010 ffffffff ffff01                     .......51 52.section .alloc_w,"ax",@progbits; w:53.uleb128 w1-w       # w1 is later defined in the same section54.uleb128 w2-w1      # w1 and w2 are separated by a linker relaxable instruction55w1:56  call foo57w2:58.uleb128 w2-w1      # 0x0859.uleb128 w2-w1+120  # 0x018060.uleb128 -(w2-w1)   # 0x01fffffffffffffffff861 62.ifdef ERR63# ERR: :[[#@LINE+1]]:16: error: .uleb128 expression is not absolute64.uleb128 extern-w   # extern is undefined65# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute66.uleb128 w-extern67# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute68.uleb128 x-w        # x is later defined in another section69 70.section .alloc_x,"aw",@progbits; x:71# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute72.uleb128 y-x73.section .alloc_y,"aw",@progbits; y:74# ERR: :[[#@LINE+1]]:11: error: .uleb128 expression is not absolute75.uleb128 x-y76 77# ERR: :[[#@LINE+1]]:10: error: .uleb128 expression is not absolute78.uleb128 extern79# ERR: :[[#@LINE+1]]:10: error: .uleb128 expression is not absolute80.uleb128 y81.endif82