delayimporttables.yaml 4.46 KB
# RUN: yaml2obj %p/Inputs/delayimporttables-dll1.yaml -o %t1.obj
# RUN: yaml2obj %p/Inputs/delayimporttables-dll2.yaml -o %t2.obj
# RUN: yaml2obj %s -o %t.obj
# RUN: lld-link /nodefaultlib /entry:DllMain /out:%T/delayimporttables-dll1.dll /dll /implib:%t-dll1.lib %t1.obj
# RUN: lld-link /nodefaultlib /entry:DllMain /out:%T/delayimporttables-dll2.dll /dll /implib:%t-dll2.lib %t2.obj
# RUN: lld-link /nodefaultlib /entry:main /out:%t.exe /delayload:delayimporttables-dll1.dll /delayload:delayimporttables-dll2.dll %t.obj %t-dll1.lib %t-dll2.lib
# RUN: llvm-readobj --coff-imports %t.exe |FileCheck %s

#      CHECK: Format: COFF-x86-64
# CHECK-NEXT: Arch: x86_64
# CHECK-NEXT: AddressSize: 64bit
# CHECK-NEXT: DelayImport {
# CHECK-NEXT:   Name: delayimporttables-dll1.dll
# CHECK-NEXT:   Attributes: 0x1
# CHECK-NEXT:   ModuleHandle: 0x3000
# CHECK-NEXT:   ImportAddressTable: 0x3010
# CHECK-NEXT:   ImportNameTable: 0x2060
# CHECK-NEXT:   BoundDelayImportTable: 0x0
# CHECK-NEXT:   UnloadDelayImportTable: 0x0
# CHECK-NEXT:   Import {
# CHECK-NEXT:     Symbol: one (0)
# CHECK-NEXT:     Address: 0x14000104D
# CHECK-NEXT:   }
# CHECK-NEXT:   Import {
# CHECK-NEXT:     Symbol: two (0)
# CHECK-NEXT:     Address: 0x140001059
# CHECK-NEXT:   }
# CHECK-NEXT: }
# CHECK-NEXT: DelayImport {
# CHECK-NEXT:   Name: delayimporttables-dll2.dll
# CHECK-NEXT:   Attributes: 0x1
# CHECK-NEXT:   ModuleHandle: 0x3008
# CHECK-NEXT:   ImportAddressTable: 0x3028
# CHECK-NEXT:   ImportNameTable: 0x2078
# CHECK-NEXT:   BoundDelayImportTable: 0x0
# CHECK-NEXT:   UnloadDelayImportTable: 0x0
# CHECK-NEXT:   Import {
# CHECK-NEXT:     Symbol: left (0)
# CHECK-NEXT:     Address: 0x1400010B8
# CHECK-NEXT:   }
# CHECK-NEXT:   Import {
# CHECK-NEXT:     Symbol: right (0)
# CHECK-NEXT:     Address: 0x1400010C4
# CHECK-NEXT:   }
# CHECK-NEXT: }

--- !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:            '.text$mn'
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       16
    SectionData:     4889542410894C24084883EC28FF1500000000FF1500000000FF1500000000FF150000000033C04883C428C3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC488954241048894C240833C0C3
    Relocations:
      - VirtualAddress:  15
        SymbolName:      __imp_one
        Type:            IMAGE_REL_AMD64_REL32
      - VirtualAddress:  21
        SymbolName:      __imp_two
        Type:            IMAGE_REL_AMD64_REL32
      - VirtualAddress:  27
        SymbolName:      __imp_left
        Type:            IMAGE_REL_AMD64_REL32
      - VirtualAddress:  33
        SymbolName:      __imp_right
        Type:            IMAGE_REL_AMD64_REL32
symbols:
  - 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:            __imp_one
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __imp_two
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __imp_left
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __imp_right
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            main
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __delayLoadHelper2
    Value:           64
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
...