Home | History | Annotate | Download | only in ELF
      1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -t -r --expand-relocs | FileCheck %s
      2 
      3 .section foo, "aG", @progbits, f1, comdat
      4 .section foo, "G", @progbits, f2, comdat
      5 .section bar
      6 .long foo
      7 
      8 // Test that the relocation points to the first section foo.
      9 
     10 // The first seciton foo has index 6
     11 // CHECK:      Section {
     12 // CHECK:        Index:   4
     13 // CHECK-NEXT:   Name:    foo
     14 // CHECK-NEXT:   Type:    SHT_PROGBITS (0x1)
     15 // CHECK-NEXT:   Flags [ (0x202)
     16 // CHECK-NEXT:     SHF_ALLOC (0x2)
     17 // CHECK-NEXT:     SHF_GROUP (0x200)
     18 // CHECK-NEXT:   ]
     19 // CHECK-NEXT:   Address:         0x0
     20 // CHECK-NEXT:   Offset:
     21 // CHECK-NEXT:   Size:    0
     22 // CHECK-NEXT:   Link:    0
     23 // CHECK-NEXT:   Info:    0
     24 // CHECK-NEXT:   AddressAlignment:        1
     25 // CHECK-NEXT:   EntrySize:       0
     26 // CHECK-NEXT: }
     27 // CHECK:      Section {
     28 // CHECK:        Index:   6
     29 // CHECK-NEXT:   Name:    foo
     30 // CHECK-NEXT:   Type:    SHT_PROGBITS (0x1)
     31 // CHECK-NEXT:   Flags [ (0x200)
     32 // CHECK-NEXT:     SHF_GROUP (0x200)
     33 // CHECK-NEXT:   ]
     34 // CHECK-NEXT:   Address:         0x0
     35 // CHECK-NEXT:   Offset:
     36 // CHECK-NEXT:   Size:    0
     37 // CHECK-NEXT:   Link:    0
     38 // CHECK-NEXT:   Info:    0
     39 // CHECK-NEXT:   AddressAlignment:        1
     40 // CHECK-NEXT:   EntrySize:       0
     41 // CHECK-NEXT: }
     42 
     43 // The relocation points to symbol 3
     44 // CHECK:      Relocations [
     45 // CHECK-NEXT:   Section ({{.*}}) .relabar {
     46 // CHECK-NEXT:     Relocation {
     47 // CHECK-NEXT:       Offset:  0x0
     48 // CHECK-NEXT:       Type:    R_X86_64_32 (10)
     49 // CHECK-NEXT:       Symbol:  foo (3)
     50 // CHECK-NEXT:       Addend:  0x0
     51 // CHECK-NEXT:     }
     52 // CHECK-NEXT:   }
     53 // CHECK-NEXT: ]
     54 
     55 // Symbol 3 is section 6
     56 // CHECK: Symbols [
     57 // CHECK-NEXT:  Symbol {
     58 // CHECK-NEXT:    Name:  (0)
     59 // CHECK-NEXT:    Value: 0x0
     60 // CHECK-NEXT:    Size: 0
     61 // CHECK-NEXT:    Binding: Local (0x0)
     62 // CHECK-NEXT:    Type: None (0x0)
     63 // CHECK-NEXT:    Other: 0
     64 // CHECK-NEXT:    Section: Undefined (0x0)
     65 // CHECK-NEXT:  }
     66 // CHECK-NEXT:  Symbol {
     67 // CHECK-NEXT:    Name: f1
     68 // CHECK-NEXT:    Value: 0x0
     69 // CHECK-NEXT:    Size: 0
     70 // CHECK-NEXT:    Binding: Local (0x0)
     71 // CHECK-NEXT:    Type: None (0x0)
     72 // CHECK-NEXT:    Other: 0
     73 // CHECK-NEXT:    Section: .group
     74 // CHECK-NEXT:  }
     75 // CHECK-NEXT:  Symbol {
     76 // CHECK-NEXT:    Name: f2
     77 // CHECK-NEXT:    Value: 0x0
     78 // CHECK-NEXT:    Size: 0
     79 // CHECK-NEXT:    Binding: Local (0x0)
     80 // CHECK-NEXT:    Type: None (0x0)
     81 // CHECK-NEXT:    Other: 0
     82 // CHECK-NEXT:    Section: .group
     83 // CHECK-NEXT:  }
     84 // CHECK-NEXT:  Symbol {
     85 // CHECK-NEXT:    Name:  (0)
     86 // CHECK-NEXT:    Value: 0x0
     87 // CHECK-NEXT:    Size: 0
     88 // CHECK-NEXT:    Binding: Local (0x0)
     89 // CHECK-NEXT:    Type: Section (0x3)
     90 // CHECK-NEXT:    Other: 0
     91 // CHECK-NEXT:    Section: foo (0x4)
     92 // CHECK-NEXT:  }
     93 // CHECK-NEXT: ]
     94