brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 0bdc1eb Raw
188 lines · plain
1# REQUIRES: riscv2# RUN: rm -rf %t && split-file %s %t && cd %t3# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax a.s -o a.o4# RUN: llvm-readobj -r -x .gcc_except_table -x .debug_rnglists -x .debug_loclists a.o | FileCheck %s --check-prefix=REL5# RUN: ld.lld -shared --gc-sections --noinhibit-exec a.o -o a.so6# RUN: llvm-readelf -x .gcc_except_table -x .debug_rnglists -x .debug_loclists a.so | FileCheck %s7 8# REL:      .rela.debug_rnglists {9# REL-NEXT:   0x0 R_RISCV_SET_ULEB128 w1 0x8210# REL-NEXT:   0x0 R_RISCV_SUB_ULEB128 w2 0xFFFFFFFFFFFFFFFF11# REL-NEXT:   0x1 R_RISCV_SET_ULEB128 w2 0x7812# REL-NEXT:   0x1 R_RISCV_SUB_ULEB128 w1 0x013# REL-NEXT:   0x3 R_RISCV_SET_ULEB128 w1 0x8914# REL-NEXT:   0x3 R_RISCV_SUB_ULEB128 w2 0x015# REL-NEXT:   0x5 R_RISCV_SET_ULEB128 w2 0x3FF816# REL-NEXT:   0x5 R_RISCV_SUB_ULEB128 w1 0x017# REL-NEXT:   0x8 R_RISCV_SET_ULEB128 w1 0x400918# REL-NEXT:   0x8 R_RISCV_SUB_ULEB128 w2 0x019# REL-NEXT:   0xB R_RISCV_SET_ULEB128 w2 0x1FFFF820# REL-NEXT:   0xB R_RISCV_SUB_ULEB128 w1 0x021# REL-NEXT:   0xF R_RISCV_SET_ULEB128 w1 0x20000922# REL-NEXT:   0xF R_RISCV_SUB_ULEB128 w2 0x023# REL-NEXT: }24# REL:      .rela.debug_loclists {25# REL-NEXT:   0x0 R_RISCV_SET_ULEB128 w2 0x326# REL-NEXT:   0x0 R_RISCV_SUB_ULEB128 w1 0x427# REL-NEXT:   0x1 R_RISCV_SET_ULEB128 x2 0x028# REL-NEXT:   0x1 R_RISCV_SUB_ULEB128 x1 0x029# REL-NEXT: }30 31# REL:        Hex dump of section '.gcc_except_table':32# REL-NEXT:   0x00000000 7b800181 01808001 81800180 80800181 {33# REL-NEXT:   0x00000010 808001                              .34# REL:        Hex dump of section '.debug_rnglists':35# REL-NEXT:   0x00000000 7b800181 01808001 81800180 80800181 {36# REL-NEXT:   0x00000010 808001                              .37# REL:        Hex dump of section '.debug_loclists':38# REL-NEXT:   0x00000000 0008                                  .39 40# CHECK:      Hex dump of section '.gcc_except_table':41# CHECK-NEXT: 0x[[#%x,]] 7ffc0085 01fcff00 858001fc ffff0085 .42# CHECK-NEXT: 0x[[#%x,]] 808001                              .43# CHECK:      Hex dump of section '.debug_rnglists':44# CHECK-NEXT: 0x00000000 7ffc0085 01fcff00 858001fc ffff0085 .45# CHECK-NEXT: 0x00000010 808001                              .46# CHECK:      Hex dump of section '.debug_loclists':47# CHECK-NEXT: 0x00000000 0300                                .48 49# RUN: ld.lld -shared --gc-sections -z dead-reloc-in-nonalloc=.debug_loclists=0x7f a.o -o a127.so50# RUN: llvm-readelf -x .debug_loclists a127.so | FileCheck %s --check-prefix=CHECK12751# CHECK127:      Hex dump of section '.debug_loclists':52# CHECK127-NEXT: 0x00000000 037f                                .53 54# RUN: not ld.lld -shared --gc-sections -z dead-reloc-in-nonalloc=.debug_loclists=0x80 a.o 2>&1 | FileCheck %s --check-prefix=CHECK12855# CHECK128: error: a.o:(.debug_loclists+0x1): ULEB128 value 128 exceeds available space; references 'x2'56 57# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax sub.s -o sub.o58# RUN: not ld.lld -shared sub.o 2>&1 | FileCheck %s --check-prefix=SUB59# SUB: error: sub.o:(.debug_rnglists+0x8): has non-ABS relocation R_RISCV_SUB_ULEB128 against symbol 'w2'60 61# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax unpaired1.s -o unpaired1.o62# RUN: not ld.lld -shared --threads=1 unpaired1.o 2>&1 | FileCheck %s --check-prefix=UNPAIRED63# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax unpaired2.s -o unpaired2.o64# RUN: not ld.lld -shared --threads=1 unpaired2.o 2>&1 | FileCheck %s --check-prefix=UNPAIRED65# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax unpaired3.s -o unpaired3.o66# RUN: not ld.lld -shared --threads=1 unpaired3.o 2>&1 | FileCheck %s --check-prefix=UNPAIRED67# UNPAIRED: error: {{.*}}.o:(.alloc+0x8): R_RISCV_SET_ULEB128 not paired with R_RISCV_SUB_SET12868# UNPAIRED: error: {{.*}}.o:(.debug_rnglists+0x8): R_RISCV_SET_ULEB128 not paired with R_RISCV_SUB_SET12869 70# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax overflow.s -o overflow.o71# RUN: not ld.lld -shared --threads=1 overflow.o 2>&1 | FileCheck %s --check-prefix=OVERFLOW72# OVERFLOW: error: overflow.o:(.alloc+0x8): ULEB128 value 128 exceeds available space; references 'w2'73# OVERFLOW: error: overflow.o:(.debug_rnglists+0x8): ULEB128 value 128 exceeds available space; references 'w2'74 75# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax preemptable.s -o preemptable.o76# RUN: not ld.lld -shared --threads=1 preemptable.o 2>&1 | FileCheck %s --check-prefix=PREEMPTABLE --implicit-check-not=error:77# PREEMPTABLE: error: relocation R_RISCV_SET_ULEB128 cannot be used against symbol 'w2'; recompile with -fPIC78# PREEMPTABLE: error: relocation R_RISCV_SUB_ULEB128 cannot be used against symbol 'w1'; recompile with -fPIC79 80#--- a.s81.cfi_startproc82.cfi_lsda 0x1b,.LLSDA083.cfi_endproc84 85.section .text.w,"axR"86w1:87  call foo    # 4 bytes after relaxation88w2:89 90.section .text.x,"ax"91x1:92  call foo    # 4 bytes after relaxation93x2:94 95.section .gcc_except_table,"a"96.LLSDA0:97.reloc ., R_RISCV_SET_ULEB128, w1+13098.reloc ., R_RISCV_SUB_ULEB128, w2-1  # non-zero addend for SUB99.byte 0x7b100.uleb128 w2-w1+120                   # initial value: 0x0180101.uleb128 w1-w2+137                   # initial value: 0x0181102.uleb128 w2-w1+16376                 # initial value: 0x018080103.uleb128 w1-w2+16393                 # initial value: 0x018081104.uleb128 w2-w1+2097144               # initial value: 0x01808080105.uleb128 w1-w2+2097161               # initial value: 0x01808081106 107.section .debug_rnglists108.reloc ., R_RISCV_SET_ULEB128, w1+130109.reloc ., R_RISCV_SUB_ULEB128, w2-1  # non-zero addend for SUB110.byte 0x7b111.uleb128 w2-w1+120                   # initial value: 0x0180112.uleb128 w1-w2+137                   # initial value: 0x0181113.uleb128 w2-w1+16376                 # initial value: 0x018080114.uleb128 w1-w2+16393                 # initial value: 0x018081115.uleb128 w2-w1+2097144               # initial value: 0x01808080116.uleb128 w1-w2+2097161               # initial value: 0x01808081117 118.section .debug_loclists119.reloc ., R_RISCV_SET_ULEB128, w2+3120.reloc ., R_RISCV_SUB_ULEB128, w1+4  # SUB with a non-zero addend121.byte 0122.uleb128 x2-x1                       # references discarded symbols123 124#--- sub.s125w1: call foo; w2:126.section .debug_rnglists127.quad 0;128.reloc ., R_RISCV_SUB_ULEB128, w2+120129.byte 0x7f130 131#--- unpaired1.s132w1: call foo; w2:133.section .alloc,"a"134.quad 0135.reloc ., R_RISCV_SET_ULEB128, w2+120136.byte 0x7f137.section .debug_rnglists138.quad 0;139.reloc ., R_RISCV_SET_ULEB128, w2+120140.byte 0x7f141 142#--- unpaired2.s143w1: call foo; w2:144.section .alloc,"a"145.quad 0146.reloc ., R_RISCV_SET_ULEB128, w2+120147.reloc .+1, R_RISCV_SUB_ULEB128, w1148.byte 0x7f149.section .debug_rnglists150.quad 0151.reloc ., R_RISCV_SET_ULEB128, w2+120152.reloc .+1, R_RISCV_SUB_ULEB128, w1153.byte 0x7f154 155#--- unpaired3.s156w1: call foo; w2:157.section .alloc,"a"158.quad 0159.reloc ., R_RISCV_SET_ULEB128, w2+120160.reloc ., R_RISCV_SUB64, w1161.byte 0x7f162.section .debug_rnglists163.quad 0164.reloc ., R_RISCV_SET_ULEB128, w2+120165.reloc ., R_RISCV_SUB64, w1166.byte 0x7f167 168#--- overflow.s169w1: call foo; w2:170.section .alloc,"a"171.quad 0172.reloc ., R_RISCV_SET_ULEB128, w2+124173.reloc ., R_RISCV_SUB_ULEB128, w1174.byte 0x7f175.section .debug_rnglists176.quad 0177.reloc ., R_RISCV_SET_ULEB128, w2+124178.reloc ., R_RISCV_SUB_ULEB128, w1179.byte 0x7f180 181#--- preemptable.s182.globl w1, w2183w1: call foo; w2:184.section .alloc,"a"185.uleb128 w2-w1186.section .debug_rnglists187.uleb128 w2-w1188