From b98f504850123e345d0470cb0bfec67eb6e7a679 Mon Sep 17 00:00:00 2001 From: Paul Semel Date: Wed, 11 Jul 2018 10:00:29 +0000 Subject: [llvm-readobj] Add -hex-dump (-x) option Differential Revision: https://reviews.llvm.org/D48281 llvm-svn: 336782 --- llvm/lib/Object/COFFObjectFile.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'llvm/lib/Object/COFFObjectFile.cpp') diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index e622c17ca3e..26194888ac0 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -979,6 +979,21 @@ std::error_code COFFObjectFile::getSection(int32_t Index, return object_error::parse_failed; } +std::error_code COFFObjectFile::getSection(StringRef SectionName, + const coff_section *&Result) const { + Result = nullptr; + StringRef SecName; + for (const SectionRef &Section : sections()) { + if (std::error_code E = Section.getName(SecName)) + return E; + if (SecName == SectionName) { + Result = getCOFFSection(Section); + return std::error_code(); + } + } + return object_error::parse_failed; +} + std::error_code COFFObjectFile::getString(uint32_t Offset, StringRef &Result) const { if (StringTableSize <= 4) -- cgit v1.2.3