summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp5
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp10
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 5ad8f8443f7..43913e44857 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -410,6 +410,11 @@ relocation_iterator COFFObjectFile::section_rel_end(DataRefImpl Ref) const {
return relocation_iterator(RelocationRef(Ret, this));
}
+bool COFFObjectFile::section_rel_empty(DataRefImpl Ref) const {
+ const coff_section *Sec = toSec(Ref);
+ return Sec->NumberOfRelocations == 0;
+}
+
// Initialize the pointer to the symbol table.
error_code COFFObjectFile::initSymbolTablePtr() {
if (error_code EC = getObject(
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 6b1dd875958..b75b3e33b07 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -818,6 +818,16 @@ MachOObjectFile::section_rel_end(DataRefImpl Sec) const {
return relocation_iterator(RelocationRef(Ret, this));
}
+bool MachOObjectFile::section_rel_empty(DataRefImpl Sec) const {
+ if (is64Bit()) {
+ MachO::section_64 Sect = getSection64(Sec);
+ return Sect.nreloc == 0;
+ } else {
+ MachO::section Sect = getSection(Sec);
+ return Sect.nreloc == 0;
+ }
+}
+
void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
const MachO::any_relocation_info *P =
reinterpret_cast<const MachO::any_relocation_info *>(Rel.p);
OpenPOWER on IntegriCloud