1 # RUN: yaml2obj %s -o %t.obj
3 # RUN: lld-link /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
4 # RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck %s -check-prefix=BASEREL
6 # RUN: lld-link /out:%t.exe /entry:main /fixed %t.obj %p/Inputs/std64.lib
7 # RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck %s -check-prefix=NOBASEREL
10 # BASEREL-NEXT: Entry {
11 # BASEREL-NEXT: Type: DIR64
12 # BASEREL-NEXT: Address: 0x1007
14 # BASEREL-NEXT: Entry {
15 # BASEREL-NEXT: Type: DIR64
16 # BASEREL-NEXT: Address: 0x100C
18 # BASEREL-NEXT: Entry {
19 # BASEREL-NEXT: Type: DIR64
20 # BASEREL-NEXT: Address: 0x101E
22 # BASEREL-NEXT: Entry {
23 # BASEREL-NEXT: Type: ABSOLUTE
24 # BASEREL-NEXT: Address: 0x1000
26 # BASEREL-NEXT: Entry {
27 # BASEREL-NEXT: Type: DIR64
28 # BASEREL-NEXT: Address: 0x4007
30 # BASEREL-NEXT: Entry {
31 # BASEREL-NEXT: Type: DIR64
32 # BASEREL-NEXT: Address: 0x400C
34 # BASEREL-NEXT: Entry {
35 # BASEREL-NEXT: Type: DIR64
36 # BASEREL-NEXT: Address: 0x401E
38 # BASEREL-NEXT: Entry {
39 # BASEREL-NEXT: Type: ABSOLUTE
40 # BASEREL-NEXT: Address: 0x4000
43 # NOBASEREL: BaseReloc [
46 # RUN: lld-link /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
47 # RUN: llvm-readobj --file-headers --sections %t.exe | FileCheck %s \
48 # RUN: --check-prefix=BASEREL-HEADER
50 # RUN: lld-link /out:%t.exe /entry:main /fixed %t.obj %p/Inputs/std64.lib
51 # RUN: llvm-readobj --file-headers %t.exe | FileCheck %s \
52 # RUN: --check-prefix=NOBASEREL-HEADER
54 # BASEREL-HEADER-NOT: IMAGE_FILE_RELOCS_STRIPPED
56 # NOBASEREL-HEADER: IMAGE_FILE_RELOCS_STRIPPED
58 # BASEREL-HEADER: BaseRelocationTableRVA: 0x5000
59 # BASEREL-HEADER: BaseRelocationTableSize: 0x20
60 # BASEREL-HEADER: Name: .reloc (2E 72 65 6C 6F 63 00 00)
61 # BASEREL-HEADER-NEXT: VirtualSize: 0x20
62 # BASEREL-HEADER-NEXT: VirtualAddress: 0x5000
63 # BASEREL-HEADER-NEXT: RawDataSize: 512
64 # BASEREL-HEADER-NEXT: PointerToRawData: 0xC00
65 # BASEREL-HEADER-NEXT: PointerToRelocations: 0x0
66 # BASEREL-HEADER-NEXT: PointerToLineNumbers: 0x0
67 # BASEREL-HEADER-NEXT: RelocationCount: 0
68 # BASEREL-HEADER-NEXT: LineNumberCount: 0
69 # BASEREL-HEADER-NEXT: Characteristics [ (0x42000040)
70 # BASEREL-HEADER-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
71 # BASEREL-HEADER-NEXT: IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
72 # BASEREL-HEADER-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
73 # BASEREL-HEADER-NEXT: ]
77 Machine: IMAGE_FILE_MACHINE_AMD64
81 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
83 SectionData: B800000000000000005068000000000000000068000000000000000050E8000000000000000050E8000000000000000050E80000000000000000
86 SymbolName: abs_symbol
87 Type: IMAGE_REL_AMD64_ADDR64
90 Type: IMAGE_REL_AMD64_ADDR64
93 Type: IMAGE_REL_AMD64_ADDR64
95 SymbolName: MessageBoxA
96 Type: IMAGE_REL_AMD64_REL32
98 SymbolName: ExitProcess
99 Type: IMAGE_REL_AMD64_REL32
101 SymbolName: __ImageBase
102 Type: IMAGE_REL_AMD64_ADDR64
104 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
106 SectionData: B800000000000000005068000000000000000068000000000000000050E8000000000000000050E8000000000000000050E80000000000000000
109 SymbolName: abs_symbol
110 Type: IMAGE_REL_AMD64_ADDR64
113 Type: IMAGE_REL_AMD64_ADDR64
116 Type: IMAGE_REL_AMD64_ADDR64
118 SymbolName: MessageBoxA
119 Type: IMAGE_REL_AMD64_REL32
121 SymbolName: ExitProcess
122 Type: IMAGE_REL_AMD64_REL32
124 SymbolName: __ImageBase
125 Type: IMAGE_REL_AMD64_ADDR64
127 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
129 SectionData: 48656C6C6F0048656C6C6F20576F726C6400
134 SimpleType: IMAGE_SYM_TYPE_NULL
135 ComplexType: IMAGE_SYM_DTYPE_NULL
136 StorageClass: IMAGE_SYM_CLASS_STATIC
140 SimpleType: IMAGE_SYM_TYPE_NULL
141 ComplexType: IMAGE_SYM_DTYPE_NULL
142 StorageClass: IMAGE_SYM_CLASS_STATIC
145 NumberOfRelocations: 6
146 NumberOfLinenumbers: 0
152 SimpleType: IMAGE_SYM_TYPE_NULL
153 ComplexType: IMAGE_SYM_DTYPE_NULL
154 StorageClass: IMAGE_SYM_CLASS_STATIC
157 NumberOfRelocations: 6
158 NumberOfLinenumbers: 0
164 SimpleType: IMAGE_SYM_TYPE_NULL
165 ComplexType: IMAGE_SYM_DTYPE_NULL
166 StorageClass: IMAGE_SYM_CLASS_STATIC
169 NumberOfRelocations: 0
170 NumberOfLinenumbers: 0
176 SimpleType: IMAGE_SYM_TYPE_NULL
177 ComplexType: IMAGE_SYM_DTYPE_NULL
178 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
182 SimpleType: IMAGE_SYM_TYPE_NULL
183 ComplexType: IMAGE_SYM_DTYPE_NULL
184 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
188 SimpleType: IMAGE_SYM_TYPE_NULL
189 ComplexType: IMAGE_SYM_DTYPE_NULL
190 StorageClass: IMAGE_SYM_CLASS_STATIC
194 SimpleType: IMAGE_SYM_TYPE_NULL
195 ComplexType: IMAGE_SYM_DTYPE_NULL
196 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
200 SimpleType: IMAGE_SYM_TYPE_NULL
201 ComplexType: IMAGE_SYM_DTYPE_NULL
202 StorageClass: IMAGE_SYM_CLASS_STATIC
206 SimpleType: IMAGE_SYM_TYPE_NULL
207 ComplexType: IMAGE_SYM_DTYPE_NULL
208 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
212 SimpleType: IMAGE_SYM_TYPE_NULL
213 ComplexType: IMAGE_SYM_DTYPE_NULL
214 StorageClass: IMAGE_SYM_CLASS_EXTERNAL