2 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-pc-linux
%s
-o
%t.o
4 // RUN
: ld.lld
%t.o
-o
%t
5 // RUN
: llvm-readobj
--file-headers
-S
--section-data
-l --symbols
%t \
6 // RUN
: | FileCheck
%s
--check-prefix
=NOHDR
8 // RUN
: ld.lld
-eh-frame-hdr
-no-eh-frame-hdr
%t.o
-o
%t
9 // RUN
: llvm-readobj
--file-headers
-S
--section-data
-l --symbols
%t \
10 // RUN
: | FileCheck
%s
--check-prefix
=NOHDR
12 // RUN
: ld.lld
--eh-frame-hdr
%t.o
-o
%t
13 // RUN
: llvm-readobj
--file-headers
-S
--section-data
-l --symbols
%t \
14 // RUN
: | FileCheck
%s
--check-prefix
=HDR
15 // RUN
: llvm-objdump
-d
%t | FileCheck
%s
--check-prefix
=HDRDISASM
17 .section foo,"ax",@progbits
22 .section bar,"ax",@progbits
27 .section dah,"ax",@progbits
37 // NOHDR-
NOT: Name
: .eh_frame_hdr
38 // NOHDR
: ProgramHeaders
[
39 // NOHDR-
NOT: PT_GNU_EH_FRAME
41 // HDRDISASM
: Disassembly of section foo
:
43 // HDRDISASM-NEXT
: <foo
>:
44 // HDRDISASM-NEXT
: 2011dc
: 90 nop
46 // HDRDISASM-NEXT
: Disassembly of section bar
:
48 // HDRDISASM-NEXT
: <bar
>:
49 // HDRDISASM-NEXT
: 2011dd
: 90 nop
51 // HDRDISASM-NEXT
: Disassembly of section dah
:
53 // HDRDISASM-NEXT
: <dah
>:
54 // HDRDISASM-NEXT
: 2011de
: 90 nop
58 // HDR
: Name
: .eh_frame_hdr
59 // HDR-NEXT
: Type
: SHT_PROGBITS
61 // HDR-NEXT
: SHF_ALLOC
63 // HDR-NEXT
: Address
: 0x200158
64 // HDR-NEXT
: Offset
: 0x158
68 // HDR-NEXT
: AddressAlignment
: 4
69 // HDR-NEXT
: EntrySize
: 0
70 // HDR-NEXT
: SectionData
(
71 // HDR-NEXT
: 0000: 011B033B
24000000 03000000 84100000
72 // HDR-NEXT
: 0010: 40000000 85100000 54000000 86100000
73 // HDR-NEXT
: 0020: 68000000
75 // Header
(always
4 bytes
): 0x011B033B
76 // 24000000 = .eh_frame(0x200180) - .eh_frame_hdr(0x200158) - 4
77 // 03000000 = 3 = the number of FDE pointers in the table.
78 // Entry
(1): 8C100000
40000000
79 // 480E0000
= 0x2011e4 - .eh_frame_hdr(0x200158) = 0x108C
80 // 40000000 = address of FDE
(1) - .eh_frame_hdr(0x200158) =
81 // = .eh_frame(0x200180) + 24 - 0x200158 = 0x40
82 // Entry
(2): 8D100000
58000000
83 // A90E0000
= 0x2011e5 - .eh_frame_hdr(0x200158) = 0x108D
84 // 58000000 = address of FDE
(2) - .eh_frame_hdr(0x200158) =
85 // = .eh_frame(0x200180) + 24 + 24 - 0x200158 = 0x58
86 // Entry
(3): 8E100000
70000000
87 // AA0E0000
= 0x2011e6 - .eh_frame_hdr(0x200158) = 0x108E
88 // 70000000 = address of FDE
(3) - .eh_frame_hdr(0x200158) =
89 // = .eh_frame(0x200180) + 24 + 24 + 24 - 0x200158 = 0x70
91 // HDR-NEXT
: Section
{
93 // HDR-NEXT
: Name
: .eh_frame
94 // HDR-NEXT
: Type
: SHT_PROGBITS
96 // HDR-NEXT
: SHF_ALLOC
98 // HDR-NEXT
: Address
: 0x200180
99 // HDR-NEXT
: Offset
: 0x180
100 // HDR-NEXT
: Size
: 92
103 // HDR-NEXT
: AddressAlignment
: 8
104 // HDR-NEXT
: EntrySize
: 0
105 // HDR-NEXT
: SectionData
(
106 // HDR-NEXT
: 0000: 14000000 00000000 017A5200
01781001
107 // HDR-NEXT
: 0010: 1B0C0708
90010000 10000000 1C000000
108 // HDR-NEXT
: 0020: 3C100000
01000000 00000000 10000000
109 // HDR-NEXT
: 0030: 30000000 29100000 01000000 00000000
110 // HDR-NEXT
: 0040: 14000000 44000000 16100000 01000000
111 // HDR-NEXT
: 0050: 00000000 00000000 00000000
113 // CIE
: 14000000 00000000 017A5200
01781001 1B0C0708
90010000
114 // FDE
(1): 14000000 1C000000
600E0000
01000000 00000000 00000000
115 // address of data
(starts with
0x600E0000) = 0x200180 + 0x0020 = 0x2001A0
116 // The starting address to which this FDE applies
= 0xE60 + 0x2001A0 = 0x201000
117 // The number of bytes after the start address to which this FDE applies
= 0x01000000 = 1
118 // FDE
(2): 14000000 34000000 490E0000
01000000 00000000 00000000
119 // address of data
(starts with
0x490E0000) = 0x200180 + 0x0038 = 0x2001B8
120 // The starting address to which this FDE applies
= 0xE49 + 0x2001B8 = 0x201001
121 // The number of bytes after the start address to which this FDE applies
= 0x01000000 = 1
122 // FDE
(3): 14000000 4C000000
320E0000
01000000 00000000 00000000
123 // address of data
(starts with
0x320E0000) = 0x200180 + 0x0050 = 0x2001D0
124 // The starting address to which this FDE applies
= 0xE5A + 0x2001D0 = 0x201002
125 // The number of bytes after the start address to which this FDE applies
= 0x01000000 = 1
127 // HDR
: ProgramHeaders
[
128 // HDR
: ProgramHeader
{
129 // HDR
: Type
: PT_GNU_EH_FRAME
130 // HDR-NEXT
: Offset
: 0x158
131 // HDR-NEXT
: VirtualAddress
: 0x200158
132 // HDR-NEXT
: PhysicalAddress
: 0x200158
133 // HDR-NEXT
: FileSize
: 36
134 // HDR-NEXT
: MemSize
: 36
138 // HDR-NEXT
: Alignment
: 4