Index: lld/test/MinGW/Inputs/imagebase-aarch64.yaml =================================================================== --- lld/test/MinGW/Inputs/imagebase-aarch64.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- !COFF -header: - Machine: IMAGE_FILE_MACHINE_ARM64 - Characteristics: [ ] -sections: - - Name: .text - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 16 - SectionData: 31C0C3666666662E0F1F84000000000031C0C3666666662E0F1F840000000000488D0500000000C3 -symbols: - - Name: .text - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 40 - NumberOfRelocations: 1 - NumberOfLinenumbers: 0 - CheckSum: 3930888477 - Number: 1 - - Name: mainCRTStartup - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: main - Value: 16 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: func - Value: 32 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __ImageBase - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL -... Index: lld/test/MinGW/Inputs/imagebase-arm.yaml =================================================================== --- lld/test/MinGW/Inputs/imagebase-arm.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- !COFF -header: - Machine: IMAGE_FILE_MACHINE_ARMNT - Characteristics: [ ] -sections: - - Name: .text - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 16 - SectionData: 31C0C3666666662E0F1F84000000000031C0C3666666662E0F1F840000000000B800000000C3 -symbols: - - Name: .text - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 38 - NumberOfRelocations: 1 - NumberOfLinenumbers: 0 - CheckSum: 3189961473 - Number: 1 - - Name: mainCRTStartup - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: main - Value: 16 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: func - Value: 32 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __ImageBase - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL -... Index: lld/test/MinGW/Inputs/imagebase-i386.yaml =================================================================== --- lld/test/MinGW/Inputs/imagebase-i386.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- !COFF -header: - Machine: IMAGE_FILE_MACHINE_I386 - Characteristics: [ ] -sections: - - Name: .text - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 16 - SectionData: 31C0C3666666662E0F1F84000000000031C0C3666666662E0F1F840000000000B800000000C3 -symbols: - - Name: .text - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 38 - NumberOfRelocations: 1 - NumberOfLinenumbers: 0 - CheckSum: 3189961473 - Number: 1 - - Name: _mainCRTStartup - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: _main - Value: 16 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: _func - Value: 32 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __image_base__ - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL -... Index: lld/test/MinGW/Inputs/imagebase-x86_64.yaml =================================================================== --- lld/test/MinGW/Inputs/imagebase-x86_64.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- !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: 31C0C3666666662E0F1F84000000000031C0C3666666662E0F1F840000000000488D0500000000C3 -symbols: - - Name: .text - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 40 - NumberOfRelocations: 1 - NumberOfLinenumbers: 0 - CheckSum: 3930888477 - Number: 1 - - Name: mainCRTStartup - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: main - Value: 16 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: func - Value: 32 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __image_base__ - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL -... Index: lld/test/MinGW/driver.s =================================================================== --- lld/test/MinGW/driver.s +++ /dev/null @@ -1,60 +0,0 @@ -# REQEUIRES: x86 -# RUN: rm -f a.exe a.dll - -# RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.obj -# RUN: ld.lld -m i386pep --entry main %t.obj -# RUN: llvm-readobj a.exe | FileCheck %s -# RUN: ld.lld -m i386pep -shared --entry main %t.obj -# RUN: llvm-readobj a.dll | FileCheck %s -# RUN: ld.lld -m i386pep -e main %t.obj -o %t.exe -# RUN: llvm-readobj %t.exe | FileCheck %s -# CHECK: File: - -# RUN: ld.lld -m i386pep -e main %t.obj -o %t.exe -verbose -### | FileCheck %s -check-prefix CHECK-VERBOSE -# CHECK-VERBOSE: lld-link -entry:main -# CHECK-VERBOSE-SAME: -machine:x64 -alternatename:__image_base__=__ImageBase -# CHECK-VERBOSE-SAME: -verbose - -# RUN: ld.lld -m i386pep --entry main %t.obj -o %t.exe --subsystem console -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-CONSOLE -# CHECK-CONSOLE: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3) - -# RUN: ld.lld -m i386pep --entry main %t.obj -o %t.exe --subsystem windows -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-WINDOWS -# CHECK-WINDOWS: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2) - -# RUN: ld.lld -m i386pep --entry main %t.obj -o %t.exe --stack 4194304,8192 -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-STACK -# CHECK-STACK: SizeOfStackReserve: 4194304 -# CHECK-STACK: SizeOfStackCommit: 8192 - -# RUN: yaml2obj < %p/Inputs/imagebase-i386.yaml > %t.obj -# RUN: ld.lld -m i386pe %t.obj -o %t.exe -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-I386 -# CHECK-I386: Machine: IMAGE_FILE_MACHINE_I386 - -# RUN: yaml2obj < %p/Inputs/imagebase-x86_64.yaml > %t.obj -# RUN: ld.lld -m i386pep %t.obj -o %t.exe -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-AMD64 -# CHECK-AMD64: Machine: IMAGE_FILE_MACHINE_AMD64 - -# RUN: yaml2obj < %p/Inputs/imagebase-arm.yaml > %t.obj -# RUN: ld.lld -m thumb2pe %t.obj -o %t.exe -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-ARMNT -# CHECK-ARMNT: Machine: IMAGE_FILE_MACHINE_ARMNT - -# RUN: yaml2obj < %p/Inputs/imagebase-aarch64.yaml > %t.obj -# RUN: ld.lld -m arm64pe %t.obj -o %t.exe -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix CHECK-ARM64 -# CHECK-ARM64: Machine: IMAGE_FILE_MACHINE_ARM64 - -# RUN: yaml2obj < %p/../COFF/Inputs/export.yaml > %t.obj -# RUN: ld.lld -m i386pep --shared %t.obj -o %t.dll --out-implib %t.lib -# RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB -# CHECK-IMPLIB: Symbol: __imp_exportfn3 -# CHECK-IMPLIB: Symbol: exportfn3 - -.global main -.text -main: - ret Index: lld/test/MinGW/driver.test =================================================================== --- /dev/null +++ lld/test/MinGW/driver.test @@ -0,0 +1,39 @@ +RUN: ld.lld -### /dev/null -m i386pe | FileCheck -check-prefix=I386PE %s +I386PE: -out:a.exe +I386PE-SAME: -machine:x86 +I386PE-SAME: -alternatename:__image_base__=___ImageBase + +RUN: ld.lld -### /dev/null -m i386pep | FileCheck -check-prefix=I386PEP %s +I386PEP: -out:a.exe +I386PEP-SAME: -machine:x64 +I386PEP-SAME: -alternatename:__image_base__=__ImageBase + +RUN: ld.lld -### /dev/null -m thumb2pe | FileCheck -check-prefix=THUMB2PE %s +THUMB2PE: -out:a.exe +THUMB2PE-SAME: -machine:arm +THUMB2PE-SAME: -alternatename:__image_base__=__ImageBase + +RUN: ld.lld -### /dev/null -m arm64pe | FileCheck -check-prefix=ARM64PE %s +ARM64PE: -out:a.exe +ARM64PE-SAME: -machine:arm64 +ARM64PE-SAME: -alternatename:__image_base__=__ImageBase + +RUN: ld.lld -### /dev/null -m i386pep -shared | FileCheck -check-prefix=SHARED %s +SHARED: -out:a.dll +SHARED-SAME: -dll + +RUN: ld.lld -### /dev/null -m i386pep -o foo.exe | FileCheck -check-prefix=OUT %s +OUT: -out:foo.exe + +RUN: ld.lld -### /dev/null -m i386pep -e mainCRTStartup | FileCheck -check-prefix=ENTRY %s +RUN: ld.lld -### /dev/null -m i386pep --entry mainCRTStartup | FileCheck -check-prefix=ENTRY %s +ENTRY: -entry:mainCRTStartup + +RUN: ld.lld -### /dev/null -m i386pep --subsystem console | FileCheck -check-prefix=SUBSYSTEM %s +SUBSYSTEM: -subsystem:console + +RUN: ld.lld -### /dev/null -m i386pep --stack 4194304,8192 | FileCheck -check-prefix=STACK %s +STACK: -stack:4194304,8192 + +RUN: ld.lld -### /dev/null -m i386pep --verbose foo | FileCheck -check-prefix=VERBOSE %s +VERBOSE: -verbose