diff options
Diffstat (limited to 'test/COFF')
-rw-r--r-- | test/COFF/Inputs/constant-import.s | 21 | ||||
-rw-r--r-- | test/COFF/constant.test | 5 | ||||
-rw-r--r-- | test/COFF/icf-data.test | 61 | ||||
-rw-r--r-- | test/COFF/lldmap.test | 11 |
4 files changed, 92 insertions, 6 deletions
diff --git a/test/COFF/Inputs/constant-import.s b/test/COFF/Inputs/constant-import.s new file mode 100644 index 000000000000..4249d74c9cb7 --- /dev/null +++ b/test/COFF/Inputs/constant-import.s @@ -0,0 +1,21 @@ + + .def __DllMainCRTStartup@12 + .type 32 + .scl 2 + .endef + .global __DllMainCRTStartup@12 +__DllMainCRTStartup@12: + ret + + .data + .def _Data + .type 0 + .scl 2 + .endef + .global _Data +_Data: + .long ___CFConstantStringClassReference + + .section .drectve + .ascii " -export:_Data" + diff --git a/test/COFF/constant.test b/test/COFF/constant.test new file mode 100644 index 000000000000..3c8956beac9c --- /dev/null +++ b/test/COFF/constant.test @@ -0,0 +1,5 @@ +RUN: mkdir -p %t +RUN: llvm-mc -triple i686-unknown-windows-msvc -filetype obj -o %t/import.o %S/Inputs/constant-import.s +RUN: llc -mtriple i686-unknown-windows-msvc -filetype obj -o %t/export.o %S/Inputs/constant-export.ll +RUN: lld-link -machine:x86 -dll -out:%t/export.dll %t/export.o -entry:__CFConstantStringClassReference +RUN: lld-link -machine:x86 -dll -out:%t/import.dll %t/import.o %t/export.lib diff --git a/test/COFF/icf-data.test b/test/COFF/icf-data.test new file mode 100644 index 000000000000..20bdecaf3cfe --- /dev/null +++ b/test/COFF/icf-data.test @@ -0,0 +1,61 @@ +# RUN: yaml2obj < %s > %t.obj +# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \ +# RUN: /verbose %t.obj > %t.log 2>&1 +# RUN: FileCheck %s < %t.log + +# CHECK-NOT: Removed foo +# CHECK-NOT: Removed bar + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [] +sections: + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 4883EC28E8000000004883C428C3 + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 4883EC28E8000000004883C428C3 +symbols: + - Name: '.text$mn' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 14 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 1682752513 + Number: 0 + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES + - Name: '.text$mn' + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 14 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 1682752513 + Number: 0 + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES + - Name: foo + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: bar + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/COFF/lldmap.test b/test/COFF/lldmap.test index 69080fd639ab..d705a16c6c2a 100644 --- a/test/COFF/lldmap.test +++ b/test/COFF/lldmap.test @@ -1,11 +1,10 @@ # RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj # RUN: lld-link /out:%t.exe /entry:main /lldmap:%T/foo.map %t.obj -# RUN: FileCheck %s < %T/foo.map +# RUN: FileCheck -strict-whitespace %s < %T/foo.map # RUN: lld-link /out:%T/bar.exe /entry:main /lldmap %t.obj -# RUN: FileCheck %s < %T/bar.map +# RUN: FileCheck -strict-whitespace %s < %T/bar.map -# CHECK: Address Size Align Out In File Symbol +# CHECK: Address Size Align Out In Symbol # CHECK-NEXT: 00001000 00000006 4096 .text -# CHECK-NEXT: 00001000 00000006 16 .text$mn -# CHECK-NEXT: 00001000 00000006 16 {{.*}}lldmap.test.tmp.obj -# CHECK-NEXT: 00001000 00000006 0 main +# CHECK-NEXT: 00001000 00000006 16 {{.*}}lldmap.test.tmp.obj:(.text$mn) +# CHECK-NEXT: 00001000 00000000 0 main |