1 # RUN: yaml2obj %s > %t 2 # RUN: llvm-objcopy -localize-hidden %t %t2 3 # RUN: llvm-readobj -relocations -symbols %t2 | FileCheck %s 4 5 !ELF 6 FileHeader: 7 Class: ELFCLASS64 8 Data: ELFDATA2LSB 9 Type: ET_REL 10 Machine: EM_X86_64 11 Sections: 12 - Name: .text 13 Type: SHT_PROGBITS 14 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 15 Address: 0x1000 16 AddressAlign: 0x0000000000000010 17 Size: 64 18 - Name: .data 19 Type: SHT_PROGBITS 20 Flags: [ SHF_ALLOC ] 21 Address: 0x2000 22 AddressAlign: 0x0000000000000010 23 Content: "0000000000000000" 24 - Name: .rel.text 25 Type: SHT_REL 26 Info: .text 27 Relocations: 28 - Offset: 0x1000 29 Symbol: undefGlobal 30 Type: R_X86_64_PC32 31 Symbols: 32 Local: 33 - Name: hiddenLocal 34 Type: STT_FUNC 35 Section: .text 36 Value: 0x1008 37 Size: 8 38 Visibility: STV_HIDDEN 39 Weak: 40 - Name: hiddenWeak 41 Type: STT_FUNC 42 Section: .text 43 Value: 0x1010 44 Size: 8 45 Visibility: STV_HIDDEN 46 Global: 47 - Name: defaultGlobal 48 Type: STT_FUNC 49 Size: 8 50 Section: .text 51 Value: 0x1000 52 - Name: hiddenGlobal 53 Type: STT_OBJECT 54 Section: .data 55 Value: 0x2006 56 Size: 2 57 Visibility: STV_HIDDEN 58 - Name: undefGlobal 59 Type: STT_FUNC 60 Size: 8 61 - Name: internalGlobal 62 Type: STT_OBJECT 63 Section: .data 64 Value: 0x2002 65 Size: 2 66 Visibility: STV_INTERNAL 67 - Name: protectedGlobal 68 Type: STT_OBJECT 69 Section: .data 70 Value: 0x2000 71 Size: 4 72 Visibility: STV_PROTECTED 73 74 #CHECK: Relocations [ 75 #CHECK-NEXT: Section (3) .rel.text { 76 #CHECK-NEXT: 0x1000 R_X86_64_PC32 undefGlobal 0x0 77 #CHECK-NEXT: } 78 #CHECK-NEXT:] 79 80 81 #CHECK: Symbols [ 82 #CHECK-NEXT: Symbol { 83 #CHECK-NEXT: Name: 84 #CHECK-NEXT: Value: 0x0 85 #CHECK-NEXT: Size: 0 86 #CHECK-NEXT: Binding: Local 87 #CHECK-NEXT: Type: None 88 #CHECK-NEXT: Other: 0 89 #CHECK-NEXT: Section: Undefined 90 #CHECK-NEXT: } 91 #CHECK-NEXT: Symbol { 92 #CHECK-NEXT: Name: hiddenLocal 93 #CHECK-NEXT: Value: 0x1008 94 #CHECK-NEXT: Size: 8 95 #CHECK-NEXT: Binding: Local 96 #CHECK-NEXT: Type: Function 97 #CHECK-NEXT: Other [ 98 #CHECK-NEXT: STV_HIDDEN 99 #CHECK-NEXT: ] 100 #CHECK-NEXT: Section: .text 101 #CHECK-NEXT: } 102 #CHECK-NEXT: Symbol { 103 #CHECK-NEXT: Name: hiddenGlobal 104 #CHECK-NEXT: Value: 0x2006 105 #CHECK-NEXT: Size: 2 106 #CHECK-NEXT: Binding: Local 107 #CHECK-NEXT: Type: Object 108 #CHECK-NEXT: Other [ 109 #CHECK-NEXT: STV_HIDDEN 110 #CHECK-NEXT: ] 111 #CHECK-NEXT: Section: .data 112 #CHECK-NEXT: } 113 #CHECK-NEXT: Symbol { 114 #CHECK-NEXT: Name: internalGlobal 115 #CHECK-NEXT: Value: 0x2002 116 #CHECK-NEXT: Size: 2 117 #CHECK-NEXT: Binding: Local 118 #CHECK-NEXT: Type: Object 119 #CHECK-NEXT: Other [ 120 #CHECK-NEXT: STV_INTERNAL 121 #CHECK-NEXT: ] 122 #CHECK-NEXT: Section: .data 123 #CHECK-NEXT: } 124 #CHECK-NEXT: Symbol { 125 #CHECK-NEXT: Name: hiddenWeak 126 #CHECK-NEXT: Value: 0x1010 127 #CHECK-NEXT: Size: 8 128 #CHECK-NEXT: Binding: Local 129 #CHECK-NEXT: Type: Function 130 #CHECK-NEXT: Other [ 131 #CHECK-NEXT: STV_HIDDEN 132 #CHECK-NEXT: ] 133 #CHECK-NEXT: Section: .text 134 #CHECK-NEXT: } 135 #CHECK-NEXT: Symbol { 136 #CHECK-NEXT: Name: defaultGlobal 137 #CHECK-NEXT: Value: 0x1000 138 #CHECK-NEXT: Size: 8 139 #CHECK-NEXT: Binding: Global 140 #CHECK-NEXT: Type: Function 141 #CHECK-NEXT: Other: 0 142 #CHECK-NEXT: Section: .text 143 #CHECK-NEXT: } 144 #CHECK-NEXT: Symbol { 145 #CHECK-NEXT: Name: undefGlobal 146 #CHECK-NEXT: Value: 0x0 147 #CHECK-NEXT: Size: 8 148 #CHECK-NEXT: Binding: Global 149 #CHECK-NEXT: Type: Function 150 #CHECK-NEXT: Other: 0 151 #CHECK-NEXT: Section: 152 #CHECK-NEXT: } 153 #CHECK-NEXT: Symbol { 154 #CHECK-NEXT: Name: protectedGlobal 155 #CHECK-NEXT: Value: 0x2000 156 #CHECK-NEXT: Size: 4 157 #CHECK-NEXT: Binding: Global 158 #CHECK-NEXT: Type: Object 159 #CHECK-NEXT: Other [ 160 #CHECK-NEXT: STV_PROTECTED 161 #CHECK-NEXT: ] 162 #CHECK-NEXT: Section: .data 163 #CHECK-NEXT: } 164 #CHECK-NEXT:] 165