mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[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
This commit is contained in:
parent
d972bf8fab
commit
8018dd8b34
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user