1 ## Check that we can use the --dependent-libraries option
2 ## to dump SHT_LLVM_DEPENDENT_LIBRARIES sections.
4 ## Check how we dump a file that has a single valid SHT_LLVM_DEPENDENT_LIBRARIES
5 ## section with multiple entries.
7 # RUN: yaml2obj --docnum=1 %s -o %t1
8 # RUN: llvm-readobj --dependent-libraries %t1 | \
9 # RUN: FileCheck %s --check-prefix=LLVM --strict-whitespace --match-full-lines
10 # RUN: llvm-readelf --dependent-libraries %t1 | \
11 # RUN: FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines --implicit-check-not="Dependent libraries"
13 # LLVM:DependentLibs [
19 # GNU:Dependent libraries section .deplibs at offset 0x40 contains 3 entries:
31 Type: SHT_LLVM_DEPENDENT_LIBRARIES
32 ShType: [[TYPE=<none>]]
33 Libraries: [ foo, bar, foo ]
35 ## Show the output when there are no dependent library sections. Check that we are
36 ## locating dependent library sections by type. To do this we change the type to an arbitrary one.
37 # RUN: yaml2obj --docnum=1 -DTYPE=SHT_PROGBITS %s -o %t3
38 # RUN: llvm-readobj --dependent-libraries %t3 2>&1 | FileCheck %s --check-prefix=NONE
39 # RUN: llvm-readelf --dependent-libraries %t3 2>&1 | FileCheck %s --allow-empty --implicit-check-not={{.}}
41 # NONE: DependentLibs [
44 ## Now, check how we dump a mix of valid, empty and invalid SHT_LLVM_DEPENDENT_LIBRARIES sections.
46 # RUN: yaml2obj --docnum=2 %s -o %t2
47 # RUN: llvm-readobj --dependent-libraries %t2 2>&1 | FileCheck %s --check-prefix=MIX-LLVM -DFILE=%t2
48 # RUN: llvm-readelf --dependent-libraries %t2 2>&1 | FileCheck %s --check-prefix=MIX-GNU -DFILE=%t2
50 # MIX-LLVM: DependentLibs [
51 # MIX-LLVM-NEXT: warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 1 is broken: the content is not null-terminated
53 # MIX-LLVM-NEXT: warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 4 is broken: section [index 4] has a sh_offset (0xffff0000) + sh_size (0x4) that is greater than the file size (0x308)
59 # MIX-GNU: warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 1 is broken: the content is not null-terminated
60 # MIX-GNU-NEXT: Dependent libraries section .deplibs.nonul at offset 0x40 contains 0 entries:
62 # MIX-GNU-NEXT: Dependent libraries section .deplibs.single at offset 0x43 contains 1 entries:
63 # MIX-GNU-NEXT: [ 0] abc
65 # MIX-GNU-NEXT: Dependent libraries section .deplibs.empty at offset 0x47 contains 0 entries:
67 # MIX-GNU-NEXT: warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 4 is broken: section [index 4] has a sh_offset (0xffff0000) + sh_size (0x4) that is greater than the file size (0x308)
68 # MIX-GNU-NEXT: Dependent libraries section .deplibs.broken.shoffset at offset 0xffff0000 contains 0 entries:
70 # MIX-GNU-NEXT: Dependent libraries section .deplibs.multiple at offset 0x4b contains 2 entries:
71 # MIX-GNU-NEXT: [ 0] bar
72 # MIX-GNU-NEXT: [ 4] xxx
74 # MIX-GNU-NEXT: warning: '[[FILE]]': unable to get the name of SHT_LLVM_DEPENDENT_LIBRARIES section with index 6: a section [index 6] has an invalid sh_name (0x10000) offset which goes past the end of the section name string table
75 # MIX-GNU-NEXT: Dependent libraries section <?> at offset 0x53 contains 1 entries:
76 # MIX-GNU-NEXT: [ 0] baz
84 ## Case 1: test we report a warning for a non-null-terminated section.
85 - Name: .deplibs.nonul
86 Type: SHT_LLVM_DEPENDENT_LIBRARIES
87 Content: "666f6f" ## 'f', 'o', 'o'
88 ## Case 2: test we can dump an entry from a valid section that has a single entry.
89 - Name: .deplibs.single
90 Type: SHT_LLVM_DEPENDENT_LIBRARIES
92 ## Case 3: test we do not display warnings for an empty section.
93 - Name: .deplibs.empty
94 Type: SHT_LLVM_DEPENDENT_LIBRARIES
96 ## Case 4: test we report a warning when the section offset is invalid.
97 - Name: .deplibs.broken.shoffset
98 Type: SHT_LLVM_DEPENDENT_LIBRARIES
101 ## Case 5: test we can dump all entries from a valid section that has more than one entry.
102 - Name: .deplibs.multiple
103 Type: SHT_LLVM_DEPENDENT_LIBRARIES
104 Libraries: [ bar, xxx ]
105 ## Case 6: test we report a warning in GNU mode if the section name can't be read.
107 Type: SHT_LLVM_DEPENDENT_LIBRARIES