summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
commitefdbec8b0a49fb67c3844be703548fdc6c1dded0 (patch)
tree040894fc0c18d09dfdfec8693a253bcf998cb8c5 /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
parent6bf3966f7fd92217360877d1c04ea8ffe47c11cc (diff)
downloadllvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.gz
llvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.bz2
llvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.xz
Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 7f3a790d4b..4dbd6794c6 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -621,10 +621,8 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
RelocationValueRef &Rel) {
// Get the ELF symbol value (st_value) to compare with Relocation offset in
// .opd entries
-
- error_code err;
- for (section_iterator si = Obj.begin_sections(),
- se = Obj.end_sections(); si != se; si.increment(err)) {
+ for (section_iterator si = Obj.begin_sections(), se = Obj.end_sections();
+ si != se; ++si) {
section_iterator RelSecI = si->getRelocatedSection();
if (RelSecI == Obj.end_sections())
continue;
@@ -636,14 +634,12 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
for (relocation_iterator i = si->begin_relocations(),
e = si->end_relocations(); i != e;) {
- check(err);
-
// The R_PPC64_ADDR64 relocation indicates the first field
// of a .opd entry
uint64_t TypeFunc;
check(i->getType(TypeFunc));
if (TypeFunc != ELF::R_PPC64_ADDR64) {
- i.increment(err);
+ ++i;
continue;
}
@@ -653,10 +649,9 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
int64_t Addend;
check(getELFRelocationAddend(*i, Addend));
- i = i.increment(err);
+ ++i;
if (i == e)
break;
- check(err);
// Just check if following relocation is a R_PPC64_TOC
uint64_t TypeTOC;