summaryrefslogtreecommitdiffstats
path: root/include/llvm/Object/RelocVisitor.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/RelocVisitor.h')
-rw-r--r--include/llvm/Object/RelocVisitor.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/include/llvm/Object/RelocVisitor.h b/include/llvm/Object/RelocVisitor.h
index 2dcbdf9..6239ec1 100644
--- a/include/llvm/Object/RelocVisitor.h
+++ b/include/llvm/Object/RelocVisitor.h
@@ -102,6 +102,16 @@ public:
HasError = true;
return RelocToApply();
}
+ } else if (FileFormat == "ELF64-s390") {
+ switch (RelocType) {
+ case llvm::ELF::R_390_32:
+ return visitELF_390_32(R, Value);
+ case llvm::ELF::R_390_64:
+ return visitELF_390_64(R, Value);
+ default:
+ HasError = true;
+ return RelocToApply();
+ }
}
HasError = true;
return RelocToApply();
@@ -133,7 +143,7 @@ private:
int64_t Addend;
R.getAdditionalInfo(Addend);
uint64_t Address;
- R.getAddress(Address);
+ R.getOffset(Address);
return RelocToApply(Value + Addend - Address, 4);
}
@@ -151,7 +161,7 @@ private:
int64_t Addend;
R.getAdditionalInfo(Addend);
uint64_t Address;
- R.getAddress(Address);
+ R.getOffset(Address);
return RelocToApply(Value + Addend - Address, 4);
}
RelocToApply visitELF_X86_64_32(RelocationRef R, uint64_t Value) {
@@ -202,6 +212,24 @@ private:
return RelocToApply(Value + Addend, 8);
}
+ // SystemZ ELF
+ RelocToApply visitELF_390_32(RelocationRef R, uint64_t Value) {
+ int64_t Addend;
+ R.getAdditionalInfo(Addend);
+ int64_t Res = Value + Addend;
+
+ // Overflow check allows for both signed and unsigned interpretation.
+ if (Res < INT32_MIN || Res > UINT32_MAX)
+ HasError = true;
+
+ return RelocToApply(static_cast<uint32_t>(Res), 4);
+ }
+
+ RelocToApply visitELF_390_64(RelocationRef R, uint64_t Value) {
+ int64_t Addend;
+ R.getAdditionalInfo(Addend);
+ return RelocToApply(Value + Addend, 8);
+ }
};
}
OpenPOWER on IntegriCloud