reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
# RUN: yaml2obj %s -o %t.obj
# RUN: lld-link %t.obj -nodefaultlib -entry:main -debug -out:%t.exe -pdb:%t.pdb
# RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s

# To regenerate the object file:
# $ cat symbol-types.c
# struct Foo { int x; };
# typedef struct Foo UDT_Foo;
# UDT_Foo global_foo = {42};
# int main() { return global_foo.x; }
# $ cl -c -Z7 symbol-types.c

# Note that the type of 'global' goes from 0x1005 in the object file to 0x1004
# in the PDB because the LF_FUNC_ID is moved to the id stream.

# CHECK-LABEL:                  Global Symbols
# CHECK-NEXT:  ============================================================
# CHECK-NEXT:   Records
# CHECK-NEXT:       48 | S_PROCREF [size = 20] `main`
# CHECK-NEXT:            module = 1, sum name = 0, offset = 116
# CHECK-NEXT:       96 | S_UDT [size = 16] `UDT_Foo`
# CHECK-NEXT:            original type = 0x1004
# CHECK-NEXT:      112 | S_UDT [size = 12] `Foo`
# CHECK-NEXT:            original type = 0x1004
# CHECK-NEXT:       68 | S_GDATA32 [size = 28] `global_foo`
# CHECK-NEXT:            type = 0x1004 (Foo), addr = 0003:0000

# CHECK:                           Symbols
# CHECK: ============================================================
# CHECK-LABEL:   Mod 0000 | `{{.*}}pdb-symbol-types.yaml.tmp.obj`:
# CHECK:     4 | S_OBJNAME [size = 52] sig=0, `C:\src\llvm-project\build\symbol-types.obj`
# CHECK:    56 | S_COMPILE3 [size = 60]
# CHECK:         machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
# CHECK:         frontend = 19.0.24215.1, backend = 19.0.24215.1
# CHECK:         flags = security checks | hot patchable
# CHECK:   116 | S_GPROC32 [size = 44] `main`
# CHECK:         parent = 0, end = 192, addr = 0001:0000, code size = 7
# CHECK:         debug start = 0, debug end = 6, flags = none
# CHECK:   160 | S_FRAMEPROC [size = 32]
# CHECK:         size = 0, padding size = 0, offset to padding = 0
# CHECK:         bytes of callee saved registers = 0, exception handler addr = 0000:0000
# CHECK:         flags = has async eh | opt speed
# CHECK:   192 | S_END [size = 4]
# CHECK:   196 | S_BUILDINFO [size = 8] BuildId = `0x100A`
# CHECK-LABEL:   Mod 0001 | `* Linker *`:

--- !COFF
header:
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [  ]
sections:
  - Name:            .drectve
    Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
    Alignment:       1
    SectionData:     2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
  - Name:            '.debug$S'
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
    Alignment:       1
    Subsections:
      - !Symbols
        Records:
          - Kind:            S_OBJNAME
            ObjNameSym:
              Signature:       0
              ObjectName:      'C:\src\llvm-project\build\symbol-types.obj'
          - Kind:            S_COMPILE3
            Compile3Sym:
              Flags:           [ SecurityChecks, HotPatch ]
              Machine:         X64
              FrontendMajor:   19
              FrontendMinor:   0
              FrontendBuild:   24215
              FrontendQFE:     1
              BackendMajor:    19
              BackendMinor:    0
              BackendBuild:    24215
              BackendQFE:      1
              Version:         'Microsoft (R) Optimizing Compiler'
      - !Symbols
        Records:
          - Kind:            S_GPROC32_ID
            ProcSym:
              CodeSize:        7
              DbgStart:        0
              DbgEnd:          6
              FunctionType:    4098
              Flags:           [  ]
              DisplayName:     main
          - Kind:            S_FRAMEPROC
            FrameProcSym:
              TotalFrameBytes: 0
              PaddingFrameBytes: 0
              OffsetToPadding: 0
              BytesOfCalleeSavedRegisters: 0
              OffsetOfExceptionHandler: 0
              SectionIdOfExceptionHandler: 0
              Flags:           [ AsynchronousExceptionHandling, OptimizedForSpeed ]
          - Kind:            S_PROC_ID_END
            ScopeEndSym:
      - !Lines
        CodeSize:        7
        Flags:           [  ]
        RelocOffset:     0
        RelocSegment:    0
        Blocks:
          - FileName:        'c:\src\llvm-project\build\symbol-types.c'
            Lines:
              - Offset:          0
                LineStart:       4
                IsStatement:     true
                EndDelta:        0
              - Offset:          0
                LineStart:       5
                IsStatement:     true
                EndDelta:        0
              - Offset:          6
                LineStart:       6
                IsStatement:     true
                EndDelta:        0
            Columns:
      - !Symbols
        Records:
          - Kind:            S_GDATA32
            DataSym:
              Type:            4101
              DisplayName:     global_foo
          - Kind:            S_UDT
            UDTSym:
              Type:            4101
              UDTName:         UDT_Foo
          - Kind:            S_UDT
            UDTSym:
              Type:            4101
              UDTName:         Foo
      - !FileChecksums
        Checksums:
          - FileName:        'c:\src\llvm-project\build\symbol-types.c'
            Kind:            MD5
            Checksum:        F833E1A4909FF6FEC5689A664F3BE725
      - !StringTable
        Strings:
          - 'c:\src\llvm-project\build\symbol-types.c'
      - !Symbols
        Records:
          - Kind:            S_BUILDINFO
            BuildInfoSym:
              BuildId:         4111
    Relocations:
      - VirtualAddress:  164
        SymbolName:      main
        Type:            IMAGE_REL_AMD64_SECREL
      - VirtualAddress:  168
        SymbolName:      main
        Type:            IMAGE_REL_AMD64_SECTION
      - VirtualAddress:  220
        SymbolName:      main
        Type:            IMAGE_REL_AMD64_SECREL
      - VirtualAddress:  224
        SymbolName:      main
        Type:            IMAGE_REL_AMD64_SECTION
      - VirtualAddress:  284
        SymbolName:      global_foo
        Type:            IMAGE_REL_AMD64_SECREL
      - VirtualAddress:  288
        SymbolName:      global_foo
        Type:            IMAGE_REL_AMD64_SECTION
  - Name:            '.debug$T'
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
    Alignment:       1
    Types:
      - Kind:            LF_ARGLIST
        ArgList:
          ArgIndices:      [ 0 ]
      - Kind:            LF_PROCEDURE
        Procedure:
          ReturnType:      116
          CallConv:        NearC
          Options:         [ None ]
          ParameterCount:  0
          ArgumentList:    4096
      - Kind:            LF_FUNC_ID
        FuncId:
          ParentScope:     0
          FunctionType:    4097
          Name:            main
      - Kind:            LF_STRUCTURE
        Class:
          MemberCount:     0
          Options:         [ None, ForwardReference, HasUniqueName ]
          FieldList:       0
          Name:            Foo
          UniqueName:      '.?AUFoo@@'
          DerivationList:  0
          VTableShape:     0
          Size:            0
      - Kind:            LF_FIELDLIST
        FieldList:
          - Kind:            LF_MEMBER
            DataMember:
              Attrs:           3
              Type:            116
              FieldOffset:     0
              Name:            x
      - Kind:            LF_STRUCTURE
        Class:
          MemberCount:     1
          Options:         [ None, HasUniqueName ]
          FieldList:       4100
          Name:            Foo
          UniqueName:      '.?AUFoo@@'
          DerivationList:  0
          VTableShape:     0
          Size:            4
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          'c:\src\llvm-project\build\symbol-types.c'
      - Kind:            LF_UDT_SRC_LINE
        UdtSourceLine:
          UDT:             4101
          SourceFile:      4102
          LineNumber:      1
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          'C:\src\llvm-project\build'
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          'C:\PROGRA~2\MICROS~1.0\VC\Bin\amd64\cl.exe'
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          '-c -Z7 -MT -IC:\PROGRA~2\MICROS~1.0\VC\include -IC:\PROGRA~2\MICROS~1.0\VC\atlmfc\include -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\ucrt -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\shared -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\um'
      - Kind:            LF_SUBSTR_LIST
        StringList:
          StringIndices:   [ 4106 ]
      - Kind:            LF_STRING_ID
        StringId:
          Id:              4107
          String:          ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          symbol-types.c
      - Kind:            LF_STRING_ID
        StringId:
          Id:              0
          String:          'C:\src\llvm-project\build\vc140.pdb'
      - Kind:            LF_BUILDINFO
        BuildInfo:
          ArgIndices:      [ 4104, 4105, 4109, 4110, 4108 ]
  - Name:            .data
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
    Alignment:       4
    SectionData:     2A000000
  - Name:            '.text$mn'
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       16
    SectionData:     8B0500000000C3
    Relocations:
      - VirtualAddress:  2
        SymbolName:      global_foo
        Type:            IMAGE_REL_AMD64_REL32
symbols:
  - Name:            '@comp.id'
    Value:           17063575
    SectionNumber:   -1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
  - Name:            '@feat.00'
    Value:           2147484048
    SectionNumber:   -1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
  - Name:            .drectve
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          47
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          0
  - Name:            '.debug$S'
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          432
      NumberOfRelocations: 6
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          0
  - Name:            '.debug$T'
    Value:           0
    SectionNumber:   3
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          732
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          0
  - Name:            .data
    Value:           0
    SectionNumber:   4
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          4
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        3482275674
      Number:          0
  - Name:            global_foo
    Value:           0
    SectionNumber:   4
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            '.text$mn'
    Value:           0
    SectionNumber:   5
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          7
      NumberOfRelocations: 1
      NumberOfLinenumbers: 0
      CheckSum:        3635526833
      Number:          0
  - Name:            main
    Value:           0
    SectionNumber:   5
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
...