[llvm-readobj] [COFF] Print the symbol index for relocations
[llvm-core.git] / test / MC / COFF / cross-section-relative.s
bloba9b7e6dbd5de5cb176b93420a64ebbd0ce9464a5
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
4 .text
5 .section .rdata,"dr"
6 .globl g1 # @g1
7 .align 4
8 g1:
9 .long 1 # 0x1
11 .globl g2 # @g2
12 .align 4
13 g2:
14 .long 2 # 0x2
16 .globl g3 # @g3
17 .align 4
18 g3:
19 .long 3 # 0x3
21 .globl g4 # @g4
22 .align 4
23 g4:
24 .long 4 # 0x4
26 .section .fix,"dw"
27 .globl t1 # @t1
28 .align 8
29 t1:
31 .globl t2 # @t2
32 .align 8
33 t2:
35 .globl t3 # @t3
36 .align 8
37 t3:
39 .globl t4 # @t4
40 .align 4
41 t4:
42 .long g3-t4
44 .globl t5 # @t5
45 .align 4
46 t5:
47 .long g3@IMGREL
49 .globl t6 # @t6
50 .align 16
51 t6:
52 .ascii "\001\002"
53 .zero 6
54 .quad 256 # 0x100
55 .long g3-(t6+16)
56 .zero 4
58 .long foobar - .
60 // READOBJ: Section {
61 // READOBJ: Number:
62 // READOBJ: Name: .fix (2E 66 69 78 00 00 00 00)
63 // READOBJ-NEXT: VirtualSize: 0x0
64 // READOBJ-NEXT: VirtualAddress: 0x0
65 // READOBJ-NEXT: RawDataSize:
66 // READOBJ-NEXT: PointerToRawData: 0xEC
67 // READOBJ-NEXT: PointerToRelocations:
68 // READOBJ-NEXT: PointerToLineNumbers: 0x0
69 // READOBJ-NEXT: RelocationCount:
70 // READOBJ-NEXT: LineNumberCount: 0
71 // READOBJ-NEXT: Characteristics [ (0xC0500040)
72 // READOBJ-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
73 // READOBJ-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
74 // READOBJ-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
75 // READOBJ-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
76 // READOBJ-NEXT: ]
77 // READOBJ-NEXT: SectionData (
78 // READOBJ-NEXT: 0000: 04000000 00000000 00000000 00000000 |
79 // READOBJ-NEXT: 0010: 01020000 00000000 00010000 00000000 |
80 // READOBJ-NEXT: 0020: 04000000 00000000 04000000 |
81 // READOBJ-NEXT: )
82 // READOBJ-NEXT: }
83 // READOBJ-NEXT: ]
84 // READOBJ-NEXT: Relocations [
85 // READOBJ-NEXT: Section (5) .fix {
86 // READOBJ-NEXT: Relocation {
87 // READOBJ-NEXT: Offset: 0x0
88 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
89 // READOBJ-NEXT: Symbol: g3
90 // READOBJ-NEXT: SymbolIndex: 12
91 // READOBJ-NEXT: }
92 // READOBJ-NEXT: Relocation {
93 // READOBJ-NEXT: Offset: 0x4
94 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_ADDR32NB (3)
95 // READOBJ-NEXT: Symbol: g3
96 // READOBJ-NEXT: SymbolIndex: 12
97 // READOBJ-NEXT: }
98 // READOBJ-NEXT: Relocation {
99 // READOBJ-NEXT: Offset: 0x20
100 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
101 // READOBJ-NEXT: Symbol: g3
102 // READOBJ-NEXT: SymbolIndex: 12
103 // READOBJ-NEXT: }
104 // READOBJ-NEXT: Relocation {
105 // READOBJ-NEXT: Offset: 0x28
106 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)
107 // READOBJ-NEXT: Symbol: foobar
108 // READOBJ-NEXT: SymbolIndex: 20
109 // READOBJ-NEXT: }
110 // READOBJ-NEXT: }
111 // READOBJ-NEXT:]