[PATCH] D82858: [llvm-objdump] Detect note section for ELF objects
Ronak Chauhan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 04:18:58 PDT 2020
rochauha created this revision.
rochauha added reviewers: scott.linder, t-tye.
Herald added subscribers: llvm-commits, rupprecht, MaskRay.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.
This is the first step toward handling notes in llvm-objdump.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82858
Files:
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1181,6 +1181,19 @@
return SymbolInfoTy(Addr, Name, Type);
}
+static bool isNoteSection(SectionRef S) {
+ // Right now we only support detecting note section for ELF objects.
+ // TODO:
+ // Support other formats too.
+
+ auto Obj = S.getObject();
+ if (Obj->isELF()) {
+ ELFSectionRef ES(S);
+ return ES.getType() == ELF::SHT_NOTE;
+ }
+ return false;
+}
+
static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
MCContext &Ctx, MCDisassembler *PrimaryDisAsm,
MCDisassembler *SecondaryDisAsm,
@@ -1293,6 +1306,12 @@
(!Section.isText() || Section.isVirtual()))
continue;
+ // The note section needs to be handled separately.
+ if (isNoteSection(Section)) {
+ outs() << "\n.note section : Pending support\n";
+ continue;
+ }
+
uint64_t SectionAddr = Section.getAddress();
uint64_t SectSize = Section.getSize();
if (!SectSize)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82858.274405.patch
Type: text/x-patch
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/541ed3cf/attachment-0001.bin>
More information about the llvm-commits
mailing list