[ObjectYAML] [COFF] Support multiple symbols with the same name
[llvm-complete.git] / test / tools / yaml2obj / coff-symbol-index.yaml
blob592ecb38b1d8d51ddbd8d8da41e53e63ec92b2d0
1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-readobj -relocations %t | FileCheck %s --check-prefix=RELOCS
3 # RUN: obj2yaml %t | FileCheck %s --check-prefix=YAML
5 # RELOCS:      Relocations [
6 # RELOCS-NEXT:   Section (1) .text {
7 # RELOCS-NEXT:     0x3 IMAGE_REL_AMD64_REL32 .rdata (0)
8 # RELOCS-NEXT:     0xA IMAGE_REL_AMD64_REL32 .rdata (1)
9 # RELOCS-NEXT:     0x11 IMAGE_REL_AMD64_REL32 foo (2)
10 # RELOCS-NEXT:   }
11 # RELOCS-NEXT: ]
13 # Check that we usually output relocations with SymbolName.
14 # For relocations with a non-unique symbol name, output
15 # SymbolTableIndex instead.
17 # YAML:          Relocations:     
18 # YAML-NEXT:       - VirtualAddress:  3
19 # YAML-NEXT:         SymbolTableIndex: 0
20 # YAML-NEXT:         Type:            IMAGE_REL_AMD64_REL32
21 # YAML-NEXT:       - VirtualAddress:  10
22 # YAML-NEXT:         SymbolTableIndex: 1
23 # YAML-NEXT:         Type:            IMAGE_REL_AMD64_REL32
24 # YAML-NEXT:       - VirtualAddress:  17
25 # YAML-NEXT:         SymbolName:      foo
26 # YAML-NEXT:         Type:            IMAGE_REL_AMD64_REL32
28 --- !COFF
29 header:          
30   Machine:         IMAGE_FILE_MACHINE_AMD64
31   Characteristics: [  ]
32 sections:        
33   - Name:            .text
34     Characteristics: [  ]
35     Alignment:       4
36     SectionData:     488B0500000000488B0500000000488B0500000000
37     Relocations:     
38       - VirtualAddress:  3
39         SymbolTableIndex: 0
40         Type:            IMAGE_REL_AMD64_REL32
41       - VirtualAddress:  10
42         SymbolTableIndex: 1
43         Type:            IMAGE_REL_AMD64_REL32
44       - VirtualAddress:  17
45         SymbolName:      foo
46         Type:            IMAGE_REL_AMD64_REL32
47   - Name:            .rdata
48     Characteristics: [  ]
49     Alignment:       1
50     SectionData:     '00'
51   - Name:            .rdata
52     Characteristics: [  ]
53     Alignment:       1
54     SectionData:     '01'
55 symbols:         
56   - Name:            .rdata
57     Value:           0
58     SectionNumber:   2
59     SimpleType:      IMAGE_SYM_TYPE_NULL
60     ComplexType:     IMAGE_SYM_DTYPE_NULL
61     StorageClass:    IMAGE_SYM_CLASS_STATIC
62   - Name:            .rdata
63     Value:           0
64     SectionNumber:   3
65     SimpleType:      IMAGE_SYM_TYPE_NULL
66     ComplexType:     IMAGE_SYM_DTYPE_NULL
67     StorageClass:    IMAGE_SYM_CLASS_STATIC
68   - Name:            foo
69     Value:           0
70     SectionNumber:   3
71     SimpleType:      IMAGE_SYM_TYPE_NULL
72     ComplexType:     IMAGE_SYM_DTYPE_NULL
73     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
74 ...