llvm.org GIT mirror llvm / efd8832
[llvm-readobj] - Do not report invalid amount of sections. When output style is GNU and amount of sections is >= SHN_LORESERVE, llvm-readobj reports zero number of sections instead of actual value. The patch fixes that. Differential revision: https://reviews.llvm.org/D49544 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337462 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 2 years ago
2 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1010 ## space, but its e_shnum, e_shstrndx, sh_size and sh_link fields are set
1111 ## according to the above description, so that we can test the dumper.
1212
13 # RUN: llvm-readobj -file-headers -elf-output-style GNU \
13 # RUN: llvm-readobj -file-headers -sections -elf-output-style GNU \
1414 # RUN: %p/Inputs/many-sections.elf-x86_64 | FileCheck %s --check-prefix=GNU1
1515 # GNU1: Number of section headers: 0 (5)
1616 # GNU1: Section header string table index: 65535 (3)
17 # GNU1: There are 5 section headers, starting at offset 0xb8
1718
1819 # RUN: llvm-readobj -file-headers -elf-output-style LLVM \
1920 # RUN: %p/Inputs/many-sections.elf-x86_64 | FileCheck %s --check-prefix=LLVM1
29032903 Bias = 8;
29042904 Width = 8;
29052905 }
2906 OS << "There are " << to_string(Obj->getHeader()->e_shnum)
2906
2907 ArrayRef Sections = unwrapOrError(Obj->sections());
2908 OS << "There are " << to_string(Sections.size())
29072909 << " section headers, starting at offset "
29082910 << "0x" << to_hexString(Obj->getHeader()->e_shoff, false) << ":\n\n";
29092911 OS << "Section Headers:\n";
29222924 printField(f);
29232925 OS << "\n";
29242926
2925 for (const Elf_Shdr &Sec : unwrapOrError(Obj->sections())) {
2927 for (const Elf_Shdr &Sec : Sections) {
29262928 Number = to_string(SectionIndex);
29272929 Fields[0].Str = Number;
29282930 Fields[1].Str = unwrapOrError(Obj->getSectionName(&Sec));