Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lld/ELF/Thunks.cpp
Show First 20 Lines • Show All 536 Lines • ▼ Show 20 Lines | bool ARMThunk::isCompatibleWith(const InputSection &isec, | ||||||||
// v4T does not have BLX, so also deny R_ARM_THM_CALL | // v4T does not have BLX, so also deny R_ARM_THM_CALL | ||||||||
if (!config->armHasBlx && rel.type == R_ARM_THM_CALL) | if (!config->armHasBlx && rel.type == R_ARM_THM_CALL) | ||||||||
return false; | return false; | ||||||||
// Thumb branch relocations can't use BLX | // Thumb branch relocations can't use BLX | ||||||||
return rel.type != R_ARM_THM_JUMP19 && rel.type != R_ARM_THM_JUMP24; | return rel.type != R_ARM_THM_JUMP19 && rel.type != R_ARM_THM_JUMP24; | ||||||||
} | } | ||||||||
// This function returns true if the target is Thumb and is within 2^25, and | // This function returns true if: | ||||||||
// it has not previously returned false (see comment for mayUseShortThunk). | // the target is Thumb | ||||||||
// && is within branch range | |||||||||
MaskRayUnsubmitted Done ReplyInline Actions
MaskRay: | |||||||||
// && this function has not previously returned false | |||||||||
// (see comment for mayUseShortThunk) | |||||||||
// && the arch supports Thumb branch range extension. | |||||||||
MaskRay: | |||||||||
bool ThumbThunk::getMayUseShortThunk() { | bool ThumbThunk::getMayUseShortThunk() { | ||||||||
if (!mayUseShortThunk) | if (!mayUseShortThunk || !config->armJ1J2BranchEncoding) | ||||||||
return false; | return false; | ||||||||
uint64_t s = getARMThunkDestVA(destination); | uint64_t s = getARMThunkDestVA(destination); | ||||||||
if ((s & 1) == 0) { | if ((s & 1) == 0) { | ||||||||
mayUseShortThunk = false; | mayUseShortThunk = false; | ||||||||
return false; | return false; | ||||||||
} | } | ||||||||
uint64_t p = getThunkTargetSym()->getVA() & ~1; | uint64_t p = getThunkTargetSym()->getVA() & ~1; | ||||||||
int64_t offset = s - p - 4; | int64_t offset = s - p - 4; | ||||||||
▲ Show 20 Lines • Show All 760 Lines • Show Last 20 Lines |