File: symbol-binding.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (58 lines) | stat: -rw-r--r-- 1,809 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Show that llvm-readobj can print symbol bindings correctly for both LLVM and
# GNU styles, including for symbol bindings that are not recognised.

# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj --symbols --dyn-symbols %t | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readelf --symbols --dyn-symbols %t | FileCheck %s --check-prefix=GNU

# LLVM: Name:    local
# LLVM: Binding: Local
# LLVM: Name:    global
# LLVM: Binding: Global
# LLVM: Name:    weak
# LLVM: Binding: Weak
# LLVM: Name:    unknown
# LLVM: Binding: 0x3
# LLVM: Name:    unique
# LLVM: Binding: Unique (0xA)
# LLVM: Name:    os
# LLVM: Binding: 0xB
# LLVM: Name:    proc
# LLVM: Binding: 0xF

# GNU:      3      {{.*}} unknown
# GNU-NEXT: UNIQUE {{.*}} unique
# GNU-NEXT: b      {{.*}} os
# GNU-NEXT: f      {{.*}} proc
# GNU:      LOCAL  {{.*}} local
# GNU-NEXT: GLOBAL {{.*}} global
# GNU-NEXT: WEAK   {{.*}} weak

# yaml2obj doesn't have a way of specifying static symbols with custom bindings,
# so use a custom dynamic symbol table section instead.
--- !ELF
FileHeader:
  Class: ELFCLASS32
  Data:  ELFDATA2LSB
  Type:  ET_REL
Sections:
  - Name: .dynstr
    Type: SHT_STRTAB
    #\0unknown\0unique\0os\0proc\0
    Content: "00756e6b6e6f776e00756e69717565006f730070726f6300"
  - Name: .dynsym
    Type: SHT_DYNSYM
    Link: .dynstr
    EntSize: 16
    # Null symbol
    # Symbol with st_name = 1, binding = 0x3
    # Symbol with st_name = 9, binding = 0xa
    # Symbol with st_name = 16, binding = 0xb
    # Symbol with st_name = 19, binding = 0xf
    Content: "0000000000000000000000000000000001000000000000000000000030000000090000000000000000000000a0000000100000000000000000000000b0000000130000000000000000000000f0000000"
Symbols:
  - Name:    local
  - Name:    global
    Binding: STB_GLOBAL
  - Name:    weak
    Binding: STB_WEAK