151 lines · plain
1## Test how --syms/-t prints the static symbol table.2# RUN: yaml2obj --docnum=1 %s -o %t3# RUN: llvm-objdump --syms %t > %t.txt4# RUN: llvm-objdump -t %t | cmp - %t.txt5# RUN: FileCheck %s --input-file=%t.txt --match-full-lines --strict-whitespace6 7# CHECK:{{.*}}file format elf64-x86-648#CHECK-EMPTY:9# CHECK-NEXT:SYMBOL TABLE:10# CHECK-NEXT:0000000000000000 l df *ABS* 0000000000000000 a.c11# CHECK-NEXT:0000000000000000 l d .text 0000000000000000 .text12# CHECK-NEXT:0000000000002000 l O .data 0000000000000000 local_object13# CHECK-NEXT:0000000000001fff l F .text 0000000000000000 local_func14# CHECK-NEXT:0000000000000000 l *ABS* 0000000000000000 local_abs15# CHECK-NEXT:0000000000000000 g .data 0000000000000000 notype16# CHECK-NEXT:0000000000000000 g O .data 0000000000000010 object17# CHECK-NEXT:0000000000000000 g F .text 000000000000000f func18# CHECK-NEXT:0000000000000000 g O *COM* 0000000000000000 common19# CHECK-NEXT:0000000000000000 g .data 0000000000000000 tls20# CHECK-NEXT:0000000000000000 g i .text 0000000000000000 ifunc21# CHECK-NEXT:0000000000000000 g .text 0000000000000000 invalid_type22# CHECK-NEXT:0000000000000000 g .text 0000000000000000 STT_HIOS23# CHECK-NEXT:0000000000000000 g .text 0000000000000000 STT_LOPROC24# CHECK-NEXT:0000000000000000 *UND* 0000000000000000 undef25# CHECK-NEXT:0000000000000000 *UND* 0000000000000000 SHN_LOPROC26# CHECK-NEXT:0000000000000000 *UND* 0000000000000000 SHN_LOOS27# CHECK-NEXT:0000000000000000 *UND* 0000000000000000 reserve28# CHECK-NEXT:0000000000000000 g *ABS* 0000000000000000 abs29# CHECK-NEXT:0000000000000000 *COM* 0000000000000000 common230# CHECK-NEXT:0000000000000000 u O .data 0000000000000000 gnu_unique31# CHECK-NEXT:0000000000000000 g .data 0000000000000000 invalid_binding32# CHECK-NEXT:0000000000000000 g .data 0000000000000000 STB_HIOS33# CHECK-NEXT:0000000000000000 g .data 0000000000000000 STB_LOPROC34 35--- !ELF36FileHeader:37 Class: ELFCLASS6438 Data: ELFDATA2LSB39 Type: ET_EXEC40 Machine: EM_X86_6441Sections:42 - Name: .text43 Type: SHT_PROGBITS44 - Name: .data45 Type: SHT_PROGBITS46Symbols:47 - Name: "a.c"48 Type: STT_FILE49 Index: SHN_ABS50 - Type: STT_SECTION51 Section: .text52 - Name: local_object53 Type: STT_OBJECT54 Section: .data55 Value: 0x200056 - Name: local_func57 Type: STT_FUNC58 Section: .text59 Value: 0x1fff60 - Name: local_abs61 Index: SHN_ABS62 - Name: notype63 Binding: STB_GLOBAL64 Section: .data65 - Name: object66 Type: STT_OBJECT67 Size: 0x1068 Binding: STB_GLOBAL69 Section: .data70 - Name: func71 Type: STT_FUNC72 Size: 0xf73 Binding: STB_GLOBAL74 Section: .text75 - Name: common76 Type: STT_COMMON77 Binding: STB_GLOBAL78 Section: .data79 - Name: tls80 Type: STT_TLS81 Binding: STB_GLOBAL82 Section: .data83 - Name: ifunc84 Type: STT_GNU_IFUNC85 Binding: STB_GLOBAL86 Section: .text87 - Name: invalid_type88 Type: 789 Binding: STB_GLOBAL90 Section: .text91 - Name: STT_HIOS92 Type: 1293 Binding: STB_GLOBAL94 Section: .text95 - Name: STT_LOPROC96 Type: 1397 Binding: STB_GLOBAL98 Section: .text99 - Name: undef100 Binding: STB_GLOBAL101 - Name: SHN_LOPROC102 Binding: STB_GLOBAL103 Index: 0xff00104 - Name: SHN_LOOS105 Binding: STB_GLOBAL106 Index: 0xff20107 - Name: reserve108 Binding: STB_GLOBAL109 Index: 0xff40110 - Name: abs111 Index: SHN_ABS112 Binding: STB_GLOBAL113 - Name: common2114 Binding: STB_GLOBAL115 Index: SHN_COMMON116 - Name: gnu_unique117 Type: STT_OBJECT118 Binding: STB_GNU_UNIQUE119 Section: .data120 - Name: invalid_binding121 Binding: 3122 Section: .data123 - Name: STB_HIOS124 Binding: 12125 Section: .data126 - Name: STB_LOPROC127 Binding: 13128 Section: .data129 130## For an ELF32 object, print the address and size fields as 32-bit hexadecimals.131# RUN: yaml2obj --docnum=2 -D BITS=32 %s -o %t.32132# RUN: llvm-objdump --syms %t.32 | FileCheck --check-prefix=ELF32 %s --match-full-lines --strict-whitespace133## For an ELF64 object, print the address and size fields as 64-bit hexadecimals.134# RUN: yaml2obj --docnum=2 -D BITS=64 %s -o %t.64135# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s --match-full-lines --strict-whitespace136 137# ELF32:SYMBOL TABLE:138# ELF32-NEXT:00000000 *UND* 00000000 sym139 140# ELF64:SYMBOL TABLE:141# ELF64-NEXT:0000000000000000 *UND* 0000000000000000 sym142 143--- !ELF144FileHeader:145 Class: ELFCLASS[[BITS]]146 Data: ELFDATA2LSB147 Type: ET_EXEC148 Machine: EM_X86_64149Symbols:150 - Name: sym151