brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 34d02f5 Raw
102 lines · plain
1## Linker relaxation imposes restrictions on .eh_frame/.debug_frame, .debug_line,2## and LEB128 uses.3 4## CFI instructions can be preceded by relaxable instructions. We must use5## DW_CFA_advance_loc* opcodes with relocations.6 7## For .debug_line, emit DW_LNS_fixed_advance_pc with ADD16/SUB16 relocations so8## that .debug_line can be fixed by the linker. Without linker relaxation, we can9## emit special opcodes to make .debug_line smaller, but we don't do this for10## consistency.11 12# RUN: llvm-mc -filetype=obj -triple=riscv64 -g -dwarf-version=5 -mattr=+relax < %s -o %t13# RUN: llvm-dwarfdump -eh-frame -debug-line -debug-rnglists -v %t | FileCheck %s14# RUN: llvm-readobj -r -x .eh_frame %t | FileCheck %s --check-prefix=RELOC15 16# CHECK:      FDE17# CHECK-NEXT: Format:       DWARF3218# CHECK-NEXT: DW_CFA_advance_loc: 1619# CHECK-NEXT: DW_CFA_def_cfa_offset: +3220# CHECK-NEXT: DW_CFA_advance_loc: 421# CHECK-NEXT: DW_CFA_offset: X1 -822# CHECK-NEXT: DW_CFA_nop:23 24# CHECK:      DW_LNE_set_address25# CHECK-NEXT: DW_LNS_advance_line ([[#]])26# CHECK-NEXT: DW_LNS_copy27# CHECK-NEXT:                           is_stmt28# CHECK-NEXT: DW_LNS_advance_line29# CHECK-NEXT: DW_LNS_fixed_advance_pc (addr += 0x0004, op-index = 0)30# CHECK-NEXT: DW_LNS_copy31# CHECK-NEXT:                           is_stmt32# CHECK-NEXT: DW_LNS_advance_line33# CHECK-NEXT: DW_LNS_fixed_advance_pc (addr += 0x0004, op-index = 0)34# CHECK-NEXT: DW_LNS_copy35 36# CHECK:      0x00000000: range list header: length = 0x0000001d, format = DWARF32, version = 0x000537# CHECK-NEXT: ranges:38# CHECK-NEXT: 0x0000000c: [DW_RLE_start_length]:  0x0000000000000000, 0x000000000000003439# CHECK-NEXT: 0x00000016: [DW_RLE_start_length]:  0x0000000000000000, 0x000000000000000440# CHECK-NEXT: 0x00000020: [DW_RLE_end_of_list ]41 42# RELOC:      Section ([[#]]) .rela.eh_frame {43# RELOC-NEXT:   0x1C R_RISCV_32_PCREL .L0  0x044# RELOC-NEXT:   0x20 R_RISCV_ADD32 .L0  0x045# RELOC-NEXT:   0x20 R_RISCV_SUB32 .L0  0x046# RELOC-NEXT:   0x25 R_RISCV_SET6 .L0  0x047# RELOC-NEXT:   0x25 R_RISCV_SUB6 .L0  0x048# RELOC-NEXT:   0x34 R_RISCV_32_PCREL .L0  0x049# RELOC-NEXT: }50 51# RELOC:      Section ([[#]]) .rela.debug_rnglists {52# RELOC-NEXT:   0xD R_RISCV_64 .text.foo 0x053# RELOC-NEXT:   0x15 R_RISCV_SET_ULEB128 .L0  0x054# RELOC-NEXT:   0x15 R_RISCV_SUB_ULEB128 .text.foo 0x055# RELOC-NEXT:   0x17 R_RISCV_64 .text.bar 0x056# RELOC-NEXT: }57 58# RELOC:      Section ([[#]]) .rela.debug_line {59# RELOC:        R_RISCV_ADD16 .L0  0x060# RELOC-NEXT:   R_RISCV_SUB16 .L0  0x061# RELOC-NEXT:   R_RISCV_ADD16 .L0  0x062# RELOC-NEXT:   R_RISCV_SUB16 .L0  0x063# RELOC-NEXT:   R_RISCV_ADD16 .L0  0x064# RELOC-NEXT:   R_RISCV_SUB16 .L0  0x065# RELOC:      }66 67# RELOC:      Hex dump of section '.eh_frame':68# RELOC-NEXT: 0x0000000069# RELOC-NEXT: 0x0000001070# RELOC-NEXT: 0x0000002071# RELOC-NEXT: 0x00000030 30000000 00000000 04000000 0000000072#                                          ^ address_range73 74.section .text.foo,"ax"75.globl foo76foo:77.cfi_startproc78.Lpcrel_hi0:79  auipc a1, %pcrel_hi(g)80  lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)81  bge a1, a0, .LBB0_282  addi sp, sp, -3283  .cfi_def_cfa_offset 3284  sd ra, 24(sp)85  .cfi_offset ra, -886  addi a0, sp, 887  call ext@plt88  ld ra, 24(sp)89  addi sp, sp, 3290  ret91.LBB0_2:92  li a0, 093  ret94  .cfi_endproc95  .size foo, .-foo96 97.section .text.bar,"ax"98bar:99.cfi_startproc100  nop101.cfi_endproc102