needed-libs.test
3.39 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
## In this test we check the --needed-libs option.
# RUN: yaml2obj %s --docnum=1 -o %t1
# RUN: llvm-readobj --needed-libs %t1 2>&1 \
# RUN: | FileCheck %s -DFILE=%t1 --implicit-check-not=warning: --strict-whitespace --check-prefix=NEEDED-LIBS
# RUN: llvm-readelf --needed-libs %t1 2>&1 \
# RUN: | FileCheck %s -DFILE=%t1 --implicit-check-not=warning: --strict-whitespace --check-prefix=NEEDED-LIBS
## Check that library names are sorted when printed.
## Document that we also sort error entries.
# NEEDED-LIBS:{{^}}NeededLibraries [{{$}}
# NEEDED-LIBS-NEXT: warning: '[[FILE]]': string table at offset 0x78: unable to read the string at 0x9999a11: it goes past the end of the table (0x85){{$}}
# NEEDED-LIBS-NEXT: warning: '[[FILE]]': string table at offset 0x78: unable to read the string at 0x1111189: it goes past the end of the table (0x85){{$}}
# NEEDED-LIBS-NEXT:{{^}} <?>{{$}}
# NEEDED-LIBS-NEXT:{{^}} <?>{{$}}
# NEEDED-LIBS-NEXT:{{^}} aaa{{$}}
# NEEDED-LIBS-NEXT:{{^}} bbb{{$}}
# NEEDED-LIBS-NEXT:{{^}} ccc{{$}}
# NEEDED-LIBS-NEXT:{{^}}]{{$}}
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .dynstr
Type: SHT_STRTAB
Flags: [ SHF_ALLOC ]
Content: '00616161006262620063636300' ## 0,a,a,a,0,b,b,b,0,c,c,c,0
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_STRTAB
Value: 0x0000000000000000
- Tag: DT_NEEDED
Value: 0x9999999
- Tag: DT_NEEDED
Value: 9
- Tag: DT_NEEDED
Value: 1
- Tag: DT_NEEDED
Value: 5
- Tag: DT_NEEDED
Value: 0x1111111
- Tag: DT_STRSZ
Value: 0xD
- Tag: DT_NULL
Value: 0x0
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x0
Sections:
- Section: .dynstr
- Section: .dynamic
## Check what we print when the dynamic string table is empty.
# RUN: yaml2obj %s --docnum=2 -o %t2
# RUN: llvm-readobj --needed-libs %t2 2>&1 | \
# RUN: FileCheck %s -DFILE=%t2 --implicit-check-not=warning: --check-prefixes=EMPTY-DYNSTR,EMPTY-DYNSTR-LLVM
# RUN: llvm-readelf --needed-libs %t2 2>&1 | \
# RUN: FileCheck %s -DFILE=%t2 --implicit-check-not=warning: --check-prefix=EMPTY-DYNSTR
# EMPTY-DYNSTR: warning: '[[FILE]]': string table at offset 0x78: unable to read the string at 0x78: it goes past the end of the table (0x78)
# EMPTY-DYNSTR-LLVM: LoadName: <?>
# EMPTY-DYNSTR: NeededLibraries [
# EMPTY-DYNSTR-NEXT: warning: '[[FILE]]': string table at offset 0x78: unable to read the string at 0x79: it goes past the end of the table (0x78)
# EMPTY-DYNSTR-NEXT: warning: '[[FILE]]': string table at offset 0x78: unable to read the string at 0x7a: it goes past the end of the table (0x78)
# EMPTY-DYNSTR-NEXT: <?>
# EMPTY-DYNSTR-NEXT: <?>
# EMPTY-DYNSTR-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .dynstr
Type: SHT_STRTAB
Flags: [ SHF_ALLOC ]
Size: 0
- Name: .dynamic
Type: SHT_DYNAMIC
Address: 0x1000
Entries:
- Tag: DT_STRTAB
Value: 0x0000000000000000
- Tag: DT_NEEDED
Value: 1
- Tag: DT_NEEDED
Value: 2
- Tag: DT_STRSZ
Value: 0x0
- Tag: DT_NULL
Value: 0x0
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x0
Sections:
- Section: .dynstr
- Section: .dynamic