1 ## Show that llvm-readobj can dump SHT_LLVM_ADDRSIG sections.
3 # RUN: yaml2obj --docnum=1 %s -o %t1.o
4 # RUN: llvm-readobj --addrsig %t1.o | FileCheck -DFILE=%t1.o %s --check-prefix=LLVM
5 # RUN: llvm-readelf --addrsig %t1.o | \
6 # RUN: FileCheck -DFILE=%t1.o %s --strict-whitespace --match-full-lines --check-prefix=GNU
9 # LLVM-NEXT: Sym: foo (1)
10 # LLVM-NEXT: Sym: bar (2)
13 # GNU:Address-significant symbols section '.llvm_addrsig' contains 2 entries:
27 ShName: [[NAME=<none>]]
28 Type: SHT_LLVM_ADDRSIG
34 ## Check what we print when it is impossible to read the name of the SHT_LLVM_ADDRSIG section.
35 ## llvm-readelf reports a warning in this case.
37 # RUN: yaml2obj --docnum=1 -DNAME=0xff %s -o %t1.name.o
38 # RUN: llvm-readobj --addrsig %t1.name.o 2>&1 | \
39 # RUN: FileCheck -DFILE=%t1.name.o %s --check-prefix=LLVM --implicit-check-not=warning:
40 # RUN: llvm-readelf --addrsig %t1.name.o 2>&1 | \
41 # RUN: FileCheck -DFILE=%t1.name.o %s --check-prefix=NAME-GNU --implicit-check-not=warning:
43 # NAME-GNU: warning: '[[FILE]]': unable to get the name of SHT_LLVM_ADDRSIG section with index 1: a section [index 1] has an invalid sh_name (0xff) offset which goes past the end of the section name string table
44 # NAME-GNU: Address-significant symbols section '<?>' contains 2 entries:
45 # NAME-GNU-NEXT: Num: Name
46 # NAME-GNU-NEXT: 1: foo
47 # NAME-GNU-NEXT: 2: bar
49 ## Check that llvm-readobj dumps any SHT_LLVM_ADDRSIG section when --all
50 ## is specified for LLVM style, but not for GNU style.
52 # RUN: llvm-readobj --all %t1.o | FileCheck %s --check-prefix=LLVM
53 # RUN: llvm-readelf --all %t1.o | FileCheck %s --implicit-check-not="Address-significant"
55 ## Check we report a warning when the content of the SHT_LLVM_ADDRSIG section
56 ## is broken (e.g. contains a malformed uleb128).
58 # RUN: yaml2obj --docnum=2 %s -o %t2.1.o
59 # RUN: llvm-readobj --addrsig %t2.1.o 2>&1 | FileCheck %s -DFILE=%t2.1.o --check-prefix=MALFORMED-LLVM
60 # RUN: llvm-readelf --addrsig %t2.1.o 2>&1 | FileCheck %s -DFILE=%t2.1.o --check-prefix=MALFORMED-GNU
62 # MALFORMED-LLVM: Addrsig [
63 # MALFORMED-LLVM-NEXT: warning: '[[FILE]]': unable to decode SHT_LLVM_ADDRSIG section with index 1: malformed uleb128, extends past end
64 # MALFORMED-LLVM-NEXT: ]
66 # MALFORMED-GNU: warning: '[[FILE]]': unable to decode SHT_LLVM_ADDRSIG section with index 1: malformed uleb128, extends past end
67 # MALFORMED-GNU-NOT:{{.}}
76 Type: SHT_LLVM_ADDRSIG
78 ShOffset: [[OFFSET=<none>]]
80 ## Check we report a warning when the content of the SHT_LLVM_ADDRSIG section can't be read.
82 # RUN: yaml2obj --docnum=2 -DOFFSET=0xffffffff %s -o %t2.2.o
83 # RUN: llvm-readobj --addrsig %t2.2.o 2>&1 | FileCheck %s -DFILE=%t2.2.o --check-prefix=BROKEN-SEC-LLVM
84 # RUN: llvm-readelf --addrsig %t2.2.o 2>&1 | FileCheck %s -DFILE=%t2.2.o --check-prefix=BROKEN-SEC-GNU
86 # BROKEN-SEC-LLVM: Addrsig [
87 # BROKEN-SEC-LLVM-NEXT: warning: '[[FILE]]': section [index 1] has a sh_offset (0xffffffff) + sh_size (0x1) that is greater than the file size (0x168)
88 # BROKEN-SEC-LLVM-NEXT: ]
90 # BROKEN-SEC-GNU: warning: '[[FILE]]': section [index 1] has a sh_offset (0xffffffff) + sh_size (0x1) that is greater than the file size (0x168)
91 # BROKEN-SEC-GNU-NOT:{{.}}
93 ## Check we report a warning when SHT_LLVM_ADDRSIG references a symbol that can't be
94 ## dumped (e.g. the index value is larger than the number of symbols in .symtab).
96 # RUN: yaml2obj --docnum=3 %s -o %t3.o
97 # RUN: llvm-readobj --addrsig %t3.o 2>&1 | FileCheck %s -DFILE=%t3.o --check-prefix=INVALID-INDEX-LLVM
98 # RUN: llvm-readelf --addrsig %t3.o 2>&1 | FileCheck %s -DFILE=%t3.o --check-prefix=INVALID-INDEX-GNU
100 # INVALID-INDEX-LLVM: Addrsig [
101 # INVALID-INDEX-LLVM-NEXT: Sym: foo (1)
102 # INVALID-INDEX-LLVM-NEXT: warning: '[[FILE]]': unable to read the name of symbol with index 255: unable to get symbol from section [index 2]: invalid symbol index (255)
103 # INVALID-INDEX-LLVM-NEXT: Sym: <?> (255)
104 # INVALID-INDEX-LLVM-NEXT: Sym: bar (2)
105 # INVALID-INDEX-LLVM-NEXT: ]
107 # INVALID-INDEX-GNU: Address-significant symbols section '.llvm_addrsig' contains 3 entries:
108 # INVALID-INDEX-GNU-NEXT: Num: Name
109 # INVALID-INDEX-GNU-NEXT: 1: foo
110 # INVALID-INDEX-GNU-NEXT: warning: '[[FILE]]': unable to read the name of symbol with index 255: unable to get symbol from section [index 2]: invalid symbol index (255)
111 # INVALID-INDEX-GNU-NEXT: 2: <?>
112 # INVALID-INDEX-GNU-NEXT: 3: bar
120 - Name: .llvm_addrsig
121 Type: SHT_LLVM_ADDRSIG
122 Symbols: [ 1, 255, 2 ]