From 403258f5a34607f93b69bc44ae52fb7634ae1913 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Mon, 19 May 2014 20:36:02 +0000 Subject: =?UTF-8?q?Implement=20MachOObjectFile::isSectionData()=20and=20Ma?= =?UTF-8?q?chOObjectFile::isSectionBSS=20so=20that=20llvm-size=20will=20to?= =?UTF-8?q?tal=20up=20all=20the=20sections=20in=20the=20Berkeley=20format.?= =?UTF-8?q?=20=20This=20allows=20for=20rough=20categorizations=20for=20Mac?= =?UTF-8?q?h-O=20sections.=20=20And=20allows=20the=20total=20of=20llvm-siz?= =?UTF-8?q?e=E2=80=99s=20Berkeley=20and=20System=20V=20formats=20to=20be?= =?UTF-8?q?=20the=20same.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit llvm-svn: 209158 --- llvm/lib/Object/MachOObjectFile.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index fa95eca..0951460 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -686,15 +686,21 @@ MachOObjectFile::isSectionText(DataRefImpl Sec, bool &Res) const { return object_error::success; } -error_code MachOObjectFile::isSectionData(DataRefImpl DRI, bool &Result) const { - // FIXME: Unimplemented. - Result = false; +error_code MachOObjectFile::isSectionData(DataRefImpl Sec, bool &Result) const { + uint32_t Flags = getSectionFlags(this, Sec); + unsigned SectionType = Flags & MachO::SECTION_TYPE; + Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && + !(SectionType == MachO::S_ZEROFILL || + SectionType == MachO::S_GB_ZEROFILL); return object_error::success; } -error_code MachOObjectFile::isSectionBSS(DataRefImpl DRI, bool &Result) const { - // FIXME: Unimplemented. - Result = false; +error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec, bool &Result) const { + uint32_t Flags = getSectionFlags(this, Sec); + unsigned SectionType = Flags & MachO::SECTION_TYPE; + Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && + (SectionType == MachO::S_ZEROFILL || + SectionType == MachO::S_GB_ZEROFILL); return object_error::success; } -- cgit v1.1