summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-05-23 17:03:23 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-05-23 17:03:23 +0000
commitfe9fcb8af3917cb3de2197976ca9f754e9178d32 (patch)
tree11dc0704c356986cc3b3af85a0bd02a946b75aa9 /llvm/lib
parent8bf67fe98f2adb0ed381238c3f57911cab50a8c5 (diff)
downloadbcm5719-llvm-fe9fcb8af3917cb3de2197976ca9f754e9178d32.tar.gz
bcm5719-llvm-fe9fcb8af3917cb3de2197976ca9f754e9178d32.zip
[RuntimeDyld, PowerPC] Fix regression from r303637
Actually, to identify external symbols, we need to check for *either* non-null Value.SymbolName *or* a SymType of Symbol::ST_Unknown. The former may happen for symbols not known to the JIT at all (e.g. defined in a native library), while the latter happens for symbols known to the JIT, but defined in a different module. Fixed several regressions on big-endian ppc64. llvm-svn: 303655
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 777db30dd53..9ce3974529b 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -1324,12 +1324,13 @@ RuntimeDyldELF::processRelocationRef(
Obj.getPlatformFlags(AbiVariant);
AbiVariant &= ELF::EF_PPC64_ABI;
// A PPC branch relocation will need a stub function if the target is
- // an external symbol (Value.SymbolName set) or if the target address
- // is not within the signed 24-bits branch address.
+ // an external symbol (either Value.SymbolName is set, or SymType is
+ // Symbol::ST_Unknown) or if the target address is not within the
+ // signed 24-bits branch address.
SectionEntry &Section = Sections[SectionID];
uint8_t *Target = Section.getAddressWithOffset(Offset);
bool RangeOverflow = false;
- if (!Value.SymbolName) {
+ if (!Value.SymbolName && SymType != SymbolRef::ST_Unknown) {
if (AbiVariant != 2) {
// In the ELFv1 ABI, a function call may point to the .opd entry,
// so the final symbol value is calculated based on the relocation
@@ -1353,9 +1354,10 @@ RuntimeDyldELF::processRelocationRef(
RangeOverflow = true;
}
}
- if (Value.SymbolName || RangeOverflow) {
- // It is an external symbol (SymbolRef::ST_Unknown) or within a range
- // larger than 24-bits.
+ if (Value.SymbolName || SymType == SymbolRef::ST_Unknown ||
+ RangeOverflow) {
+ // It is an external symbol (either Value.SymbolName is set, or
+ // SymType is SymbolRef::ST_Unknown) or out of range.
StubMap::const_iterator i = Stubs.find(Value);
if (i != Stubs.end()) {
// Symbol function stub already created, just relocate to it
@@ -1409,7 +1411,7 @@ RuntimeDyldELF::processRelocationRef(
RelType, 0);
Section.advanceStubOffset(getMaxStubSize());
}
- if (Value.SymbolName) {
+ if (Value.SymbolName || SymType == SymbolRef::ST_Unknown) {
// Restore the TOC for external calls
if (AbiVariant == 2)
writeInt32BE(Target + 4, 0xE8410018); // ld r2,28(r1)
OpenPOWER on IntegriCloud