Home | History | Annotate | Download | only in ELF
      1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -t | FileCheck %s
      2 
      3 // When doing a rename, all the checks for where the relocation should go
      4 // should be performed with the original symbol. Only if we decide to relocate
      5 // with the symbol we should then use the renamed one.
      6 
      7 // This is a regression test for a bug where we used bar5@@@zed when deciding
      8 // if we should relocate with the symbol or with the section and we would then
      9 // not produce a relocation with .text.
     10 
     11 defined1:
     12 defined3:
     13         .symver defined3, bar5@@@zed
     14         .long defined3
     15 
     16         .global defined1
     17 
     18 // Section 1 is .text
     19 // CHECK:        Section {
     20 // CHECK:          Index: 1
     21 // CHECK-NEXT:     Name: .text
     22 // CHECK-NEXT:     Type: SHT_PROGBITS
     23 // CHECK-NEXT:     Flags [
     24 // CHECK-NEXT:       SHF_ALLOC
     25 // CHECK-NEXT:       SHF_EXECINSTR
     26 // CHECK-NEXT:     ]
     27 // CHECK-NEXT:     Address: 0x0
     28 // CHECK-NEXT:     Offset: 0x40
     29 // CHECK-NEXT:     Size: 4
     30 // CHECK-NEXT:     Link: 0
     31 // CHECK-NEXT:     Info: 0
     32 // CHECK-NEXT:     AddressAlignment: 4
     33 // CHECK-NEXT:     EntrySize: 0
     34 // CHECK-NEXT:     Relocations [
     35 // CHECK-NEXT:     ]
     36 // CHECK-NEXT:   }
     37 // CHECK-NEXT:   Section {
     38 // CHECK-NEXT:     Index: 2
     39 // CHECK-NEXT:     Name: .rela.text (1)
     40 // CHECK-NEXT:     Type: SHT_RELA (0x4)
     41 // CHECK-NEXT:     Flags [ (0x0)
     42 // CHECK-NEXT:     ]
     43 // CHECK-NEXT:     Address: 0x0
     44 // CHECK-NEXT:     Offset: 0x320
     45 // CHECK-NEXT:     Size: 24
     46 // CHECK-NEXT:     Link: 6
     47 // CHECK-NEXT:     Info: 1
     48 // CHECK-NEXT:     AddressAlignment: 8
     49 // CHECK-NEXT:     EntrySize: 24
     50 // CHECK-NEXT:     Relocations [
     51 // CHECK-NEXT:       0x0 R_X86_64_32 .text 0x0
     52 // CHECK-NEXT:     ]
     53 // CHECK-NEXT:   }
     54 
     55 
     56 // Symbol 2 is section 1
     57 // CHECK:        Symbol {
     58 // CHECK:          Name: .text (0)
     59 // CHECK-NEXT:     Value: 0x0
     60 // CHECK-NEXT:     Size: 0
     61 // CHECK-NEXT:     Binding: Local
     62 // CHECK-NEXT:     Type: Section
     63 // CHECK-NEXT:     Other: 0
     64 // CHECK-NEXT:     Section: .text (0x1)
     65 // CHECK-NEXT:   }
     66