本文整理汇总了C++中LDSymbol::binding方法的典型用法代码示例。如果您正苦于以下问题:C++ LDSymbol::binding方法的具体用法?C++ LDSymbol::binding怎么用?C++ LDSymbol::binding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LDSymbol
的用法示例。
在下文中一共展示了LDSymbol::binding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void IdenticalCodeFolding::FoldingCandidate::initConstantContent(
const TargetLDBackend& pBackend,
const IdenticalCodeFolding::KeptSections& pKeptSections) {
// Get the static content from text.
assert(sect != NULL && sect->hasSectionData());
SectionData::const_iterator frag, fragEnd = sect->getSectionData()->end();
for (frag = sect->getSectionData()->begin(); frag != fragEnd; ++frag) {
switch (frag->getKind()) {
case Fragment::Region: {
const RegionFragment& region = llvm::cast<RegionFragment>(*frag);
content.append(region.getRegion().begin(), region.size());
break;
}
default: {
// FIXME: Currently we only take care of RegionFragment.
break;
}
}
}
// Get the static content from relocs.
if (reloc_sect != NULL && reloc_sect->hasRelocData()) {
for (Relocation& rel : *reloc_sect->getRelocData()) {
llvm::format_object<Relocation::Type,
Relocation::Address,
Relocation::Address,
Relocation::Address> rel_info("%x%llx%llx%llx",
rel.type(),
rel.symValue(),
rel.addend(),
rel.place());
char rel_str[48];
rel_info.print(rel_str, sizeof(rel_str));
content.append(rel_str);
// Handle the recursive call.
LDSymbol* sym = rel.symInfo()->outSymbol();
if ((sym->type() == ResolveInfo::Function) && sym->hasFragRef()) {
LDSection* def = &sym->fragRef()->frag()->getParent()->getSection();
if (def == sect) {
continue;
}
}
if (!pBackend.isSymbolPreemptible(*rel.symInfo()) && sym->hasFragRef() &&
(pKeptSections.find(
&sym->fragRef()->frag()->getParent()->getSection()) !=
pKeptSections.end())) {
// Mark this reloc as a variable.
variable_relocs.push_back(&rel);
} else {
// TODO: Support inlining merge sections if possible (target-dependent).
if ((sym->binding() == ResolveInfo::Local) ||
(sym->binding() == ResolveInfo::Absolute)) {
// ABS or Local symbols.
content.append(sym->name()).append(obj->name()).append(
obj->path().native());
} else {
content.append(sym->name());
}
}
}
}
}