2 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-pc-linux
%s
-o
%t
3 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-pc-linux
%p
/Inputs
/resolution.s
-o
%t2
4 // RUN
: ld.lld
-discard-all
%t %t2
-o
%t3
5 // RUN
: llvm-readelf
--symbols
%t3 | FileCheck
%s
7 // This is an exhaustive test for checking which symbol is kept when two
8 // have the same name. Each symbol has
a different size which is used
9 // to see which one was chosen.
11 // CHECK
: Symbol table
'.symtab' contains
23 entries
:
12 // CHECK-NEXT
: Size Type Bind Vis Ndx Name
13 // CHECK-NEXT
: 0 NOTYPE LOCAL DEFAULT UND
14 // CHECK-NEXT
: 0 NOTYPE GLOBAL DEFAULT
1 _start
15 // CHECK-NEXT
: 0 NOTYPE WEAK DEFAULT
1 RegularWeak_with_RegularWeak
16 // CHECK-NEXT
: 33 NOTYPE GLOBAL DEFAULT
1 RegularWeak_with_RegularStrong
17 // CHECK-NEXT
: 2 NOTYPE GLOBAL DEFAULT
1 RegularStrong_with_RegularWeak
18 // CHECK-NEXT
: 3 NOTYPE WEAK DEFAULT
1 RegularWeak_with_UndefWeak
19 // CHECK-NEXT
: 4 NOTYPE WEAK DEFAULT
1 RegularWeak_with_UndefStrong
20 // CHECK-NEXT
: 5 NOTYPE GLOBAL DEFAULT
1 RegularStrong_with_UndefWeak
21 // CHECK-NEXT
: 6 NOTYPE GLOBAL DEFAULT
1 RegularStrong_with_UndefStrong
22 // CHECK-NEXT
: 40 OBJECT GLOBAL DEFAULT
2 RegularWeak_with_CommonStrong
23 // CHECK-NEXT
: 10 NOTYPE GLOBAL DEFAULT
1 RegularStrong_with_CommonStrong
24 // CHECK-NEXT
: 43 NOTYPE WEAK DEFAULT
1 UndefWeak_with_RegularWeak
25 // CHECK-NEXT
: 44 NOTYPE GLOBAL DEFAULT
1 UndefWeak_with_RegularStrong
26 // CHECK-NEXT
: 45 NOTYPE WEAK DEFAULT
1 UndefStrong_with_RegularWeak
27 // CHECK-NEXT
: 46 NOTYPE GLOBAL DEFAULT
1 UndefStrong_with_RegularStrong
28 // CHECK-NEXT
: 0 NOTYPE WEAK DEFAULT UND UndefWeak_with_UndefWeak
29 // CHECK-NEXT
: 49 OBJECT GLOBAL DEFAULT
2 UndefWeak_with_CommonStrong
30 // CHECK-NEXT
: 51 OBJECT GLOBAL DEFAULT
2 UndefStrong_with_CommonStrong
31 // CHECK-NEXT
: 22 OBJECT GLOBAL DEFAULT
2 CommonStrong_with_RegularWeak
32 // CHECK-NEXT
: 55 NOTYPE GLOBAL DEFAULT
1 CommonStrong_with_RegularStrong
33 // CHECK-NEXT
: 26 OBJECT GLOBAL DEFAULT
2 CommonStrong_with_UndefWeak
34 // CHECK-NEXT
: 27 OBJECT GLOBAL DEFAULT
2 CommonStrong_with_UndefStrong
35 // CHECK-NEXT
: 63 OBJECT GLOBAL DEFAULT
2 CommonStrong_with_CommonStrong
43 .weak RegularWeak_with_RegularWeak
44 .size RegularWeak_with_RegularWeak, 0
45 RegularWeak_with_RegularWeak
:
47 .weak RegularWeak_with_RegularStrong
48 .size RegularWeak_with_RegularStrong, 1
49 RegularWeak_with_RegularStrong
:
51 .global RegularStrong_with_RegularWeak
52 .size RegularStrong_with_RegularWeak, 2
53 RegularStrong_with_RegularWeak
:
55 .weak RegularWeak_with_UndefWeak
56 .size RegularWeak_with_UndefWeak, 3
57 RegularWeak_with_UndefWeak
:
59 .weak RegularWeak_with_UndefStrong
60 .size RegularWeak_with_UndefStrong, 4
61 RegularWeak_with_UndefStrong
:
63 .global RegularStrong_with_UndefWeak
64 .size RegularStrong_with_UndefWeak, 5
65 RegularStrong_with_UndefWeak
:
67 .global RegularStrong_with_UndefStrong
68 .size RegularStrong_with_UndefStrong, 6
69 RegularStrong_with_UndefStrong
:
71 .weak RegularWeak_with_CommonStrong
72 .size RegularWeak_with_CommonStrong, 8
73 RegularWeak_with_CommonStrong
:
75 .global RegularStrong_with_CommonStrong
76 .size RegularStrong_with_CommonStrong, 10
77 RegularStrong_with_CommonStrong
:
79 .weak UndefWeak_with_RegularWeak
80 .size UndefWeak_with_RegularWeak, 11
81 .quad UndefWeak_with_RegularWeak
83 .weak UndefWeak_with_RegularStrong
84 .size UndefWeak_with_RegularStrong, 12
85 .quad UndefWeak_with_RegularStrong
87 .size UndefStrong_with_RegularWeak, 13
88 .quad UndefStrong_with_RegularWeak
90 .size UndefStrong_with_RegularStrong, 14
91 .quad UndefStrong_with_RegularStrong
93 .weak UndefWeak_with_UndefWeak
94 .size UndefWeak_with_UndefWeak, 15
95 .quad UndefWeak_with_UndefWeak
97 .weak UndefWeak_with_CommonStrong
98 .size UndefWeak_with_CommonStrong, 17
99 .quad UndefWeak_with_CommonStrong
101 .size UndefStrong_with_CommonStrong, 19
102 .quad UndefStrong_with_CommonStrong
104 .comm CommonStrong_with_RegularWeak,22,4
106 .comm CommonStrong_with_RegularStrong,23,4
108 .comm CommonStrong_with_UndefWeak,26,4
110 .comm CommonStrong_with_UndefStrong,27,4
112 .comm CommonStrong_with_CommonStrong,31,4