1 ## Check we are able to dump library soname properly.
3 ## Test a valid object case first. We set 'FileSize' to 0x48, because this is a no-op,
4 ## i.e. this value would be set if we had no 'FileSize' at all.
5 # RUN: yaml2obj -DDTSTRTABVAL=0x0 -DPHDRFILESIZE="0x48" %s -o %t.o
6 # RUN: llvm-readobj %t.o | FileCheck %s --check-prefix LLVM
7 # RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix GNU
9 # LLVM: Format: elf64-x86-64
10 # LLVM-NEXT: Arch: x86_64
11 # LLVM-NEXT: AddressSize: 64bit
12 # LLVM-NEXT: LoadName: test.so
14 # GNU: Dynamic section at offset 0x80 contains 4 entries:
15 # GNU-NEXT: Tag Type Name/Value
16 # GNU-NEXT: 0x0000000000000005 (STRTAB) 0x0
17 # GNU-NEXT: 0x000000000000000a (STRSZ) 8 (bytes)
18 # GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [test.so]
19 # GNU-NEXT: 0x0000000000000000 (NULL) 0x0
31 Content: '746573742e736f00' ## "test.so"
38 Value: [[DTSTRTABVAL]]
40 Value: 0x0000000000000008
42 Value: 0x0000000000000000
44 Value: 0x0000000000000000
49 FileSize: [[PHDRFILESIZE]]
53 ## Check we do not crash when an object contains a DT_STRTAB entry whose address
54 ## is past the end of the object.
55 ## Note that we have to set p_filesz for PT_LOAD larger than DT_STRTAB value
56 ## to trigger this particular warning.
58 # RUN: yaml2obj -DDTSTRTABVAL=0xFFFE -DPHDRFILESIZE=0xFFFF %s -o %t.err.1.o
59 # RUN: llvm-readobj %t.err.1.o 2>&1 | FileCheck %s -DFILE=%t.err.1.o --check-prefixes=BROKEN-OFFSET,BROKEN-OFFSET-LLVM
60 # RUN: llvm-readelf --dynamic-table %t.err.1.o 2>&1 | FileCheck %s -DFILE=%t.err.1.o --check-prefixes=BROKEN-OFFSET,BROKEN-OFFSET-GNU
62 # BROKEN-OFFSET: warning: '[[FILE]]': unable to parse DT_STRTAB: can't map virtual address 0xfffe to the segment with index 1: the segment ends at 0x10077, which is greater than the file size (0x228)
63 # BROKEN-OFFSET: warning: '[[FILE]]': string table was not found
64 # BROKEN-OFFSET-LLVM: LoadName: <?>
65 # BROKEN-OFFSET-GNU: 0x000000000000000e (SONAME) Library soname: [<?>]