# BAD-STRING-LLVM-NEXT: 0x0000000000000000 NULL 0x0
# BAD-STRING-LLVM-NEXT: ]
-# BAD-STRING-GNU: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb1)
-# BAD-STRING-GNU-NEXT: Dynamic section at offset 0xb1 contains 10 entries:
+# BAD-STRING-GNU: Dynamic section at offset 0xb1 contains 10 entries:
# BAD-STRING-GNU-NEXT: Tag Type Name/Value
# BAD-STRING-GNU-NEXT: 0x0000000000000005 (STRTAB) 0x1000
# BAD-STRING-GNU-NEXT: 0x000000000000000a (STRSZ) 1 (bytes)
# BAD-STRING-GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: [<?>]
-## Note: there is no "string table at offset 0xb6..." warning here, because it was printed earlier.
+# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb7: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT: 0x000000000000000f (RPATH) Library rpath: [<?>]
# RUN: yaml2obj %s --docnum=4 -o %t.bad-strtab
# RUN: llvm-readobj --dynamic-table %t.bad-strtab 2>&1 >/dev/null | \
-# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefix BAD-STRTAB-ERR
+# RUN: FileCheck -DFILE=%t.bad-strtab %s --implicit-check-not=warning: --check-prefix=BAD-STRTAB-ERR
# RUN: llvm-readelf --dynamic-table %t.bad-strtab 2>&1 >/dev/null | \
-# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefix BAD-STRTAB-ERR
-# BAD-STRTAB-ERR: warning: '[[FILE]]': Unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000
-# BAD-STRTAB-ERR: warning: '[[FILE]]': string table was not found
+# RUN: FileCheck -DFILE=%t.bad-strtab %s --implicit-check-not=warning: --check-prefix=BAD-STRTAB-ERR
+# BAD-STRTAB-ERR: warning: '[[FILE]]': Unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000
+# BAD-STRTAB-ERR: warning: '[[FILE]]': string table was not found
+# BAD-STRTAB-ERR-NOT:{{.}}
# RUN: llvm-readobj --dynamic-table --needed-libs %t.bad-strtab 2>&1 | \
-# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR,BAD-STRTAB,BAD-STRTAB-LLVM
+# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR2,BAD-STRTAB,BAD-STRTAB-LLVM
# RUN: llvm-readelf --dynamic-table --needed-libs %t.bad-strtab 2>&1 | \
-# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR,BAD-STRTAB,BAD-STRTAB-GNU
+# RUN: FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR2,BAD-STRTAB,BAD-STRTAB-GNU
-# BAD-STRTAB-LLVM: LoadName: <?>
-# BAD-STRTAB-LLVM: 0x0000000000000001 NEEDED Shared library: [<?>]
-# BAD-STRTAB-GNU: 0x0000000000000001 (NEEDED) Shared library: [<?>]
-# BAD-STRTAB: NeededLibraries [
-# BAD-STRTAB: <?>
-# BAD-STRTAB: ]
+# BAD-STRTAB-ERR2: warning: '[[FILE]]': Unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000
+# BAD-STRTAB-LLVM: LoadName: <Not found>
+# BAD-STRTAB: warning: '[[FILE]]': string table was not found
+# BAD-STRTAB-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: [<?>]
+# BAD-STRTAB-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [<?>]
+# BAD-STRTAB: NeededLibraries [
+# BAD-STRTAB: <?>
+# BAD-STRTAB: ]
--- !ELF
FileHeader:
## the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=7 --docnum=6 -o %t6
# RUN: llvm-readobj --dynamic-table %t6 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t6 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
+# RUN: FileCheck %s -DFILE=%t6 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LLVM,NOT-TERMINATED-GREQ
# RUN: llvm-readelf --dynamic-table %t6 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t6 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
+# RUN: FileCheck %s -DFILE=%t6 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GNU,NOT-TERMINATED-GREQ
## Case B: the value of the DT_STRSZ tag is less than the size of
## the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=6 --docnum=6 -o %t7
# RUN: llvm-readobj --dynamic-table %t7 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t7 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LESS
+# RUN: FileCheck %s -DFILE=%t7 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LLVM,NOT-TERMINATED-LESS
# RUN: llvm-readelf --dynamic-table %t7 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t7 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LESS
+# RUN: FileCheck %s -DFILE=%t7 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GNU,NOT-TERMINATED-LESS
## Case C: the value of the DT_STRSZ tag is one byte larger than the size of
## the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=8 --docnum=6 -o %t8
# RUN: llvm-readobj --dynamic-table %t8 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t8 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
+# RUN: FileCheck %s -DFILE=%t8 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LLVM,NOT-TERMINATED-GREQ
# RUN: llvm-readelf --dynamic-table %t8 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t8 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
+# RUN: FileCheck %s -DFILE=%t8 --implicit-check-not=warning: \
+# RUN: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GNU,NOT-TERMINATED-GREQ
-# NOT-TERMINATED: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated
+# NOT-TERMINATED-LLVM: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated
# NOT-TERMINATED: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb0: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}NEEDED{{[)]?}} Shared library: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb1: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: [<?>]
+# NOT-TERMINATED-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}RPATH{{[)]?}} Library rpath: [<?>]
## We don't report warnings about the unsupported hash table on EM_S390 and EM_ALPHA platforms
## when --hash-table is not requested.
-# RUN: llvm-readobj %t.s390 2>&1 | FileCheck %s -DFILE=%t.s390 --implicit-check-not="warning:" --check-prefix=NOWARN
-# RUN: llvm-readelf %t.s390 2>&1 | FileCheck %s -DFILE=%t.s390 --implicit-check-not="warning:" --check-prefix=NOWARN
-# RUN: llvm-readobj %t.alpha 2>&1 | FileCheck %s -DFILE=%t.alpha --implicit-check-not="warning:" --check-prefix=NOWARN
-# RUN: llvm-readelf %t.alpha 2>&1 | FileCheck %s -DFILE=%t.alpha --implicit-check-not="warning:" --check-prefix=NOWARN
-
-# NOWARN: warning: '[[FILE]]': string table was not found
+# RUN: llvm-readobj %t.s390 2>&1 | FileCheck %s -DFILE=%t.s390 --allow-empty --implicit-check-not="warning:"
+# RUN: llvm-readelf %t.s390 2>&1 | FileCheck %s -DFILE=%t.s390 --allow-empty --implicit-check-not="warning:"
+# RUN: llvm-readobj %t.alpha 2>&1 | FileCheck %s -DFILE=%t.alpha --allow-empty --implicit-check-not="warning:"
+# RUN: llvm-readelf %t.alpha 2>&1 | FileCheck %s -DFILE=%t.alpha --allow-empty --implicit-check-not="warning:"
## Check we can dump the SHT_HASH section even when an object
## does not have the section header table.
# RUN: llvm-readelf --hash-table %t.noshdr 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.noshdr --check-prefix=NOSHDR --implicit-check-not=warning:
-# NOSHDR: warning: '[[FILE]]': string table was not found
-
# NOSHDR: HashTable {
# NOSHDR-NEXT: Num Buckets: 1
# NOSHDR-NEXT: Num Chains: 1
# RUN: llvm-readelf --hash-table %t.no.dyntag 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.no.dyntag --check-prefix=NODYNTAG --implicit-check-not=warning:
-# NODYNTAG: warning: '[[FILE]]': string table was not found
-
# NODYNTAG: HashTable {
# NODYNTAG-NEXT: }
Optional<DynRegionInfo> DynSymRegion;
DynRegionInfo DynamicTable;
StringRef DynamicStringTable;
- StringRef SOName = "<Not found>";
const Elf_Hash *HashTable = nullptr;
const Elf_GnuHash *GnuHashTable = nullptr;
const Elf_Shdr *DotSymtabSec = nullptr;
const Elf_Shdr *DotCGProfileSec = nullptr;
const Elf_Shdr *DotAddrsigSec = nullptr;
ArrayRef<Elf_Word> ShndxTable;
+ Optional<uint64_t> SONameOffset;
const Elf_Shdr *SymbolVersionSection = nullptr; // .gnu.version
const Elf_Shdr *SymbolVersionNeedSection = nullptr; // .gnu.version_r
return MappedAddrOrError.get();
};
- uint64_t SONameOffset = 0;
const char *StringTableBegin = nullptr;
uint64_t StringTableSize = 0;
Optional<DynRegionInfo> DynSymFromTable;
DynamicStringTable = StringRef(StringTableBegin, StringTableSize);
}
- SOName = getDynamicString(SONameOffset);
-
const bool IsHashTableSupported = getHashTableEntSize() == 4;
if (DynSymRegion) {
// Often we find the information about the dynamic symbol table
}
template <typename ELFT> void ELFDumper<ELFT>::printLoadName() {
+ StringRef SOName = "<Not found>";
+ if (SONameOffset)
+ SOName = getDynamicString(*SONameOffset);
W.printString("LoadName", SOName);
}