Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test

raw
1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-objcopy %t %t2
3 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
4
5 ## Check that all values of the null symbol are zeroes.
6
7 # CHECK: Symbols [
8 # CHECK-NEXT: Symbol {
9 # CHECK-NEXT: Name: (0)
10 # CHECK-NEXT: Value: 0x0
11 # CHECK-NEXT: Size: 0
12 # CHECK-NEXT: Binding: Local (0x0)
13 # CHECK-NEXT: Type: None (0x0)
14 # CHECK-NEXT: Other: 0
15 # CHECK-NEXT: Section: Undefined (0x0)
16 # CHECK-NEXT: }
17
18 ## Check we emit a zero in st_name field when a symbol has no name.
19
20 # CHECK: Name: .text (0)
21 # CHECK-NEXT: Value: 0x0
22 # CHECK-NEXT: Size: 0
23 # CHECK-NEXT: Binding: Local (0x0)
24 # CHECK-NEXT: Type: Section (0x3)
25 # CHECK-NEXT: Other: 0
26 # CHECK-NEXT: Section: .text (0x1)
27 # CHECK-NEXT: }
28
29 !ELF
30 FileHeader:
31 Class: ELFCLASS64
32 Data: ELFDATA2LSB
33 Type: ET_EXEC
34 Machine: EM_X86_64
35 Sections:
36 - Name: .text
37 Type: SHT_PROGBITS
38 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
39 Symbols:
40 - Name: ""
41 Type: STT_SECTION
42 Section: .text
43 # We need to have a named symbol, otherwise the original
44 # issue that was fixed is not reproduced by this test.
45 - Name: foo
46 Binding: STB_GLOBAL