Skip to content

Added support for ARM_REL32 and GOT_PREL #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ void RuntimeDyldELF::resolveARMRelocation(const SectionEntry &Section,
*TargetPtr |= Value & 0xFFF;
*TargetPtr |= ((Value >> 12) & 0xF) << 16;
break;
case ELF::R_ARM_REL32:
*TargetPtr += Value - FinalAddress;
break;
// Write 24 bit relative value to the branch instruction.
case ELF::R_ARM_PC24: // Fall through.
case ELF::R_ARM_CALL: // Fall through.
Expand Down Expand Up @@ -1324,6 +1327,19 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
RelType, 0);
Section.advanceStubOffset(getMaxStubSize());
}
} else if (RelType == ELF::R_ARM_GOT_PREL) {
uint32_t GOTOffset = allocateGOTEntries(SectionID, 1);

RelocationEntry GOTRE(SectionID, Offset, ELF::R_ARM_REL32, GOTOffset);
addRelocationForSection(GOTRE, GOTSectionID);

// Fill in the value of the symbol we're targeting into the GOT
RelocationEntry RE = computeGOTOffsetRE(SectionID, GOTOffset,
Value.Offset, ELF::R_ARM_ABS32);
if (Value.SymbolName)
addRelocationForSymbol(RE, Value.SymbolName);
else
addRelocationForSection(RE, Value.SectionID);
} else {
uint32_t *Placeholder =
reinterpret_cast<uint32_t*>(computePlaceholderAddress(SectionID, Offset));
Expand Down