summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-03-21 07:26:41 +0000
committerJuergen Ributzka <juergen@apple.com>2014-03-21 07:26:41 +0000
commit4923eea4f6a5c547cfa87e2da7ba788100df4982 (patch)
tree02263154642555f0e803f9aaf1186b36f24a8018 /include
parentfc029f2983a69de3ccca576f2cee23292d1b04ef (diff)
downloadllvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.gz
llvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.bz2
llvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.xz
[RuntimeDyld] Allow processRelocationRef to process more than one relocation entry at a time.
Some targets require more than one relocation entry to perform a relocation. This change allows processRelocationRef to process more than one relocation entry at a time by passing the relocation iterator itself instead of just the relocation entry. Related to <rdar://problem/16199095> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/COFF.h1
-rw-r--r--include/llvm/Object/ELFObjectFile.h7
-rw-r--r--include/llvm/Object/MachO.h1
-rw-r--r--include/llvm/Object/ObjectFile.h11
-rw-r--r--include/llvm/Object/SymbolicFile.h4
5 files changed, 24 insertions, 0 deletions
diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h
index c2e7d52b91..af2eb6826e 100644
--- a/include/llvm/Object/COFF.h
+++ b/include/llvm/Object/COFF.h
@@ -390,6 +390,7 @@ protected:
bool &Result) const override;
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
+ bool section_rel_empty(DataRefImpl Sec) const override;
void moveRelocationNext(DataRefImpl &Rel) const override;
error_code getRelocationAddress(DataRefImpl Rel,
diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h
index e6752b3d90..7dcd4cf08c 100644
--- a/include/llvm/Object/ELFObjectFile.h
+++ b/include/llvm/Object/ELFObjectFile.h
@@ -91,6 +91,7 @@ protected:
bool &Result) const override;
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
+ bool section_rel_empty(DataRefImpl Sec) const override;
section_iterator getRelocatedSection(DataRefImpl Sec) const override;
void moveRelocationNext(DataRefImpl &Rel) const override;
@@ -558,6 +559,12 @@ ELFObjectFile<ELFT>::section_rel_end(DataRefImpl Sec) const {
}
template <class ELFT>
+bool ELFObjectFile<ELFT>::section_rel_empty(DataRefImpl Sec) const {
+ const Elf_Shdr *S = reinterpret_cast<const Elf_Shdr *>(Sec.p);
+ return S->sh_size == 0;
+}
+
+template <class ELFT>
section_iterator
ELFObjectFile<ELFT>::getRelocatedSection(DataRefImpl Sec) const {
if (EF.getHeader()->e_type != ELF::ET_REL)
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h
index 34edec3ebf..acd391ba33 100644
--- a/include/llvm/Object/MachO.h
+++ b/include/llvm/Object/MachO.h
@@ -91,6 +91,7 @@ public:
bool &Result) const override;
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
+ bool section_rel_empty(DataRefImpl Sec) const override;
void moveRelocationNext(DataRefImpl &Rel) const override;
error_code getRelocationAddress(DataRefImpl Rel,
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index 790257cdc2..1fdfbe81b2 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -87,6 +87,7 @@ public:
SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
bool operator==(const SectionRef &Other) const;
+ bool operator!=(const SectionRef &Other) const;
bool operator<(const SectionRef &Other) const;
void moveNext();
@@ -116,6 +117,7 @@ public:
relocation_iterator_range relocations() const {
return relocation_iterator_range(relocation_begin(), relocation_end());
}
+ bool relocation_empty() const;
section_iterator getRelocatedSection() const;
DataRefImpl getRawDataRefImpl() const;
@@ -259,6 +261,7 @@ protected:
bool &Result) const = 0;
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;
+ virtual bool section_rel_empty(DataRefImpl Sec) const = 0;
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
// Same as above for RelocationRef.
@@ -392,6 +395,10 @@ inline bool SectionRef::operator==(const SectionRef &Other) const {
return SectionPimpl == Other.SectionPimpl;
}
+inline bool SectionRef::operator!=(const SectionRef &Other) const {
+ return SectionPimpl != Other.SectionPimpl;
+}
+
inline bool SectionRef::operator<(const SectionRef &Other) const {
return SectionPimpl < Other.SectionPimpl;
}
@@ -461,6 +468,10 @@ inline relocation_iterator SectionRef::relocation_end() const {
return OwningObject->section_rel_end(SectionPimpl);
}
+inline bool SectionRef::relocation_empty() const {
+ return OwningObject->section_rel_empty(SectionPimpl);
+}
+
inline section_iterator SectionRef::getRelocatedSection() const {
return OwningObject->getRelocatedSection(SectionPimpl);
}
diff --git a/include/llvm/Object/SymbolicFile.h b/include/llvm/Object/SymbolicFile.h
index 8b94c49359..bead2c33ab 100644
--- a/include/llvm/Object/SymbolicFile.h
+++ b/include/llvm/Object/SymbolicFile.h
@@ -35,6 +35,10 @@ inline bool operator==(const DataRefImpl &a, const DataRefImpl &b) {
return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0;
}
+inline bool operator!=(const DataRefImpl &a, const DataRefImpl &b) {
+ return !operator==(a, b);
+}
+
inline bool operator<(const DataRefImpl &a, const DataRefImpl &b) {
// Check bitwise identical. This is the only legal way to compare a union w/o
// knowing which member is in use.