Home | History | Annotate | Download | only in ELF
      1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t | 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         .weakref foo1, bar1
      9 
     10         .weakref foo2, bar2
     11         .long bar2
     12 
     13         .weakref foo3, bar3
     14         .long foo3
     15 
     16         .weakref foo4, bar4
     17         .long foo4
     18         .long bar4
     19 
     20         .weakref foo5, bar5
     21         .long bar5
     22         .long foo5
     23 
     24 bar6:
     25         .weakref foo6, bar6
     26 
     27 bar7:
     28         .weakref foo7, bar7
     29         .long bar7
     30 
     31 bar8:
     32         .weakref foo8, bar8
     33         .long foo8
     34 
     35 bar9:
     36         .weakref foo9, bar9
     37         .long foo9
     38         .long bar9
     39 
     40 bar10:
     41         .global bar10
     42         .weakref foo10, bar10
     43         .long bar10
     44         .long foo10
     45 
     46 bar11:
     47         .global bar11
     48         .weakref foo11, bar11
     49 
     50 bar12:
     51         .global bar12
     52         .weakref foo12, bar12
     53         .long bar12
     54 
     55 bar13:
     56         .global bar13
     57         .weakref foo13, bar13
     58         .long foo13
     59 
     60 bar14:
     61         .global bar14
     62         .weakref foo14, bar14
     63         .long foo14
     64         .long bar14
     65 
     66 bar15:
     67         .global bar15
     68         .weakref foo15, bar15
     69         .long bar15
     70         .long foo15
     71 
     72 // CHECK:      Symbols [
     73 // CHECK-NEXT:   Symbol {
     74 // CHECK-NEXT:     Name:  (0)
     75 // CHECK-NEXT:     Value: 0x0
     76 // CHECK-NEXT:     Size: 0
     77 // CHECK-NEXT:     Binding: Local (0x0)
     78 // CHECK-NEXT:     Type: None (0x0)
     79 // CHECK-NEXT:     Other: 0
     80 // CHECK-NEXT:     Section: Undefined (0x0)
     81 // CHECK-NEXT:   }
     82 // CHECK-NEXT:   Symbol {
     83 // CHECK-NEXT:     Name: bar6
     84 // CHECK-NEXT:     Value: 0x18
     85 // CHECK-NEXT:     Size: 0
     86 // CHECK-NEXT:     Binding: Local
     87 // CHECK-NEXT:     Type: None
     88 // CHECK-NEXT:     Other: 0
     89 // CHECK-NEXT:     Section: .text (0x1)
     90 // CHECK-NEXT:   }
     91 // CHECK-NEXT:   Symbol {
     92 // CHECK-NEXT:     Name: bar7
     93 // CHECK-NEXT:     Value: 0x18
     94 // CHECK-NEXT:     Size: 0
     95 // CHECK-NEXT:     Binding: Local
     96 // CHECK-NEXT:     Type: None
     97 // CHECK-NEXT:     Other: 0
     98 // CHECK-NEXT:     Section: .text (0x1)
     99 // CHECK-NEXT:   }
    100 // CHECK-NEXT:   Symbol {
    101 // CHECK-NEXT:     Name: bar8
    102 // CHECK-NEXT:     Value: 0x1C
    103 // CHECK-NEXT:     Size: 0
    104 // CHECK-NEXT:     Binding: Local
    105 // CHECK-NEXT:     Type: None
    106 // CHECK-NEXT:     Other: 0
    107 // CHECK-NEXT:     Section: .text (0x1)
    108 // CHECK-NEXT:   }
    109 // CHECK-NEXT:   Symbol {
    110 // CHECK-NEXT:     Name: bar9
    111 // CHECK-NEXT:     Value: 0x20
    112 // CHECK-NEXT:     Size: 0
    113 // CHECK-NEXT:     Binding: Local
    114 // CHECK-NEXT:     Type: None
    115 // CHECK-NEXT:     Other: 0
    116 // CHECK-NEXT:     Section: .text (0x1)
    117 // CHECK-NEXT:   }
    118 // CHECK-NEXT:   Symbol {
    119 // CHECK-NEXT:     Name: .text
    120 // CHECK-NEXT:     Value: 0x0
    121 // CHECK-NEXT:     Size: 0
    122 // CHECK-NEXT:     Binding: Local
    123 // CHECK-NEXT:     Type: Section
    124 // CHECK-NEXT:     Other: 0
    125 // CHECK-NEXT:     Section: .text (0x1)
    126 // CHECK-NEXT:   }
    127 // CHECK-NEXT:   Symbol {
    128 // CHECK-NEXT:     Name: .data
    129 // CHECK-NEXT:     Value: 0x0
    130 // CHECK-NEXT:     Size: 0
    131 // CHECK-NEXT:     Binding: Local
    132 // CHECK-NEXT:     Type: Section
    133 // CHECK-NEXT:     Other: 0
    134 // CHECK-NEXT:     Section: .data (0x3)
    135 // CHECK-NEXT:   }
    136 // CHECK-NEXT:   Symbol {
    137 // CHECK-NEXT:     Name: .bss
    138 // CHECK-NEXT:     Value: 0x0
    139 // CHECK-NEXT:     Size: 0
    140 // CHECK-NEXT:     Binding: Local
    141 // CHECK-NEXT:     Type: Section
    142 // CHECK-NEXT:     Other: 0
    143 // CHECK-NEXT:     Section: .bss (0x4)
    144 // CHECK-NEXT:   }
    145 // CHECK-NEXT:   Symbol {
    146 // CHECK-NEXT:     Name: bar10
    147 // CHECK-NEXT:     Value: 0x28
    148 // CHECK-NEXT:     Size: 0
    149 // CHECK-NEXT:     Binding: Global
    150 // CHECK-NEXT:     Type: None
    151 // CHECK-NEXT:     Other: 0
    152 // CHECK-NEXT:     Section: .text (0x1)
    153 // CHECK-NEXT:   }
    154 // CHECK-NEXT:   Symbol {
    155 // CHECK-NEXT:     Name: bar11
    156 // CHECK-NEXT:     Value: 0x30
    157 // CHECK-NEXT:     Size: 0
    158 // CHECK-NEXT:     Binding: Global
    159 // CHECK-NEXT:     Type: None
    160 // CHECK-NEXT:     Other: 0
    161 // CHECK-NEXT:     Section: .text (0x1)
    162 // CHECK-NEXT:   }
    163 // CHECK-NEXT:   Symbol {
    164 // CHECK-NEXT:     Name: bar12
    165 // CHECK-NEXT:     Value: 0x30
    166 // CHECK-NEXT:     Size: 0
    167 // CHECK-NEXT:     Binding: Global
    168 // CHECK-NEXT:     Type: None
    169 // CHECK-NEXT:     Other: 0
    170 // CHECK-NEXT:     Section: .text (0x1)
    171 // CHECK-NEXT:   }
    172 // CHECK-NEXT:   Symbol {
    173 // CHECK-NEXT:     Name: bar13
    174 // CHECK-NEXT:     Value: 0x34
    175 // CHECK-NEXT:     Size: 0
    176 // CHECK-NEXT:     Binding: Global
    177 // CHECK-NEXT:     Type: None
    178 // CHECK-NEXT:     Other: 0
    179 // CHECK-NEXT:     Section: .text (0x1)
    180 // CHECK-NEXT:   }
    181 // CHECK-NEXT:   Symbol {
    182 // CHECK-NEXT:     Name: bar14
    183 // CHECK-NEXT:     Value: 0x38
    184 // CHECK-NEXT:     Size: 0
    185 // CHECK-NEXT:     Binding: Global
    186 // CHECK-NEXT:     Type: None
    187 // CHECK-NEXT:     Other: 0
    188 // CHECK-NEXT:     Section: .text (0x1)
    189 // CHECK-NEXT:   }
    190 // CHECK-NEXT:   Symbol {
    191 // CHECK-NEXT:     Name: bar15
    192 // CHECK-NEXT:     Value: 0x40
    193 // CHECK-NEXT:     Size: 0
    194 // CHECK-NEXT:     Binding: Global
    195 // CHECK-NEXT:     Type: None
    196 // CHECK-NEXT:     Other: 0
    197 // CHECK-NEXT:     Section: .text (0x1)
    198 // CHECK-NEXT:   }
    199 // CHECK-NEXT:   Symbol {
    200 // CHECK-NEXT:     Name: bar2
    201 // CHECK-NEXT:     Value: 0x0
    202 // CHECK-NEXT:     Size: 0
    203 // CHECK-NEXT:     Binding: Global
    204 // CHECK-NEXT:     Type: None
    205 // CHECK-NEXT:     Other: 0
    206 // CHECK-NEXT:     Section: Undefined (0x0)
    207 // CHECK-NEXT:   }
    208 // CHECK-NEXT:   Symbol {
    209 // CHECK-NEXT:     Name: bar3
    210 // CHECK-NEXT:     Value: 0x0
    211 // CHECK-NEXT:     Size: 0
    212 // CHECK-NEXT:     Binding: Weak
    213 // CHECK-NEXT:     Type: None
    214 // CHECK-NEXT:     Other: 0
    215 // CHECK-NEXT:     Section: Undefined (0x0)
    216 // CHECK-NEXT:   }
    217 // CHECK-NEXT:   Symbol {
    218 // CHECK-NEXT:     Name: bar4
    219 // CHECK-NEXT:     Value: 0x0
    220 // CHECK-NEXT:     Size: 0
    221 // CHECK-NEXT:     Binding: Global
    222 // CHECK-NEXT:     Type: None
    223 // CHECK-NEXT:     Other: 0
    224 // CHECK-NEXT:     Section: Undefined (0x0)
    225 // CHECK-NEXT:   }
    226 // CHECK-NEXT:   Symbol {
    227 // CHECK-NEXT:     Name: bar5
    228 // CHECK-NEXT:     Value: 0x0
    229 // CHECK-NEXT:     Size: 0
    230 // CHECK-NEXT:     Binding: Global
    231 // CHECK-NEXT:     Type: None
    232 // CHECK-NEXT:     Other: 0
    233 // CHECK-NEXT:     Section: Undefined (0x0)
    234 // CHECK-NEXT:   }
    235 // CHECK-NEXT: ]
    236