1# REQUIRES: x86
2
3# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
4
5# RUN: lld-link -lldmingw -debug:dwarf -out:%t.exe -entry:mainfunc -subsystem:console %t.obj
6# RUN: llvm-readobj --sections %t.exe | FileCheck %s -check-prefix SECTIONS
7# RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck %s -check-prefix RELOCS
8# RUN: llvm-readobj --file-headers %t.exe | FileCheck %s -check-prefix HEADERS
9# RUN: llvm-readobj --coff-debug-directory %t.exe | FileCheck %s -check-prefix DEBUG
10
11# SECTIONS:         Number: 3
12# SECTIONS-NEXT:    Name: .buildid (2E 62 75 69 6C 64 69 64)
13# SECTIONS-NEXT:    VirtualSize: 0x35
14# SECTIONS-NEXT:    VirtualAddress: 0x3000
15# SECTIONS:         Number: 4
16# SECTIONS-NEXT:    Name: .data (2E 64 61 74 61 00 00 00)
17# SECTIONS-NEXT:    VirtualSize: 0x8
18# SECTIONS-NEXT:    VirtualAddress: 0x4000
19
20# RELOCS:      BaseReloc [
21# RELOCS-NEXT:   Entry {
22# RELOCS-NEXT:     Type: DIR64
23# RELOCS-NEXT:     Address: 0x4000
24# RELOCS-NEXT:   }
25# RELOCS-NEXT:   Entry {
26# RELOCS-NEXT:     Type: ABSOLUTE
27# RELOCS-NEXT:     Address: 0x4000
28# RELOCS-NEXT:   }
29# RELOCS-NEXT: ]
30
31# HEADERS:     DebugRVA: 0x3000
32# HEADERS:     DebugSize: 0x1C
33
34# DEBUG: DebugDirectory [
35# DEBUG:   DebugEntry {
36# DEBUG:     Type: CodeView (0x2)
37# DEBUG:     SizeOfData: 0x19
38# DEBUG:     AddressOfRawData: 0x301C
39# DEBUG:     PointerToRawData: 0x81C
40
41	.text
42	.def	 mainfunc;
43	.scl	2;
44	.type	32;
45	.endef
46	.globl	mainfunc
47mainfunc:
48.Lfunc_begin0:
49	xorl	%eax, %eax
50	retq
51
52	.data
53	.globl	ptr
54ptr:
55	.quad	mainfunc
56
57	.section	.debug_info,"dr"
58	.quad	.Lfunc_begin0
59