From 8af2387b91cfcc1ac152f55307b86d76bbd55170 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 26 Sep 2017 14:22:35 +0000 Subject: [dwarfdump] Skip 'stripped' sections When dsymutil generates the companion file, its strips all unnecessary sections by omitting their body and setting the offset in their corresponding load command to zero. One such section is the .eh_frame section, as it contains runtime information rather than debug information and is part of the __TEXT segment. When reading this section, we would just read the number of bytes specified in the load command, starting from offset 0 (i.e. the beginning of the file). Rather than trying to parse this obviously invalid section, dwarfdump now skips this. Differential revision: https://reviews.llvm.org/D38135 llvm-svn: 314208 --- llvm/lib/Object/MachOObjectFile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index b943c4063d6..7b4be973a09 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -1928,6 +1928,12 @@ bool MachOObjectFile::isSectionBitcode(DataRefImpl Sec) const { return false; } +bool MachOObjectFile::isSectionStripped(DataRefImpl Sec) const { + if (is64Bit()) + return getSection64(Sec).offset == 0; + return getSection(Sec).offset == 0; +} + relocation_iterator MachOObjectFile::section_rel_begin(DataRefImpl Sec) const { DataRefImpl Ret; Ret.d.a = Sec.d.a; -- cgit v1.2.3