cross-section-relative.s
3.04 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Verify the .fix data section conveys the right offsets and the right relocations
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o - | llvm-readobj -r --expand-relocs -S --section-data | FileCheck %s --check-prefix=READOBJ
.text
.section .rdata,"dr"
.globl g1 # @g1
.align 4
g1:
.long 1 # 0x1
.globl g2 # @g2
.align 4
g2:
.long 2 # 0x2
.globl g3 # @g3
.align 4
g3:
.long 3 # 0x3
.globl g4 # @g4
.align 4
g4:
.long 4 # 0x4
.section .fix,"dw"
.globl t1 # @t1
.align 8
t1:
.globl t2 # @t2
.align 8
t2:
.globl t3 # @t3
.align 8
t3:
.globl t4 # @t4
.align 4
t4:
.long g3-t4
.globl t5 # @t5
.align 4
t5:
.long g3@IMGREL
.globl t6 # @t6
.align 16
t6:
.ascii "\001\002"
.zero 6
.quad 256 # 0x100
.long g3-(t6+16)
.zero 4
.long foobar - .
// READOBJ: Section {
// READOBJ: Number:
// READOBJ: Name: .fix (2E 66 69 78 00 00 00 00)
// READOBJ-NEXT: VirtualSize: 0x0
// READOBJ-NEXT: VirtualAddress: 0x0
// READOBJ-NEXT: RawDataSize:
// READOBJ-NEXT: PointerToRawData: 0xEC
// READOBJ-NEXT: PointerToRelocations:
// READOBJ-NEXT: PointerToLineNumbers: 0x0
// READOBJ-NEXT: RelocationCount:
// READOBJ-NEXT: LineNumberCount: 0
// READOBJ-NEXT: Characteristics [ (0xC0500040)
// READOBJ-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
// READOBJ-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
// READOBJ-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
// READOBJ-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
// READOBJ-NEXT: ]
// READOBJ-NEXT: SectionData (
// READOBJ-NEXT: 0000: 04000000 00000000 00000000 00000000 |
// READOBJ-NEXT: 0010: 01020000 00000000 00010000 00000000 |
// READOBJ-NEXT: 0020: 04000000 00000000 04000000 |
// READOBJ-NEXT: )
// READOBJ-NEXT: }
// READOBJ-NEXT: ]
// READOBJ-NEXT: Relocations [
// READOBJ-NEXT: Section (5) .fix {
// READOBJ-NEXT: Relocation {
// READOBJ-NEXT: Offset: 0x0
// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
// READOBJ-NEXT: Symbol: g3
// READOBJ-NEXT: SymbolIndex: 12
// READOBJ-NEXT: }
// READOBJ-NEXT: Relocation {
// READOBJ-NEXT: Offset: 0x4
// READOBJ-NEXT: Type: IMAGE_REL_AMD64_ADDR32NB (3)
// READOBJ-NEXT: Symbol: g3
// READOBJ-NEXT: SymbolIndex: 12
// READOBJ-NEXT: }
// READOBJ-NEXT: Relocation {
// READOBJ-NEXT: Offset: 0x20
// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
// READOBJ-NEXT: Symbol: g3
// READOBJ-NEXT: SymbolIndex: 12
// READOBJ-NEXT: }
// READOBJ-NEXT: Relocation {
// READOBJ-NEXT: Offset: 0x28
// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
// READOBJ-NEXT: Symbol: foobar
// READOBJ-NEXT: SymbolIndex: 20
// READOBJ-NEXT: }
// READOBJ-NEXT: }
// READOBJ-NEXT:]