本文整理汇总了C++中SymbolBody::setUsedInDynamicReloc方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolBody::setUsedInDynamicReloc方法的具体用法?C++ SymbolBody::setUsedInDynamicReloc怎么用?C++ SymbolBody::setUsedInDynamicReloc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolBody
的用法示例。
在下文中一共展示了SymbolBody::setUsedInDynamicReloc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canBePreempted
void Writer<ELFT>::scanRelocs(
InputSectionBase<ELFT> &C,
iterator_range<const Elf_Rel_Impl<ELFT, isRela> *> Rels) {
typedef Elf_Rel_Impl<ELFT, isRela> RelType;
const ObjectFile<ELFT> &File = *C.getFile();
for (const RelType &RI : Rels) {
uint32_t SymIndex = RI.getSymbol(Config->Mips64EL);
SymbolBody *Body = File.getSymbolBody(SymIndex);
uint32_t Type = RI.getType(Config->Mips64EL);
if (Target->isTlsLocalDynamicReloc(Type)) {
if (Target->isTlsOptimized(Type, nullptr))
continue;
if (Out<ELFT>::LocalModuleTlsIndexOffset == uint32_t(-1)) {
Out<ELFT>::LocalModuleTlsIndexOffset =
Out<ELFT>::Got->addLocalModuleTlsIndex();
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
}
continue;
}
// Set "used" bit for --as-needed.
if (Body && Body->isUndefined() && !Body->isWeak())
if (auto *S = dyn_cast<SharedSymbol<ELFT>>(Body->repl()))
S->File->IsUsed = true;
if (Body)
Body = Body->repl();
if (Body && Body->isTLS() && Target->isTlsGlobalDynamicReloc(Type)) {
if (Target->isTlsOptimized(Type, Body))
continue;
if (Body->isInGot())
continue;
Out<ELFT>::Got->addDynTlsEntry(Body);
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
Out<ELFT>::RelaDyn->addReloc({nullptr, nullptr});
Body->setUsedInDynamicReloc();
continue;
}
if (Body && Body->isTLS() && !Target->isTlsDynReloc(Type))
continue;
bool NeedsGot = false;
bool NeedsPlt = false;
if (Body) {
if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) {
if (E->needsCopy())
continue;
if (Target->relocNeedsCopy(Type, *Body))
E->OffsetInBSS = 0;
}
NeedsPlt = Target->relocNeedsPlt(Type, *Body);
if (NeedsPlt) {
if (Body->isInPlt())
continue;
Out<ELFT>::Plt->addEntry(Body);
}
NeedsGot = Target->relocNeedsGot(Type, *Body);
if (NeedsGot) {
if (NeedsPlt && Target->supportsLazyRelocations()) {
Out<ELFT>::GotPlt->addEntry(Body);
} else {
if (Body->isInGot())
continue;
Out<ELFT>::Got->addEntry(Body);
}
}
}
if (Config->EMachine == EM_MIPS && NeedsGot) {
// MIPS ABI has special rules to process GOT entries
// and doesn't require relocation entries for them.
// See "Global Offset Table" in Chapter 5 in the following document
// for detailed description:
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
Body->setUsedInDynamicReloc();
continue;
}
bool CBP = canBePreempted(Body, NeedsGot);
if (!CBP && (!Config->Shared || Target->isRelRelative(Type)))
continue;
if (CBP)
Body->setUsedInDynamicReloc();
if (NeedsPlt && Target->supportsLazyRelocations())
Out<ELFT>::RelaPlt->addReloc({&C, &RI});
else
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
}
}