aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@google.com>2022-09-09 09:36:41 +0100
committerJames Henderson <james.henderson@sony.com>2022-09-09 12:27:07 +0100
commit43efb5e445fdd86ab7a0e849b6d70d96d7fafcdc (patch)
tree807d8f96f77f1a94cc1f1d618c9752a041aa2f8a /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent7b9fae05b4d0d3184ffc340e90d06a75e3cba2de (diff)
downloadllvm-43efb5e445fdd86ab7a0e849b6d70d96d7fafcdc.zip
llvm-43efb5e445fdd86ab7a0e849b6d70d96d7fafcdc.tar.gz
llvm-43efb5e445fdd86ab7a0e849b6d70d96d7fafcdc.tar.bz2
[llvm-objdump] Create name for fake sections
It doesn't have a section header string table so add a vector to have the strings and create name based on the program header type and the index. Differential Revision: https://reviews.llvm.org/D131290
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index c15b89d..0977598 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2166,6 +2166,9 @@ static size_t getMaxSectionNameWidth(const ObjectFile &Obj) {
}
void objdump::printSectionHeaders(ObjectFile &Obj) {
+ if (Obj.isELF() && Obj.sections().empty())
+ createFakeELFSections(Obj);
+
size_t NameWidth = getMaxSectionNameWidth(Obj);
size_t AddressWidth = 2 * Obj.getBytesInAddress();
bool HasLMAColumn = shouldDisplayLMA(Obj);
@@ -2178,9 +2181,6 @@ void objdump::printSectionHeaders(ObjectFile &Obj) {
outs() << "Idx " << left_justify("Name", NameWidth) << " Size "
<< left_justify("VMA", AddressWidth) << " Type\n";
- if (Obj.isELF() && Obj.sections().empty())
- createFakeELFSections(Obj);
-
uint64_t Idx;
for (const SectionRef &Section : ToolSectionFilter(Obj, &Idx)) {
StringRef Name = unwrapOrError(Section.getName(), Obj.getFileName());