本文整理汇总了C++中LDSection::hasRelocData方法的典型用法代码示例。如果您正苦于以下问题:C++ LDSection::hasRelocData方法的具体用法?C++ LDSection::hasRelocData怎么用?C++ LDSection::hasRelocData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LDSection
的用法示例。
在下文中一共展示了LDSection::hasRelocData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/// emitSectionData
void
ELFObjectWriter::emitSectionData(const LDSection& pSection,
MemoryRegion& pRegion) const
{
const SectionData* sd = NULL;
switch (pSection.kind()) {
case LDFileFormat::Relocation:
assert(pSection.hasRelocData());
return;
case LDFileFormat::EhFrame:
assert(pSection.hasEhFrame());
sd = pSection.getEhFrame()->getSectionData();
break;
default:
assert(pSection.hasSectionData());
sd = pSection.getSectionData();
break;
}
emitSectionData(*sd, pRegion);
}
示例2: doRelax
bool MipsGNULDBackend::doRelax(Module& pModule,
IRBuilder& pBuilder,
bool& pFinished) {
assert(getStubFactory() != NULL && getBRIslandFactory() != NULL);
bool isRelaxed = false;
for (Module::obj_iterator input = pModule.obj_begin();
input != pModule.obj_end();
++input) {
LDContext* context = (*input)->context();
for (LDContext::sect_iterator rs = context->relocSectBegin();
rs != context->relocSectEnd();
++rs) {
LDSection* sec = *rs;
if (LDFileFormat::Ignore == sec->kind() || !sec->hasRelocData())
continue;
for (RelocData::iterator reloc = sec->getRelocData()->begin();
reloc != sec->getRelocData()->end();
++reloc) {
if (llvm::ELF::R_MIPS_26 != reloc->type())
continue;
if (relaxRelocation(pBuilder, *llvm::cast<Relocation>(reloc)))
isRelaxed = true;
}
}
}
SectionData* textData = getOutputFormat()->getText().getSectionData();
// find the first fragment w/ invalid offset due to stub insertion
Fragment* invalid = NULL;
pFinished = true;
for (BranchIslandFactory::iterator ii = getBRIslandFactory()->begin(),
ie = getBRIslandFactory()->end();
ii != ie;
++ii) {
BranchIsland& island = *ii;
if (island.end() == textData->end())
break;
Fragment* exit = island.end();
if ((island.offset() + island.size()) > exit->getOffset()) {
invalid = exit;
pFinished = false;
break;
}
}
// reset the offset of invalid fragments
while (invalid != NULL) {
invalid->setOffset(invalid->getPrevNode()->getOffset() +
invalid->getPrevNode()->size());
invalid = invalid->getNextNode();
}
// reset the size of .text
if (isRelaxed)
getOutputFormat()->getText().setSize(textData->back().getOffset() +
textData->back().size());
return isRelaxed;
}