[PATCH] D49544: [llvm-readobj] - Do not report invalid amount of sections.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 19 07:58:21 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337462: [llvm-readobj] - Do not report invalid amount of sections. (authored by grimar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49544?vs=156263&id=156273#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49544
Files:
llvm/trunk/test/tools/llvm-readobj/many-sections.s
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
@@ -2904,7 +2904,9 @@
Bias = 8;
Width = 8;
}
- OS << "There are " << to_string(Obj->getHeader()->e_shnum)
+
+ ArrayRef<Elf_Shdr> Sections = unwrapOrError(Obj->sections());
+ OS << "There are " << to_string(Sections.size())
<< " section headers, starting at offset "
<< "0x" << to_hexString(Obj->getHeader()->e_shoff, false) << ":\n\n";
OS << "Section Headers:\n";
@@ -2923,7 +2925,7 @@
printField(f);
OS << "\n";
- for (const Elf_Shdr &Sec : unwrapOrError(Obj->sections())) {
+ for (const Elf_Shdr &Sec : Sections) {
Number = to_string(SectionIndex);
Fields[0].Str = Number;
Fields[1].Str = unwrapOrError(Obj->getSectionName(&Sec));
Index: llvm/trunk/test/tools/llvm-readobj/many-sections.s
===================================================================
--- llvm/trunk/test/tools/llvm-readobj/many-sections.s
+++ llvm/trunk/test/tools/llvm-readobj/many-sections.s
@@ -11,10 +11,11 @@
## space, but its e_shnum, e_shstrndx, sh_size and sh_link fields are set
## according to the above description, so that we can test the dumper.
-# RUN: llvm-readobj -file-headers -elf-output-style GNU \
+# RUN: llvm-readobj -file-headers -sections -elf-output-style GNU \
# RUN: %p/Inputs/many-sections.elf-x86_64 | FileCheck %s --check-prefix=GNU1
# GNU1: Number of section headers: 0 (5)
# GNU1: Section header string table index: 65535 (3)
+# GNU1: There are 5 section headers, starting at offset 0xb8
# RUN: llvm-readobj -file-headers -elf-output-style LLVM \
# RUN: %p/Inputs/many-sections.elf-x86_64 | FileCheck %s --check-prefix=LLVM1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49544.156273.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180719/a9750b26/attachment.bin>
More information about the llvm-commits
mailing list