• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Verify the .fix data section conveys the right offsets and the right relocations
2// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o - | llvm-readobj -relocations -expand-relocs -sections -section-data | FileCheck %s --check-prefix=READOBJ
3
4        .text
5	.section	.rdata,"dr"
6	.globl	g1                      # @g1
7	.align	4
8g1:
9	.long	1                       # 0x1
10
11	.globl	g2                      # @g2
12	.align	4
13g2:
14	.long	2                       # 0x2
15
16	.globl	g3                      # @g3
17	.align	4
18g3:
19	.long	3                       # 0x3
20
21	.globl	g4                      # @g4
22	.align	4
23g4:
24	.long	4                       # 0x4
25
26	.section	.fix,"dw"
27	.globl	t1                      # @t1
28	.align	8
29t1:
30	.quad	(g3-t1)+4
31
32	.globl	t2                      # @t2
33	.align	8
34t2:
35	.quad	g3-t2
36
37	.globl	t3                      # @t3
38	.align	8
39t3:
40	.quad	(g3-t3)-4
41
42	.globl	t4                      # @t4
43	.align	4
44t4:
45	.long	g3-t4
46
47	.globl	t5                      # @t5
48	.align	4
49t5:
50	.long	g3@IMGREL
51
52	.globl	t6                      # @t6
53	.align	16
54t6:
55	.ascii	"\001\002"
56	.zero	6
57	.quad	256                     # 0x100
58	.long	g3-(t6+16)
59	.zero	4
60
61
62// READOBJ:  Section {
63// READOBJ:    Number: 5
64// READOBJ:    Name: .fix (2E 66 69 78 00 00 00 00)
65// READOBJ:    VirtualSize: 0x0
66// READOBJ:    VirtualAddress: 0x0
67// READOBJ:    RawDataSize: 56
68// READOBJ:    PointerToRawData: 0xEC
69// READOBJ:    PointerToRelocations: 0x124
70// READOBJ:    PointerToLineNumbers: 0x0
71// READOBJ:    RelocationCount: 6
72// READOBJ:    LineNumberCount: 0
73// READOBJ:    Characteristics [ (0xC0500040)
74// READOBJ:      IMAGE_SCN_ALIGN_16BYTES (0x500000)
75// READOBJ:      IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
76// READOBJ:      IMAGE_SCN_MEM_READ (0x40000000)
77// READOBJ:      IMAGE_SCN_MEM_WRITE (0x80000000)
78// READOBJ:    ]
79// READOBJ:    SectionData (
80// READOBJ:      0000: 10000000 00000000 0C000000 00000000  |................|
81// READOBJ:      0010: 08000000 00000000 0C000000 00000000  |................|
82// READOBJ:      0020: 01020000 00000000 00010000 00000000  |................|
83// READOBJ:      0030: 0C000000 00000000                    |........|
84// READOBJ:    )
85// READOBJ:  }
86// READOBJ:  ]
87// READOBJ:  Relocations [
88// READOBJ:  Section (5) .fix {
89// READOBJ:    Relocation {
90// READOBJ:      Offset: 0x0
91// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
92// READOBJ:      Symbol: .rdata
93// READOBJ:    }
94// READOBJ:    Relocation {
95// READOBJ:      Offset: 0x8
96// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
97// READOBJ:      Symbol: .rdata
98// READOBJ:    }
99// READOBJ:    Relocation {
100// READOBJ:      Offset: 0x10
101// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
102// READOBJ:      Symbol: .rdata
103// READOBJ:    }
104// READOBJ:    Relocation {
105// READOBJ:      Offset: 0x18
106// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
107// READOBJ:      Symbol: .rdata
108// READOBJ:    }
109// READOBJ:    Relocation {
110// READOBJ:      Offset: 0x1C
111// READOBJ:      Type: IMAGE_REL_AMD64_ADDR32NB (3)
112// READOBJ:      Symbol: g3
113// READOBJ:    }
114// READOBJ:    Relocation {
115// READOBJ:      Offset: 0x30
116// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
117// READOBJ:      Symbol: .rdata
118// READOBJ:    }
119