Implement MachOObjectFile::isSectionData() and MachOObjectFile::isSectionBSS

so that llvm-size will total up all the sections in the Berkeley format.  This
allows for rough categorizations for Mach-O sections.  And allows the total of
llvm-size’s Berkeley and System V formats to be the same.

llvm-svn: 209158
This commit is contained in:
Kevin Enderby
2014-05-19 20:36:02 +00:00
parent 7f26fa6715
commit 403258f5a3
3 changed files with 27 additions and 6 deletions

View File

@@ -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;
}