diff options
author | Kevin Enderby <enderby@apple.com> | 2014-05-19 20:36:02 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2014-05-19 20:36:02 +0000 |
commit | 86ad7b70cb994a9ebde84053026e560a37061ce9 (patch) | |
tree | 050f6c4d352f7dde4f1b7e8d2e4d1cdc936a361f /lib/Object | |
parent | ca162faee2e8f9e9f8938b164a0e959307194baa (diff) | |
download | llvm-86ad7b70cb994a9ebde84053026e560a37061ce9.tar.gz llvm-86ad7b70cb994a9ebde84053026e560a37061ce9.tar.bz2 llvm-86ad7b70cb994a9ebde84053026e560a37061ce9.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209158 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/MachOObjectFile.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index fa95eca669..0951460ccb 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/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; } |