summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2014-05-19 20:36:02 +0000
committerKevin Enderby <enderby@apple.com>2014-05-19 20:36:02 +0000
commit403258f5a34607f93b69bc44ae52fb7634ae1913 (patch)
tree4adc9912d421f293b100221e56f233538d52aedb /llvm/lib/Object/MachOObjectFile.cpp
parent7f26fa67154187401a70efc06e140e7f090e5c3b (diff)
downloadbcm5719-llvm-403258f5a34607f93b69bc44ae52fb7634ae1913.tar.gz
bcm5719-llvm-403258f5a34607f93b69bc44ae52fb7634ae1913.zip
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
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index fa95eca669f..0951460ccbb 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;
}
OpenPOWER on IntegriCloud