llvm/lld/test/COFF/line-error.yaml

# RUN: yaml2obj %s -o %t.obj
# RUN: not lld-link %t.obj /subsystem:console 2>&1 | FileCheck %s

# CHECK: lld-link: error: undefined symbol: function
# CHECK-NEXT: >>> referenced by {{.*}}line-error.yaml.tmp.obj:(caller1)
# CHECK-NEXT: >>> referenced by E:\file.cpp:1935
# CHECK-NEXT: >>>               {{.*}}line-error.yaml.tmp.obj:(caller22)

--- !COFF
header:
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [  ]
sections:
  - Name:            .text
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       16
    SectionData:     488B0500000000488B51284881C2D80000004889C148FF2500000000
    Relocations:
      - VirtualAddress:  3
        SymbolName:      function
        Type:            IMAGE_REL_AMD64_REL32
  - Name:            .text
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       16
    SectionData:     488B0500000000488B51084881C2D80000004889C148FF2500000000
    Relocations:
      - VirtualAddress:  3
        SymbolName:      function
        Type:            IMAGE_REL_AMD64_REL32
  - Name:            '.debug$S'
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    Subsections:
      - !FileChecksums
        Checksums:
          - FileName:        'E:\file.cpp'
            Kind:            MD5
            Checksum:        D72EDEF8B8E50C364A330F9CB3CD904B
      - !StringTable
        Strings:
          - 'E:\file.cpp'
  - Name:            '.debug$S'
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    Subsections:
      - !Lines
        CodeSize:        28
        Flags:           [  ]
        RelocOffset:     0
        RelocSegment:    0
        Blocks:          []
    Relocations:
      - VirtualAddress:  12
        SymbolName:      caller1
        Type:            IMAGE_REL_AMD64_SECREL
  - Name:            '.debug$S'
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    Subsections:
      - !Lines
        CodeSize:        28
        Flags:           [  ]
        RelocOffset:     0
        RelocSegment:    0
        Blocks:
          - FileName:        'E:\file.cpp'
            Lines:
              - Offset:          11
                LineStart:       1935
                IsStatement:     false
                EndDelta:        0
            Columns:         []
    Relocations:
      - VirtualAddress:  12
        SymbolName:      caller22
        Type:            IMAGE_REL_AMD64_SECREL
symbols:
  - Name:            .text
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          28
      NumberOfRelocations: 2
      NumberOfLinenumbers: 0
      CheckSum:        2430089736
      Number:          1
      Selection:       IMAGE_COMDAT_SELECT_NODUPLICATES
  - Name:            caller1
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            .text
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          28
      NumberOfRelocations: 2
      NumberOfLinenumbers: 0
      CheckSum:        3449717304
      Number:          2
      Selection:       IMAGE_COMDAT_SELECT_NODUPLICATES
  - Name:            caller22
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            '.debug$S'
    Value:           0
    SectionNumber:   3
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          767204
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        4280093374
      Number:          3
  - Name:            '.debug$S'
    Value:           0
    SectionNumber:   4
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          296
      NumberOfRelocations: 1
      NumberOfLinenumbers: 0
      CheckSum:        1957793731
      Number:          1
      Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
  - Name:            '.debug$S'
    Value:           0
    SectionNumber:   5
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          276
      NumberOfRelocations: 1
      NumberOfLinenumbers: 0
      CheckSum:        1957793731
      Number:          2
      Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
  - Name:            function
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
...