File: eh-frame-hdr-icf-fde.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (95 lines) | stat: -rw-r--r-- 2,705 bytes parent folder | download | duplicates (14)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# REQUIRES: x86

## Testcase checks that we correctly deduplicate FDEs when ICF
## merges two sections.

# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2 --icf=all --eh-frame-hdr
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=OBJ
# RUN: llvm-readobj -S --section-data %t2 | FileCheck %s

# OBJ:      Relocations [
# OBJ-NEXT:   Section {{.*}} .rela.eh_frame {
# OBJ-NEXT:     0x20 R_X86_64_PC32 .text.f1 0x0
# OBJ-NEXT:     0x34 R_X86_64_PC32 .text.f1 0x2
# OBJ-NEXT:     0x48 R_X86_64_PC32 .text.f2 0x0
# OBJ-NEXT:     0x5C R_X86_64_PC32 .text.f2 0x2
# OBJ-NEXT:   }
# OBJ-NEXT: ]

# CHECK:      Section {
# CHECK:        Index: 1
# CHECK:        Name: .eh_frame_hdr
# CHECK-NEXT:   Type: SHT_PROGBITS
# CHECK-NEXT:   Flags [
# CHECK-NEXT:     SHF_ALLOC
# CHECK-NEXT:   ]
# CHECK-NEXT:   Address: 0x200158
# CHECK-NEXT:   Offset: 0x158
# CHECK-NEXT:   Size: 28
# CHECK-NEXT:   Link: 0
# CHECK-NEXT:   Info: 0
# CHECK-NEXT:   AddressAlignment:
# CHECK-NEXT:   EntrySize: 0
# CHECK-NEXT:   SectionData (
# CHECK-NEXT:     0000: 011B033B 1C000000 02000000 64100000
##                               ^        ^-- FDE(1) PC
##                               ^-- Number of FDEs
# CHECK-NEXT:     0010: 38000000 66100000 4C000000
##                               ^-- FDE(2) PC
# CHECK-NEXT:   )
# CHECK-NEXT: }
## FDE(1) == 0x201000 - .eh_frame_hdr(0x200158) = 0xEA8
## FDE(2) == 0x201000 - .eh_frame_hdr(0x200158) + 2(relocation addend) = 0xEAA

## Check .eh_frame contains CIE and two FDEs remaining after ICF.
# CHECK-NEXT: Section {
# CHECK-NEXT:   Index: 2
# CHECK-NEXT:   Name: .eh_frame
# CHECK-NEXT:   Type: SHT_PROGBITS
# CHECK-NEXT:   Flags [
# CHECK-NEXT:     SHF_ALLOC
# CHECK-NEXT:   ]
# CHECK-NEXT:   Address: 0x200178
# CHECK-NEXT:   Offset: 0x178
# CHECK-NEXT:   Size: 68
# CHECK-NEXT:   Link: 0
# CHECK-NEXT:   Info: 0
# CHECK-NEXT:   AddressAlignment: 8
# CHECK-NEXT:   EntrySize: 0
# CHECK-NEXT:   SectionData (
# CHECK-NEXT:     0000: 14000000 00000000 017A5200 01781001
# CHECK-NEXT:     0010: 1B0C0708 90010000 10000000 1C000000
# CHECK-NEXT:     0020: 24100000 01000000 00000000 10000000
# CHECK-NEXT:     0030: 30000000 12100000 01000000 00000000
# CHECK-NEXT:     0040: 00000000
# CHECK-NEXT:   )
# CHECK-NEXT: }

# CHECK:     Section {
# CHECK:       Index:
# CHECK:       Name: .text
# CHECK-NEXT:  Type: SHT_PROGBITS
# CHECK-NEXT:  Flags [
# CHECK-NEXT:    SHF_ALLOC
# CHECK-NEXT:    SHF_EXECINSTR
# CHECK-NEXT:  ]
# CHECK-NEXT:  Address: 0x2011BC

.section .text.f1, "ax"
.cfi_startproc
nop
.cfi_endproc
nop
.cfi_startproc
ret
.cfi_endproc

.section .text.f2, "ax"
.cfi_startproc
nop
.cfi_endproc
nop
.cfi_startproc
ret
.cfi_endproc