xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/eh-frame-return-address-reg.s (revision 4933ab2ccb3a10a89ffe88e4d25e38544791caf8)
1# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
2# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
3
4# The format of the .eh_frame section is similar in
5# format and purpose to the .debug_frame section.
6# Version 1 is often used for .eh_frame,
7# and also it was used for DWARF v2. For that case,
8# return address register should be encoded as ubyte,
9# while later versions use ULEB128. This test case
10# checks that we are able to dump it correctly.
11
12# CHECK:      .eh_frame contents:
13# CHECK:      00000000 00000010 00000000 CIE
14# CHECK-NEXT:   Format:                DWARF32
15# CHECK-NEXT:   Version:               1
16# CHECK-NEXT:   Augmentation:          "zR"
17# CHECK-NEXT:   Code alignment factor: 1
18# CHECK-NEXT:   Data alignment factor: 1
19# CHECK-NEXT:   Return address column: 240
20# CHECK-NEXT:   Augmentation data:     1A
21
22.text
23.global _start
24_start:
25 nop
26
27.section .eh_frame,"a",@unwind
28  .long 16   # Size
29  .long 0x00 # ID
30  .byte 0x01 # Version
31
32  .byte 0x7A # Augmentation string: "zR"
33  .byte 0x52
34  .byte 0x00
35
36  .byte 0x01 # Code alignment factor, ULEB128
37  .byte 0x01 # Data alignment factor, ULEB128
38
39  .byte 0xF0 # Return address register, ubyte for version 1.
40
41  .byte 0x01 # LEB128
42  .byte 0x1A # DW_EH_PE_pcrel | DW_EH_PE_sdata2
43
44  .byte 0x00
45  .byte 0x00
46  .byte 0x00
47
48  .long 10   # Size
49  .long 24   # ID
50fde:
51  .long _start - fde
52  .word 0
53