Exemple #1
0
/// Create - create a fragment reference for a given fragment.
///
/// @param pFrag - the given fragment
/// @param pOffset - the offset, can be larger than the fragment, but can not
///                  be larger than the section size.
/// @return if the offset is legal, return the fragment reference. Otherwise,
/// return NULL.
FragmentRef* FragmentRef::Create(Fragment& pFrag, uint64_t pOffset) {
  int64_t offset = pOffset;
  Fragment* frag = &pFrag;

  while (frag != NULL) {
    offset -= frag->size();
    if (offset <= 0)
      break;
    frag = frag->getNextNode();
  }
  if ((frag != NULL) && (frag->size() != 0)) {
    if (offset == 0)
      frag = frag->getNextNode();
    else
      offset += frag->size();
  }

  if (frag == NULL)
    return Null();

  FragmentRef* result = g_FragRefFactory->allocate();
  new (result) FragmentRef(*frag, offset);

  return result;
}
Exemple #2
0
LDSection* LDSection::Create(const std::string& pName,
                             LDFileFormat::Kind pKind,
                             uint32_t pType,
                             uint32_t pFlag,
                             uint64_t pSize,
                             uint64_t pAddr) {
  LDSection* result = g_SectFactory->allocate();
  new (result) LDSection(pName, pKind, pType, pFlag, pSize, pAddr);
  return result;
}
Exemple #3
0
IntOperand* IntOperand::create(uint64_t pValue) {
  IntOperand* result = g_IntOperandFactory->allocate();
  new (result) IntOperand(pValue);
  return result;
}
Exemple #4
0
SymOperand* SymOperand::create(const std::string& pName) {
  SymOperand* result = g_SymOperandFactory->allocate();
  new (result) SymOperand(pName);
  return result;
}
Exemple #5
0
FragOperand* FragOperand::create(Fragment& pFragment) {
  FragOperand* result = g_FragOperandFactory->allocate();
  new (result) FragOperand(pFragment);
  return result;
}
Exemple #6
0
SectDescOperand* SectDescOperand::create(
    const SectionMap::Output* pOutputDesc) {
  SectDescOperand* result = g_SectDescOperandFactory->allocate();
  new (result) SectDescOperand(pOutputDesc);
  return result;
}
Exemple #7
0
EhFrame* EhFrame::Create(LDSection& pSection)
{
  EhFrame* result = g_EhFrameFactory->allocate();
  new (result) EhFrame(pSection);
  return result;
}
Exemple #8
0
RelocData* RelocData::Create(LDSection& pSection) {
  RelocData* result = g_RelocDataFactory->allocate();
  new (result) RelocData(pSection);
  return result;
}
StringList* StringList::create() {
  StringList* result = g_StringListFactory->allocate();
  new (result) StringList();
  return result;
}
ELFSegment* ELFSegment::Create(uint32_t pType, uint32_t pFlag)
{
  ELFSegment* seg = g_ELFSegmentFactory->allocate();
  new (seg) ELFSegment(pType, pFlag);
  return seg;
}
Exemple #11
0
NameSpec* NameSpec::create(const std::string& pName, bool pAsNeeded) {
  NameSpec* result = g_NameSpecFactory->allocate();
  new (result) NameSpec(pName, pAsNeeded);
  return result;
}
RpnExpr* RpnExpr::create()
{
  RpnExpr* result = g_ExprFactory->allocate();
  new (result) RpnExpr();
  return result;
}
SectionData* SectionData::Create(LDSection& pSection) {
  SectionData* result = g_SectDataFactory->allocate();
  new (result) SectionData(pSection);
  return result;
}
Exemple #14
0
LDSymbol* LDSymbol::Create(ResolveInfo& pResolveInfo) {
  LDSymbol* result = g_LDSymbolFactory->allocate();
  new (result) LDSymbol();
  result->setResolveInfo(pResolveInfo);
  return result;
}
Exemple #15
0
StrToken* StrToken::create(const std::string& pString) {
  StrToken* result = g_StrTokenFactory->allocate();
  new (result) StrToken(String, pString);
  return result;
}