summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-07-18 08:34:35 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-07-18 08:34:35 +0000
commite35e6448f99d69c40f7073794abbd75b9a0a75c0 (patch)
treeb5e7af5240f39dc506abaddd69224b296994f645 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent6fdac3b23ad9229c953a0cede9c01af6c5605792 (diff)
downloadbcm5719-llvm-e35e6448f99d69c40f7073794abbd75b9a0a75c0.tar.gz
bcm5719-llvm-e35e6448f99d69c40f7073794abbd75b9a0a75c0.zip
[llvm-objdump] - Stop reporting bogus section IDs.
Imagine we have a file with few sections, and one of them is .foo with index N != 0. Problem is that when llvm-objdump is given a -section=.foo parameter it lists .foo as a section at index 0. That makes impossible to write test cases which needs to find the index of the particular section, while ignoring dumping of others. The patch fixes that. Differential revision: https://reviews.llvm.org/D49372 llvm-svn: 337361
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index d1a765b1af5..987f565a9b7 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1815,7 +1815,6 @@ void llvm::PrintDynamicRelocations(const ObjectFile *Obj) {
void llvm::PrintSectionHeaders(const ObjectFile *Obj) {
outs() << "Sections:\n"
"Idx Name Size Address Type\n";
- unsigned i = 0;
for (const SectionRef &Section : ToolSectionFilter(*Obj)) {
StringRef Name;
error(Section.getName(Name));
@@ -1826,9 +1825,9 @@ void llvm::PrintSectionHeaders(const ObjectFile *Obj) {
bool BSS = Section.isBSS();
std::string Type = (std::string(Text ? "TEXT " : "") +
(Data ? "DATA " : "") + (BSS ? "BSS" : ""));
- outs() << format("%3d %-13s %08" PRIx64 " %016" PRIx64 " %s\n", i,
- Name.str().c_str(), Size, Address, Type.c_str());
- ++i;
+ outs() << format("%3d %-13s %08" PRIx64 " %016" PRIx64 " %s\n",
+ Section.getIndex(), Name.str().c_str(), Size, Address,
+ Type.c_str());
}
}
OpenPOWER on IntegriCloud