Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / COFF / associative-comdat-order.test
blobc7756f348e0ebad922ed4e820bfc062fbda568f2
1 # Tests that an associative comdat being associated with another
2 # associated comdat later in the file produces an error.
3 # RUN: sed -e s/ASSOC1/2/ -e s/ASSOC2/3/ %s | yaml2obj > %t.obj
4 # RUN: not lld-link /include:symbol /dll /noentry /nodefaultlib %t.obj /out:%t.exe 2>&1 | FileCheck --check-prefix=FORWARD %s
5 # FORWARD: lld-link: error: {{.*}}: associative comdat .text$ac1 (sec 1) has invalid reference to section .text$ac2 (sec 2)
6 # FORWARD-NOT: lld-link: error:
8 # Tests that an associative comdat being associated with another
9 # associated comdat earlier in the file works.
10 # RUN: sed -e s/ASSOC1/3/ -e s/ASSOC2/1/ %s | yaml2obj > %t.obj
12 # RUN: lld-link /include:symbol /dll /noentry /nodefaultlib %t.obj /out:%t.exe
13 # RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=BACKWARD %s
14 # BACKWARD: Contents of section .text:
15 # BACKWARD:   180001000 01000000 02000000 03000000 ............
17 # RUN: lld-link /dll /noentry /nodefaultlib %t.obj /out:%t.exe
18 # RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=BACKWARDDROP %s
19 # BACKWARDDROP-NOT: Contents of section .text:
21 --- !COFF
22 header:          
23   Machine:         IMAGE_FILE_MACHINE_AMD64
24   Characteristics: [  ]
25 sections:        
26   - Name:            '.text$ac1'
27     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
28     Alignment:       1
29     SectionData:     '01000000'
30   - Name:            '.text$ac2'
31     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
32     Alignment:       1
33     SectionData:     '02000000'
34   - Name:            '.text$nm'
35     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
36     Alignment:       1
37     SectionData:     '03000000'
38 symbols:         
39   - Name:            '.text$ac1'
40     Value:           0
41     SectionNumber:   1
42     SimpleType:      IMAGE_SYM_TYPE_NULL
43     ComplexType:     IMAGE_SYM_DTYPE_NULL
44     StorageClass:    IMAGE_SYM_CLASS_STATIC
45     SectionDefinition: 
46       Length:          4
47       NumberOfRelocations: 0
48       NumberOfLinenumbers: 0
49       CheckSum:        3099354981
50       Number:          ASSOC1
51       Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
52   - Name:            '.text$ac2'
53     Value:           0
54     SectionNumber:   2
55     SimpleType:      IMAGE_SYM_TYPE_NULL
56     ComplexType:     IMAGE_SYM_DTYPE_NULL
57     StorageClass:    IMAGE_SYM_CLASS_STATIC
58     SectionDefinition: 
59       Length:          4
60       NumberOfRelocations: 0
61       NumberOfLinenumbers: 0
62       CheckSum:        3099354981
63       Number:          ASSOC2
64       Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
65   - Name:            '.text$nm'
66     Value:           0
67     SectionNumber:   3
68     SimpleType:      IMAGE_SYM_TYPE_NULL
69     ComplexType:     IMAGE_SYM_DTYPE_NULL
70     StorageClass:    IMAGE_SYM_CLASS_STATIC
71     SectionDefinition: 
72       Length:          4
73       NumberOfRelocations: 0
74       NumberOfLinenumbers: 0
75       CheckSum:        3099354981
76       Number:          4
77       Selection:       IMAGE_COMDAT_SELECT_ANY
78   - Name:            symbol
79     Value:           0
80     SectionNumber:   3
81     SimpleType:      IMAGE_SYM_TYPE_NULL
82     ComplexType:     IMAGE_SYM_DTYPE_NULL
83     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
84   - Name:            assocsym2
85     Value:           0
86     SectionNumber:   1
87     SimpleType:      IMAGE_SYM_TYPE_NULL
88     ComplexType:     IMAGE_SYM_DTYPE_NULL
89     StorageClass:    IMAGE_SYM_CLASS_STATIC
90   - Name:            assocsym
91     Value:           0
92     SectionNumber:   2
93     SimpleType:      IMAGE_SYM_TYPE_NULL
94     ComplexType:     IMAGE_SYM_DTYPE_NULL
95     StorageClass:    IMAGE_SYM_CLASS_STATIC
96 ...