forked from OSchip/llvm-project
ELF: Move copy relocation handler to one place. NFC.
llvm-svn: 259467
This commit is contained in:
parent
1ac1338ac8
commit
6d3874b995
|
@ -293,16 +293,23 @@ void Writer<ELFT>::scanRelocs(
|
|||
continue;
|
||||
}
|
||||
|
||||
// If a symbol in a DSO is referenced directly instead of through GOT,
|
||||
// we need to create a copy relocation for the symbol.
|
||||
if (auto *B = dyn_cast_or_null<SharedSymbol<ELFT>>(Body)) {
|
||||
if (B->NeedsCopy)
|
||||
continue;
|
||||
if (Target->needsCopyRel(Type, *B)) {
|
||||
B->NeedsCopy = true;
|
||||
B->setUsedInDynamicReloc();
|
||||
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool NeedsGot = false;
|
||||
bool NeedsPlt = false;
|
||||
|
||||
if (Body) {
|
||||
if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) {
|
||||
if (E->NeedsCopy)
|
||||
continue;
|
||||
if (Target->needsCopyRel(Type, *Body))
|
||||
E->NeedsCopy = true;
|
||||
}
|
||||
NeedsPlt = Target->needsPlt(Type, *Body);
|
||||
if (NeedsPlt) {
|
||||
if (Body->isInPlt())
|
||||
|
|
Loading…
Reference in New Issue