aboutsummaryrefslogtreecommitdiff
path: root/test/pecoff/base-reloc.test
blob: 5bc83de4d1c2375e17a03d4fc4a49d7e25e5f48f (plain) (blame)
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
# RUN: yaml2obj %p/Inputs/basereloc.obj.yaml > %t.obj
#
# RUN: lld -flavor link /out:%t.exe /subsystem:console /force /opt:noref \
# RUN:   -- %t.obj
# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck %s --check-prefix=BASEREL
#
# RUN: lld -flavor link /out:%t2.exe /subsystem:console /force /fixed \
# RUN:   /opt:noref -- %t.obj
# RUN: llvm-readobj -coff-basereloc %t2.exe | FileCheck %s --check-prefix=NOBASEREL

BASEREL:      BaseReloc [
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x2007
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x200C
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x201E
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: ABSOLUTE
BASEREL-NEXT:     Address: 0x2000
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x3007
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x300C
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x301E
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: ABSOLUTE
BASEREL-NEXT:     Address: 0x3000
BASEREL-NEXT:   }
BASEREL-NEXT: ]

NOBASEREL:      BaseReloc [
NOBASEREL-NEXT: ]

# RUN: lld -flavor link /out:%t3.exe /subsystem:console /force /opt:noref \
# RUN:   -- %t.obj
# RUN: llvm-readobj -file-headers -sections %t3.exe | FileCheck %s \
# RUN:   --check-prefix=BASEREL-HEADER
#
# RUN: lld -flavor link /out:%t4.exe /subsystem:console /force /opt:noref \
# RUN:   /fixed -- %t.obj
# RUN: llvm-readobj -file-headers %t4.exe | FileCheck %s \
# RUN:   --check-prefix=NOBASEREL-HEADER

BASEREL-HEADER-NOT: IMAGE_FILE_RELOCS_STRIPPED

NOBASEREL-HEADER: IMAGE_FILE_RELOCS_STRIPPED

BASEREL-HEADER:     BaseRelocationTableRVA: 0x4000
BASEREL-HEADER:     BaseRelocationTableSize: 0x20
BASEREL-HEADER:     Name: .reloc (2E 72 65 6C 6F 63 00 00)
BASEREL-HEADER-NEXT:     VirtualSize: 0x20
BASEREL-HEADER-NEXT:     VirtualAddress: 0x4000
BASEREL-HEADER-NEXT:     RawDataSize: 512
BASEREL-HEADER-NEXT:     PointerToRawData: 0xA00
BASEREL-HEADER-NEXT:     PointerToRelocations: 0x0
BASEREL-HEADER-NEXT:     PointerToLineNumbers: 0x0
BASEREL-HEADER-NEXT:     RelocationCount: 0
BASEREL-HEADER-NEXT:     LineNumberCount: 0
BASEREL-HEADER-NEXT:     Characteristics [ (0x42000040)
BASEREL-HEADER-NEXT:       IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
BASEREL-HEADER-NEXT:       IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
BASEREL-HEADER-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)
BASEREL-HEADER-NEXT:     ]