xref: /llvm-project/lld/test/ELF/comdat-binding2.s (revision 0051b6bb78772b0658f28e5f31ddf91c1589aab5)
1# REQUIRES: x86
2## Test we don't report duplicate definition errors when mixing Clang STB_WEAK
3## and GCC STB_GNU_UNIQUE symbols.
4
5# RUN: rm -rf %t && split-file %s %t && cd %t
6# RUN: llvm-mc -filetype=obj -triple=x86_64 weak.s -o weak.o
7# RUN: llvm-mc -filetype=obj -triple=x86_64 unique.s -o unique.o
8# RUN: ld.lld weak.o unique.o -o weak
9# RUN: llvm-readelf -s weak | FileCheck %s --check-prefix=WEAK
10# RUN: ld.lld unique.o weak.o -o unique
11# RUN: llvm-readelf -s unique | FileCheck %s --check-prefix=UNIQUE
12
13# WEAK:   OBJECT  WEAK   DEFAULT [[#]] _ZN1BIiE1aE
14# UNIQUE: OBJECT  UNIQUE DEFAULT [[#]] _ZN1BIiE1aE
15
16#--- weak.s
17## Clang
18	.type	_ZN1BIiE1aE,@object
19	.section	.bss._ZN1BIiE1aE,"aGwR",@nobits,_ZN1BIiE1aE,comdat
20	.weak	_ZN1BIiE1aE
21_ZN1BIiE1aE:
22	.zero	4
23
24	.type	_ZGVN1BIiE1aE,@object
25	.section	.bss._ZGVN1BIiE1aE,"aGw",@nobits,_ZN1BIiE1aE,comdat
26	.weak	_ZGVN1BIiE1aE
27_ZGVN1BIiE1aE:
28	.quad	0
29
30#--- unique.s
31## GCC -fgnu-unique. Note the different group signature for the second group.
32	.weak	_ZN1BIiE1aE
33	.section	.bss._ZN1BIiE1aE,"awG",@nobits,_ZN1BIiE1aE,comdat
34	.type	_ZN1BIiE1aE, @gnu_unique_object
35_ZN1BIiE1aE:
36	.zero	4
37
38	.weak	_ZGVN1BIiE1aE
39	.section	.bss._ZGVN1BIiE1aE,"awG",@nobits,_ZGVN1BIiE1aE,comdat
40	.type	_ZGVN1BIiE1aE, @gnu_unique_object
41_ZGVN1BIiE1aE:
42	.zero	8
43