Merge LLVM commit c03fdd340356 to fix lang/rust on powerpc

Summary:
Without it building rust fails with:
ld: error: CallSiteSplitting.cpp:(function llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >::operator=(llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >&&): .text._ZN4llvm15SmallVectorImplINSt3__14pairIPNS_10BasicBlockENS_11SmallVectorINS2_IPNS_8ICmpInstEjEELj2EEEEEEaSEOSB_+0xB0): relocation R_PPC_PLTREL24 out of range: -33582208 is not in [-33554432, 33554431]

This will need to be merged to releng/13.1.

Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D34652
MFC after:	3 days
This commit is contained in:
Piotr Kubaj 2022-03-24 01:30:44 +01:00
parent 6ad638acd1
commit 9b597132ae

View File

@ -1966,7 +1966,8 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(InputSection *isec,
// out in the relocation addend. We compensate for the PC bias so that
// an Arm and Thumb relocation to the same destination get the same keyAddend,
// which is usually 0.
int64_t keyAddend = rel.addend + getPCBias(rel.type);
const int64_t pcBias = getPCBias(rel.type);
const int64_t keyAddend = rel.addend + pcBias;
// We use a ((section, offset), addend) pair to find the thunk position if
// possible so that we create only one thunk for aliased symbols or ICFed
@ -1985,7 +1986,7 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(InputSection *isec,
if (isThunkSectionCompatible(isec, t->getThunkTargetSym()->section) &&
t->isCompatibleWith(*isec, rel) &&
target->inBranchRange(rel.type, src,
t->getThunkTargetSym()->getVA(rel.addend)))
t->getThunkTargetSym()->getVA(-pcBias)))
return std::make_pair(t, false);
// No existing compatible Thunk in range, create a new one