xref: /llvm-project/lld/test/ELF/comdat-local-signature.s (revision 928a197d26ffd035bc4279ba533f169190a03574)
1# REQUIRES: x86
2## COMDAT groups are deduplicated by the name of the signature symbol.
3## The local/global status is not part of the equation.
4
5# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
6# RUN: ld.lld %t.o %t.o -o %t
7# RUN: llvm-readelf -s -x .zero -x .comdat %t | FileCheck %s
8
9# CHECK:      Type   Bind  Vis     Ndx     Name
10# CHECK-NEXT: NOTYPE LOCAL DEFAULT UND
11# CHECK-NEXT: NOTYPE LOCAL DEFAULT [[#A:]] zero
12# CHECK-NEXT: NOTYPE LOCAL DEFAULT [[#]]   comdat
13# CHECK-NEXT: NOTYPE LOCAL DEFAULT [[#A]]  zero
14# CHECK-NOT:  {{.}}
15
16## Non-GRP_COMDAT groups are never deduplicated.
17# CHECK:      Hex dump of section '.zero':
18# CHECK-NEXT: [[#%x,]] 0202
19
20## GRP_COMDAT groups are deduplicated.
21# CHECK:      Hex dump of section '.comdat':
22# CHECK-NEXT: [[#%x,]] 01 .{{$}}
23
24.section .zero,"aG",@progbits,zero
25zero:
26  .byte 2
27
28.section .comdat,"aG",@progbits,comdat,comdat
29comdat:
30  .byte 1
31