[lld] r245826 - COFF: Update a test for ICF.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 00:52:09 PDT 2015
Author: ruiu
Date: Mon Aug 24 02:52:08 2015
New Revision: 245826
URL: http://llvm.org/viewvc/llvm-project?rev=245826&view=rev
Log:
COFF: Update a test for ICF.
The old test files were just compiler outputs, so it was hard to
debug if something goes wrong. The new test file is carefully
hand-crafted to trigger ICF to avoid that.
Added:
lld/trunk/test/COFF/icf-simple.test
- copied, changed from r245792, lld/trunk/test/COFF/Inputs/icf4.yaml
Removed:
lld/trunk/test/COFF/Inputs/icf1.yaml
lld/trunk/test/COFF/Inputs/icf2.yaml
lld/trunk/test/COFF/Inputs/icf3.yaml
lld/trunk/test/COFF/Inputs/icf4.yaml
lld/trunk/test/COFF/Inputs/icf5.yaml
lld/trunk/test/COFF/icf.test
Removed: lld/trunk/test/COFF/Inputs/icf1.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf1.yaml?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf1.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf1.yaml (removed)
@@ -1,43 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
- Relocations:
- - VirtualAddress: 0
- SymbolName: foo
- Type: IMAGE_REL_AMD64_REL32
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 00000000
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 1
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: main
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: foo
- Value: 0
- SectionNumber: 2
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
Removed: lld/trunk/test/COFF/Inputs/icf2.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf2.yaml?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf2.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf2.yaml (removed)
@@ -1,40 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
- Relocations:
- - VirtualAddress: 0
- SymbolName: foo
- Type: IMAGE_REL_AMD64_REL32
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 1
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- # icf2 is identical with main
- - Name: icf2
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: foo
- Value: 0
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
Removed: lld/trunk/test/COFF/Inputs/icf3.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf3.yaml?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf3.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf3.yaml (removed)
@@ -1,40 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
- Relocations:
- - VirtualAddress: 4
- SymbolName: foo
- Type: IMAGE_REL_AMD64_REL32
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 1
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- # icf3 is *not* identical with main because its relocation is different
- - Name: icf3
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: foo
- Value: 0
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
Removed: lld/trunk/test/COFF/Inputs/icf4.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf4.yaml?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf4.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf4.yaml (removed)
@@ -1,47 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
- - Name: .assoc
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- # icf4 is *not* identical with main because it has an associative section
- - Name: icf4
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: .assoc
- Value: 0
- SectionNumber: 2
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 1
- Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
Removed: lld/trunk/test/COFF/Inputs/icf5.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf5.yaml?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf5.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf5.yaml (removed)
@@ -1,30 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 16
- SectionData: 0000000000000000
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 8
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- # icf5 is *not* identical with main because its symbol value is different
- - Name: icf5
- Value: 5
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
Copied: lld/trunk/test/COFF/icf-simple.test (from r245792, lld/trunk/test/COFF/Inputs/icf4.yaml)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf-simple.test?p2=lld/trunk/test/COFF/icf-simple.test&p1=lld/trunk/test/COFF/Inputs/icf4.yaml&r1=245792&r2=245826&rev=245826&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf4.yaml (original)
+++ lld/trunk/test/COFF/icf-simple.test Mon Aug 24 02:52:08 2015
@@ -1,47 +1,60 @@
+# RUN: yaml2obj < %s > %t.obj
+# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
+# RUN: /opt:lldicf /verbose %t.obj > %t.log 2>&1
+# RUN: FileCheck %s < %t.log
+
+# CHECK: Replaced bar
+
---
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: []
sections:
- - Name: .text
+ - Name: '.text$mn'
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
- SectionData: 0000000000000000
- - Name: .assoc
+ SectionData: 4883EC28E8000000004883C428C3
+ - Name: '.text$mn'
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
- SectionData: 0000000000000000
+ SectionData: 4883EC28E8000000004883C428C3
symbols:
- - Name: .text
+ - Name: '.text$mn'
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
- Length: 8
+ Length: 14
NumberOfRelocations: 0
NumberOfLinenumbers: 0
- CheckSum: 0
+ CheckSum: 1682752513
Number: 0
- Selection: IMAGE_COMDAT_SELECT_ANY
- # icf4 is *not* identical with main because it has an associative section
- - Name: icf4
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: .assoc
+ 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: 8
+ Length: 14
NumberOfRelocations: 0
NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 1
- Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ 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
+...
Removed: lld/trunk/test/COFF/icf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf.test?rev=245825&view=auto
==============================================================================
--- lld/trunk/test/COFF/icf.test (original)
+++ lld/trunk/test/COFF/icf.test (removed)
@@ -1,17 +0,0 @@
-# RUN: yaml2obj < %p/Inputs/icf1.yaml > %t1.obj
-# RUN: yaml2obj < %p/Inputs/icf2.yaml > %t2.obj
-# RUN: yaml2obj < %p/Inputs/icf3.yaml > %t3.obj
-# RUN: yaml2obj < %p/Inputs/icf4.yaml > %t4.obj
-# RUN: yaml2obj < %p/Inputs/icf5.yaml > %t5.obj
-#
-# RUN: lld-link /out:%t.exe /entry:main \
-# RUN: %t1.obj %t2.obj %t3.obj %t4.obj %t5.obj \
-# RUN: /opt:lldicf /include:icf2 /include:icf3 /include:icf4 /include:icf5 \
-# RUN: /verbose >& %t.log
-# RUN: FileCheck %s < %t.log
-
-CHECK-NOT: Replaced main
-CHECK: Replaced icf2
-CHECK-NOT: Replaced icf3
-CHECK-NOT: Replaced icf4
-CHECK-NOT: Replaced icf5
More information about the llvm-commits
mailing list