xref: /llvm-project/llvm/test/MC/ELF/weakref.s (revision 962b29d7162c8b470ea70540c48d11c2f35d7561)
1# RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -s - | FileCheck %s
2
3// This is a long test that checks that the aliases created by weakref are
4// never in the symbol table and that the only case it causes a symbol to
5// be output as a weak undefined symbol is if that variable is not defined
6// in this file and all the references to it are done via the alias.
7
8# CHECK:      Num:    Value          Size Type    Bind   Vis       Ndx Name
9# CHECK-NEXT:   0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT   UND
10# CHECK-NEXT:   1: 0000000000000000     0 SECTION LOCAL  DEFAULT     2 .text
11# CHECK-NEXT:   2: 0000000000000018     0 NOTYPE  LOCAL  DEFAULT     2 bar6
12# CHECK-NEXT:   3: 0000000000000018     0 NOTYPE  LOCAL  DEFAULT     2 bar7
13# CHECK-NEXT:   4: 000000000000001c     0 NOTYPE  LOCAL  DEFAULT     2 bar8
14# CHECK-NEXT:   5: 0000000000000020     0 NOTYPE  LOCAL  DEFAULT     2 bar9
15# CHECK-NEXT:   6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND bar1
16# CHECK-NEXT:   7: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND bar2
17# CHECK-NEXT:   8: 0000000000000000     0 NOTYPE  WEAK   DEFAULT   UND bar3
18# CHECK-NEXT:   9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND bar4
19# CHECK-NEXT:  10: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND bar5
20# CHECK-NEXT:  11: 0000000000000028     0 NOTYPE  GLOBAL DEFAULT     2 bar10
21# CHECK-NEXT:  12: 0000000000000030     0 NOTYPE  GLOBAL DEFAULT     2 bar11
22# CHECK-NEXT:  13: 0000000000000030     0 NOTYPE  GLOBAL DEFAULT     2 bar12
23# CHECK-NEXT:  14: 0000000000000034     0 NOTYPE  GLOBAL DEFAULT     2 bar13
24# CHECK-NEXT:  15: 0000000000000038     0 NOTYPE  GLOBAL DEFAULT     2 bar14
25# CHECK-NEXT:  16: 0000000000000040     0 NOTYPE  GLOBAL DEFAULT     2 bar15
26
27        .weakref foo1, bar1
28
29        .weakref foo2, bar2
30        .long bar2
31
32        .weakref foo3, bar3
33        .long foo3
34
35        .weakref foo4, bar4
36        .long foo4
37        .long bar4
38
39        .weakref foo5, bar5
40        .long bar5
41        .long foo5
42
43bar6:
44        .weakref foo6, bar6
45
46bar7:
47        .weakref foo7, bar7
48        .long bar7
49
50bar8:
51        .weakref foo8, bar8
52        .long foo8
53
54bar9:
55        .weakref foo9, bar9
56        .long foo9
57        .long bar9
58
59bar10:
60        .global bar10
61        .weakref foo10, bar10
62        .long bar10
63        .long foo10
64
65bar11:
66        .global bar11
67        .weakref foo11, bar11
68
69bar12:
70        .global bar12
71        .weakref foo12, bar12
72        .long bar12
73
74bar13:
75        .global bar13
76        .weakref foo13, bar13
77        .long foo13
78
79bar14:
80        .global bar14
81        .weakref foo14, bar14
82        .long foo14
83        .long bar14
84
85bar15:
86        .global bar15
87        .weakref foo15, bar15
88        .long bar15
89        .long foo15
90