Index: test/COFF/Inputs/hello64.def =================================================================== --- /dev/null +++ test/COFF/Inputs/hello64.def @@ -0,0 +1,4 @@ +LIBRARY hellolib64.dll +EXPORTS +MessageBoxA +ExitProcess \ No newline at end of file Index: test/COFF/Inputs/hello64.obj.yaml =================================================================== --- /dev/null +++ test/COFF/Inputs/hello64.obj.yaml @@ -0,0 +1,110 @@ +--- +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 4883EC2848C7C100000000488D15000000004C8D050000000041B900000000E800000000B900000000E800000000 + Relocations: + - VirtualAddress: 14 + SymbolName: message + Type: IMAGE_REL_AMD64_REL32 + - VirtualAddress: 21 + SymbolName: caption + Type: IMAGE_REL_AMD64_REL32 + - VirtualAddress: 32 + SymbolName: MessageBoxA + Type: IMAGE_REL_AMD64_REL32 + - VirtualAddress: 42 + SymbolName: ExitProcess + Type: IMAGE_REL_AMD64_REL32 + - Name: .data + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 16 + SectionData: 48656C6C6F0048656C6C6F20576F726C6400 + - Name: '.debug$S' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + SectionData: 04000000F1000000830000004800011100000000433A5C63796777696E5C686F6D655C727569755C6C6C766D5C746F6F6C735C6C6C645C746573745C7065636F66665C496E707574735C68656C6C6F36342E6F626A0037003C1103020000D00000000000000000000C0000000D5201004D6963726F736F667420285229204D6163726F20417373656D626C6572000000 +symbols: + - Name: '@comp.id' + Value: 14635533 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: '@feat.00' + Value: 16 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: '.text$mn' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 46 + NumberOfRelocations: 4 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: .data + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 18 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$S' + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 144 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: ExitProcess + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: MessageBoxA + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: message + Value: 6 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: caption + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... Index: test/COFF/hello64.test =================================================================== --- /dev/null +++ test/COFF/hello64.test @@ -0,0 +1,22 @@ +# REQUIRES: x86 + +# RUN: yaml2obj %p/Inputs/hello64.obj.yaml > %t.obj + +# RUN: lld -flavor link2 /out:%t.exe /subsystem:windows /machine:x64 \ +# RUN: /entry:main -- %t.obj %p/Inputs/hello64gnu.lib +# RUN: llvm-objdump -disassemble %t.exe | FileCheck %s + +CHECK: 6000: 48 83 ec 28 subq $40, %rsp +CHECK: 6004: 48 c7 c1 00 00 00 00 movq $0, %rcx +CHECK: 600b: 48 8d 15 f4 af ff ff leaq -20492(%rip), %rdx +CHECK: 6012: 4c 8d 05 e7 af ff ff leaq -20505(%rip), %r8 +CHECK: 6019: 41 b9 00 00 00 00 movl $0, %r9d +CHECK: 601f: e8 12 00 00 00 callq 18 +CHECK: 6024: b9 00 00 00 00 movl $0, %ecx +CHECK: 6029: e8 00 00 00 00 callq 0 +CHECK: 602e: ff 25 cc cf ff ff jmpq *-12340(%rip) +CHECK: 6034: cc int3 +CHECK: 6035: cc int3 +CHECK: 6036: ff 25 cc cf ff ff jmpq *-12340(%rip) +CHECK: 603c: cc int3 +CHECK: 603d: cc int3