@@ -23,12 +23,32 @@ CHECK1: AddressOfNewExeHeader: 64
2323
2424## Invalid DOS signature (must be `MZ`)
2525# RUN: not lld-link /out:%t.exe /entry:main /stub:%p/Inputs/stub64zz %t.obj 2>&1 | FileCheck -check-prefix=CHECK2 %s
26- # CHECK2: lld-link: error: /stub: invalid DOS signature: {{.*}}
2726
28- ## Unaligned stub (must be aligned to 8)
29- # RUN: not lld-link /out:%t.exe /entry:main /stub:%p/Inputs/stub68mz %t.obj 2>&1 | FileCheck -check-prefix=CHECK3 %s
30- # CHECK3: lld-link: error: /stub: stub must be aligned to 8 bytes: {{.*}}
27+ CHECK2: lld-link: error: /stub: invalid DOS signature: {{.*}}
28+
29+ ## Unlike MS linker, we accept non-8byte-aligned stubs and we add paddings ourselves
30+ # RUN: lld-link /out:%t.exe /entry:main /stub:%p/Inputs/stub64mz %t.obj
31+ # RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK3 %s
32+
33+ CHECK3: Magic: MZ
34+ CHECK3: UsedBytesInTheLastPage: 144
35+ CHECK3: FileSizeInPages: 3
36+ CHECK3: NumberOfRelocationItems: 0
37+ CHECK3: HeaderSizeInParagraphs: 4
38+ CHECK3: MinimumExtraParagraphs: 0
39+ CHECK3: MaximumExtraParagraphs: 65535
40+ CHECK3: InitialRelativeSS: 0
41+ CHECK3: InitialSP: 184
42+ CHECK3: Checksum: 0
43+ CHECK3: InitialIP: 0
44+ CHECK3: InitialRelativeCS: 0
45+ CHECK3: AddressOfRelocationTable: 64
46+ CHECK3: OverlayNumber: 0
47+ CHECK3: OEMid: 0
48+ CHECK3: OEMinfo: 0
49+ CHECK3: AddressOfNewExeHeader: 64
3150
3251## Too-small stub (must be at least 64 bytes long) && Unaligned
3352# RUN: not lld-link /out:%t.exe /entry:main /stub:%p/Inputs/stub63mz %t.obj 2>&1 | FileCheck -check-prefix=CHECK4 %s
34- # CHECK4: lld-link: error: /stub: stub must be greater than or equal to 64 bytes: {{.*}}
53+
54+ CHECK4: lld-link: error: /stub: stub must be greater than or equal to 64 bytes: {{.*}}
0 commit comments