Home | History | Annotate | Download | only in ELF
      1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj  -t -r --expand-relocs | FileCheck %s
      2 
      3 // Local symbol overriding section.
      4 .section x1,"a",@progbits
      5 .local  x1
      6 .comm   x1,4,4
      7 .long x1  // reloc: .bss + 0
      8 
      9 // Section declared after local. Local symbol wins.
     10 .local  x2
     11 .comm   x2,4,4
     12 .section x2,"a",@progbits
     13 .long x2  // reloc: .bss + 4
     14 
     15 // No overriding symbol.
     16 .section x3,"a",@progbits
     17 .long x3  // reloc: x3(section) + 0
     18 
     19 // Global vs section.
     20 .section x4,"a",@progbits
     21 .long 0
     22 .globl x4
     23 .section foo, "a", @progbits
     24 x4:
     25 .long 0
     26 .long x4  // reloc: x4(global) + 0
     27 
     28 // Global vs implicit section
     29 .globl .data
     30 .data:
     31 .long 42
     32 .long .data // reloc: .data(global) + 0
     33 
     34 // CHECK: Relocations [
     35 // CHECK:   Section (4) .relax1 {
     36 // CHECK:     Relocation {
     37 // CHECK:       Offset: 0x0
     38 // CHECK:       Type: R_X86_64_32 (10)
     39 // CHECK:       Symbol: .bss (3)
     40 // CHECK:       Addend: 0x0
     41 // CHECK:     }
     42 // CHECK:   }
     43 // CHECK:   Section (7) .relax2 {
     44 // CHECK:     Relocation {
     45 // CHECK:       Offset: 0x0
     46 // CHECK:       Type: R_X86_64_32 (10)
     47 // CHECK:       Symbol: .bss (3)
     48 // CHECK:       Addend: 0x4
     49 // CHECK:     }
     50 // CHECK:   }
     51 // CHECK:   Section (9) .relax3 {
     52 // CHECK:     Relocation {
     53 // CHECK:       Offset: 0x0
     54 // CHECK:       Type: R_X86_64_32 (10)
     55 // CHECK:       Symbol: x3 (4)
     56 // CHECK:       Addend: 0x0
     57 // CHECK:     }
     58 // CHECK:   }
     59 // CHECK:   Section (12) .relafoo {
     60 // CHECK:     Relocation {
     61 // CHECK:       Offset: 0x4
     62 // CHECK:       Type: R_X86_64_32 (10)
     63 // CHECK:       Symbol: x4 (6)
     64 // CHECK:       Addend: 0x0
     65 // CHECK:     }
     66 // CHECK:     Relocation {
     67 // CHECK:       Offset: 0xC
     68 // CHECK:       Type: R_X86_64_32 (10)
     69 // CHECK:       Symbol: .data (5)
     70 // CHECK:       Addend: 0x0
     71 // CHECK:     }
     72 // CHECK:   }
     73 // CHECK: ]
     74 // CHECK: Symbols [
     75 // CHECK:   Symbol {
     76 // CHECK:     Name:  (0)
     77 // CHECK:     Value: 0x0
     78 // CHECK:     Size: 0
     79 // CHECK:     Binding: Local (0x0)
     80 // CHECK:     Type: None (0x0)
     81 // CHECK:     Other: 0
     82 // CHECK:     Section: Undefined (0x0)
     83 // CHECK:   }
     84 // CHECK:   Symbol {
     85 // CHECK:     Name: x1 (67)
     86 // CHECK:     Value: 0x0
     87 // CHECK:     Size: 4
     88 // CHECK:     Binding: Local (0x0)
     89 // CHECK:     Type: Object (0x1)
     90 // CHECK:     Other: 0
     91 // CHECK:     Section: .bss (0x5)
     92 // CHECK:   }
     93 // CHECK:   Symbol {
     94 // CHECK:     Name: x2 (59)
     95 // CHECK:     Value: 0x4
     96 // CHECK:     Size: 4
     97 // CHECK:     Binding: Local (0x0)
     98 // CHECK:     Type: Object (0x1)
     99 // CHECK:     Other: 0
    100 // CHECK:     Section: .bss (0x5)
    101 // CHECK:   }
    102 // CHECK:   Symbol {
    103 // CHECK:     Name:  (0)
    104 // CHECK:     Value: 0x0
    105 // CHECK:     Size: 0
    106 // CHECK:     Binding: Local (0x0)
    107 // CHECK:     Type: Section (0x3)
    108 // CHECK:     Other: 0
    109 // CHECK:     Section: .bss (0x5)
    110 // CHECK:   }
    111 // CHECK:   Symbol {
    112 // CHECK:     Name:  (0)
    113 // CHECK:     Value: 0x0
    114 // CHECK:     Size: 0
    115 // CHECK:     Binding: Local (0x0)
    116 // CHECK:     Type: Section (0x3)
    117 // CHECK:     Other: 0
    118 // CHECK:     Section: x3 (0x8)
    119 // CHECK:   }
    120 // CHECK:   Symbol {
    121 // CHECK:     Name: .data (37)
    122 // CHECK:     Value: 0x8
    123 // CHECK:     Size: 0
    124 // CHECK:     Binding: Global (0x1)
    125 // CHECK:     Type: None (0x0)
    126 // CHECK:     Other: 0
    127 // CHECK:     Section: foo (0xB)
    128 // CHECK:   }
    129 // CHECK:   Symbol {
    130 // CHECK:     Name: x4 (43)
    131 // CHECK:     Value: 0x0
    132 // CHECK:     Size: 0
    133 // CHECK:     Binding: Global (0x1)
    134 // CHECK:     Type: None (0x0)
    135 // CHECK:     Other: 0
    136 // CHECK:     Section: foo (0xB)
    137 // CHECK:   }
    138 // CHECK: ]
    139