diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-19 20:58:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-19 20:58:43 +0000 |
commit | 3dc0d05bf455ef75cd309a46be668966d692f4b5 (patch) | |
tree | 8dd6f3c5d0b23b4f4745e4155751240d3fd5e3a3 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h | |
parent | 90b05b52fa52c78aa10ef97359e859f3c2242734 (diff) | |
download | bcm5719-llvm-3dc0d05bf455ef75cd309a46be668966d692f4b5.tar.gz bcm5719-llvm-3dc0d05bf455ef75cd309a46be668966d692f4b5.zip |
Improve error handling of getRelocationAddend.
This patch changes getRelocationAddend to use ErrorOr and considers it an error
to try to get the addend of a REL section.
If, for example, a x86_64 file has a REL section, that file is corrupted and
we should reject it.
Using ErrorOr is not ideal since we check the section type once per relocation
instead of once per section.
Checking once per section would involve getRelocationAddend just asserting and
callers checking the section before iterating over the relocations.
In any case, this is an improvement and includes a test.
llvm-svn: 240176
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h index 3a377a2e162..1a2552deed9 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h @@ -87,10 +87,10 @@ class RuntimeDyldELF : public RuntimeDyldImpl { void setMipsABI(const ObjectFile &Obj) override; - void findPPC64TOCSection(const ObjectFile &Obj, + void findPPC64TOCSection(const ELFObjectFileBase &Obj, ObjSectionToIDMap &LocalSections, RelocationValueRef &Rel); - void findOPDEntrySection(const ObjectFile &Obj, + void findOPDEntrySection(const ELFObjectFileBase &Obj, ObjSectionToIDMap &LocalSections, RelocationValueRef &Rel); |