1# Make sure LLD does some light relocation bounds checking.
2
3# RUN: yaml2obj %s -o %t.obj
4# RUN: not lld-link %t.obj -entry:main -nodefaultlib -out:%t.exe 2>&1 | FileCheck %s
5
6# CHECK: error: relocation points beyond the end of its parent section
7
8--- !COFF
9header:
10  Machine:         IMAGE_FILE_MACHINE_I386
11  Characteristics: [  ]
12sections:
13  - Name:            .text
14    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
15    Alignment:       16
16    SectionData:     5589E550C745FC00000000A10000000083C4045DC3
17    Relocations:
18      - VirtualAddress:  24
19        SymbolName:      _g
20        Type:            IMAGE_REL_I386_DIR32
21  - Name:            .data
22    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
23    Alignment:       4
24    SectionData:     2A000000
25symbols:
26  - Name:            .text
27    Value:           0
28    SectionNumber:   1
29    SimpleType:      IMAGE_SYM_TYPE_NULL
30    ComplexType:     IMAGE_SYM_DTYPE_NULL
31    StorageClass:    IMAGE_SYM_CLASS_STATIC
32    SectionDefinition:
33      Length:          21
34      NumberOfRelocations: 1
35      NumberOfLinenumbers: 0
36      CheckSum:        662775349
37      Number:          1
38  - Name:            .data
39    Value:           0
40    SectionNumber:   2
41    SimpleType:      IMAGE_SYM_TYPE_NULL
42    ComplexType:     IMAGE_SYM_DTYPE_NULL
43    StorageClass:    IMAGE_SYM_CLASS_STATIC
44    SectionDefinition:
45      Length:          4
46      NumberOfRelocations: 0
47      NumberOfLinenumbers: 0
48      CheckSum:        3482275674
49      Number:          2
50  - Name:            _main
51    Value:           0
52    SectionNumber:   1
53    SimpleType:      IMAGE_SYM_TYPE_NULL
54    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
55    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
56  - Name:            _g
57    Value:           0
58    SectionNumber:   2
59    SimpleType:      IMAGE_SYM_TYPE_NULL
60    ComplexType:     IMAGE_SYM_DTYPE_NULL
61    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
62...
63