1# RUN: yaml2obj -DELFCLASS=ELFCLASS32 -o %t.32.o %s 2# RUN: llvm-jitlink -noexec -check %s %t.32.o 3# RUN: yaml2obj -DELFCLASS=ELFCLASS64 -o %t.64.o %s 4# RUN: llvm-jitlink -noexec -check %s %t.64.o 5 6### Compiled from the following code with -mattr=+relax to force relocations for 7### address_range and DW_CFA_advance_loc (both needed for .balign). 8## .text 9## .globl main 10## .p2align 1 11## .type main,@function 12## main: 13## .cfi_startproc 14## .balign 8 15## addi sp, sp, -16 16## cfa_advance_loc: 17## .cfi_def_cfa_offset 16 18## nop 19## main_end: 20## .size main, main_end-main 21## .cfi_endproc 22 23--- !ELF 24FileHeader: 25 Class: [[ELFCLASS]] 26 Data: ELFDATA2LSB 27 Type: ET_REL 28 Machine: EM_RISCV 29 SectionHeaderStringTable: .strtab 30Sections: 31 - Name: .text 32 Type: SHT_PROGBITS 33 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 34 AddressAlign: 0x8 35 Content: 13000000130101FF13000000 36 - Name: .eh_frame 37 Type: SHT_PROGBITS 38 Flags: [ SHF_ALLOC ] 39 AddressAlign: 0x8 40 Content: 1000000000000000017A5200017801011B0C02001000000018000000000000000000000000400E10 41 - Name: .rela.text 42 Type: SHT_RELA 43 Flags: [ SHF_INFO_LINK ] 44 Link: .symtab 45 AddressAlign: 0x8 46 Info: .text 47 Relocations: 48 - Type: R_RISCV_ALIGN 49 Addend: 4 50 - Name: .rela.eh_frame 51 Type: SHT_RELA 52 Flags: [ SHF_INFO_LINK ] 53 Link: .symtab 54 AddressAlign: 0x8 55 Info: .eh_frame 56 Relocations: 57 - Offset: 0x1C 58 Symbol: main 59 Type: R_RISCV_32_PCREL 60 - Offset: 0x20 61 Symbol: main_end 62 Type: R_RISCV_ADD32 63 - Offset: 0x20 64 Symbol: main 65 Type: R_RISCV_SUB32 66 - Offset: 0x25 67 Symbol: cfa_advance_loc 68 Type: R_RISCV_SET6 69 - Offset: 0x25 70 Symbol: main 71 Type: R_RISCV_SUB6 72 - Type: SectionHeaderTable 73 Sections: 74 - Name: .strtab 75 - Name: .text 76 - Name: .rela.text 77 - Name: .eh_frame 78 - Name: .rela.eh_frame 79 - Name: .symtab 80Symbols: 81 - Name: cfa_advance_loc 82 Section: .text 83 Value: 0x8 84 - Name: main_end 85 Section: .text 86 Value: 0xC 87 - Name: main 88 Type: STT_FUNC 89 Section: .text 90 Binding: STB_GLOBAL 91 Size: 0xC 92 - Name: eh_frame 93 Type: STT_SECTION 94 Binding: STB_GLOBAL 95 Section: .eh_frame 96 Size: 0x28 97... 98 99## CIE_pointer 100# jitlink-check: *{4}(eh_frame + 0x1c) = main - (eh_frame + 0x1c) 101## address_range 102# jitlink-check: *{4}(eh_frame + 0x20) = main_end - main 103## DW_CFA_advance_loc 104# jitlink-check: (*{1}(eh_frame + 0x25)) & 0x3f = cfa_advance_loc - main 105