File: eh-frame-return-address-reg.s

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (52 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck %s

# The format of the .eh_frame section is similar in
# format and purpose to the .debug_frame section.
# Version 1 is often used for .eh_frame,
# and also it was used for DWARF v2. For that case,
# return address register should be encoded as ubyte,
# while later versions use ULEB128. This test case
# checks that we are able to dump it correctly.

# CHECK:      .eh_frame contents:
# CHECK:      00000000 00000010 00000000 CIE
# CHECK-NEXT:   Format:                DWARF32
# CHECK-NEXT:   Version:               1
# CHECK-NEXT:   Augmentation:          "zR"
# CHECK-NEXT:   Code alignment factor: 1
# CHECK-NEXT:   Data alignment factor: 1
# CHECK-NEXT:   Return address column: 240
# CHECK-NEXT:   Augmentation data:     1A

.text
.global _start
_start:
 nop

.section .eh_frame,"a",@unwind
  .long 16   # Size
  .long 0x00 # ID
  .byte 0x01 # Version

  .byte 0x7A # Augmentation string: "zR"
  .byte 0x52
  .byte 0x00

  .byte 0x01 # Code alignment factor, ULEB128
  .byte 0x01 # Data alignment factor, ULEB128
  
  .byte 0xF0 # Return address register, ubyte for version 1.

  .byte 0x01 # LEB128
  .byte 0x1A # DW_EH_PE_pcrel | DW_EH_PE_sdata2

  .byte 0x00
  .byte 0x00
  .byte 0x00

  .long 10   # Size
  .long 24   # ID
fde:
  .long _start - fde
  .word 0