• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# COMDAT sections with non-external linkage should not be merged by ICF.
2
3# RUN: yaml2obj %s -o %t1.obj
4# RUN: sed s/foo/main/ %s | yaml2obj > %t2.obj
5# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /verbose \
6# RUN:   %t1.obj %t2.obj > %t.log 2>&1
7# RUN: FileCheck %s < %t.log
8
9# CHECK-NOT: Removed bar
10
11--- !COFF
12header:
13  Machine:         IMAGE_FILE_MACHINE_AMD64
14  Characteristics: []
15sections:
16  - Name:            .text
17    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
18    Alignment:       16
19    SectionData:     488D0500000000C3
20    Relocations:
21      - VirtualAddress:  3
22        SymbolName:      bar
23        Type:            IMAGE_REL_AMD64_REL32
24  - Name:            .rdata
25    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
26    Alignment:       8
27    SectionData:     2A000000000000002B00000000000000
28symbols:
29  - Name:            .text
30    Value:           0
31    SectionNumber:   1
32    SimpleType:      IMAGE_SYM_TYPE_NULL
33    ComplexType:     IMAGE_SYM_DTYPE_NULL
34    StorageClass:    IMAGE_SYM_CLASS_STATIC
35    SectionDefinition:
36      Length:          8
37      NumberOfRelocations: 1
38      NumberOfLinenumbers: 0
39      CheckSum:        1092178131
40      Number:          1
41  - Name:            .rdata
42    Value:           0
43    SectionNumber:   2
44    SimpleType:      IMAGE_SYM_TYPE_NULL
45    ComplexType:     IMAGE_SYM_DTYPE_NULL
46    StorageClass:    IMAGE_SYM_CLASS_STATIC
47    SectionDefinition:
48      Length:          16
49      NumberOfRelocations: 0
50      NumberOfLinenumbers: 0
51      CheckSum:        1200668497
52      Number:          5
53      Selection:       IMAGE_COMDAT_SELECT_ANY
54  - Name:            foo
55    Value:           0
56    SectionNumber:   1
57    SimpleType:      IMAGE_SYM_TYPE_NULL
58    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
59    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
60  - Name:            bar
61    Value:           0
62    SectionNumber:   2
63    SimpleType:      IMAGE_SYM_TYPE_NULL
64    ComplexType:     IMAGE_SYM_DTYPE_NULL
65    StorageClass:    IMAGE_SYM_CLASS_STATIC
66...
67