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 
      4 	.text
      5 
      6 // Test that this produces a regular local symbol.
      7 	.type	common1,@object
      8 	.local	common1
      9 	.comm	common1,1,1
     10 
     11 // CHECK:        Symbol {
     12 // CHECK:          Name: common1 (1)
     13 // CHECK-NEXT:     Value: 0x0
     14 // CHECK-NEXT:     Size: 1
     15 // CHECK-NEXT:     Binding: Local
     16 // CHECK-NEXT:     Type: Object
     17 // CHECK-NEXT:     Other: 0
     18 // CHECK-NEXT:     Section:
     19 // CHECK-NEXT:   }
     20 
     21 
     22 // Same as common1, but with directives in a different order.
     23 	.local	common2
     24 	.type	common2,@object
     25 	.comm	common2,1,1
     26 
     27 // CHECK:        Symbol {
     28 // CHECK:          Name: common2 (9)
     29 // CHECK-NEXT:     Value: 0x1
     30 // CHECK-NEXT:     Size: 1
     31 // CHECK-NEXT:     Binding: Local
     32 // CHECK-NEXT:     Type: Object
     33 // CHECK-NEXT:     Other: 0
     34 // CHECK-NEXT:     Section:
     35 // CHECK-NEXT:   }
     36 
     37 
     38         .local	common6
     39         .comm	common6,8,16
     40 
     41 // CHECK:        Symbol {
     42 // CHECK:          Name: common6 (17)
     43 // CHECK-NEXT:     Value: 0x10
     44 // CHECK-NEXT:     Size: 8
     45 // CHECK-NEXT:     Binding: Local
     46 // CHECK-NEXT:     Type: Object
     47 // CHECK-NEXT:     Other: 0
     48 // CHECK-NEXT:     Section: .bss (0x4)
     49 // CHECK-NEXT:   }
     50 
     51 
     52 // Test that without an explicit .local we produce a global.
     53 	.type	common3,@object
     54 	.comm	common3,4,4
     55 
     56 // CHECK:        Symbol {
     57 // CHECK:          Name: common3 (25)
     58 // CHECK-NEXT:     Value: 0x4
     59 // CHECK-NEXT:     Size: 4
     60 // CHECK-NEXT:     Binding: Global
     61 // CHECK-NEXT:     Type: Object
     62 // CHECK-NEXT:     Other: 0
     63 // CHECK-NEXT:     Section: (0xFFF2)
     64 // CHECK-NEXT:   }
     65 
     66 
     67 // Test that without an explicit .local we produce a global, even if the first
     68 // occurrence is not in a directive.
     69 	.globl	foo
     70 	.type	foo,@function
     71 foo:
     72 	movsbl	common4+3(%rip), %eax
     73 
     74 
     75 	.type	common4,@object
     76 	.comm	common4,40,16
     77 
     78 // CHECK:        Symbol {
     79 // CHECK:          Name: common4 (37)
     80 // CHECK-NEXT:     Value: 0x10
     81 // CHECK-NEXT:     Size: 40
     82 // CHECK-NEXT:     Binding: Global
     83 // CHECK-NEXT:     Type: Object
     84 // CHECK-NEXT:     Other: 0
     85 // CHECK-NEXT:     Section: (0xFFF2)
     86 // CHECK-NEXT:   }
     87 
     88 
     89         .comm	common5,4,4
     90 
     91 // CHECK:        Symbol {
     92 // CHECK:          Name: common5 (45)
     93 // CHECK-NEXT:     Value: 0x4
     94 // CHECK-NEXT:     Size: 4
     95 // CHECK-NEXT:     Binding: Global
     96 // CHECK-NEXT:     Type: Object
     97 // CHECK-NEXT:     Other: 0
     98 // CHECK-NEXT:     Section: (0xFFF2)
     99 // CHECK-NEXT:   }
    100