Dyninst::SymtabAPI::emitElfStatic Class Reference

#include <emitElfStatic.h>

Public Types

enum  StaticLinkError {
  No_Static_Link_Error, Link_Location_Error, Symbol_Resolution_Failure, Relocation_Computation_Failure,
  Storage_Allocation_Failure
}

Public Member Functions

 emitElfStatic (unsigned addressWidth, bool isStripped)
char * linkStatic (Symtab *target, StaticLinkError &err, string &errMsg)
bool resolveSymbols (Symtab *target, vector< Symtab * > &relocatableObjects, LinkMap &lmap, StaticLinkError &err, string &errMsg)
bool createLinkMap (Symtab *target, vector< Symtab * > &relocatableObjects, Offset &globalOffset, LinkMap &lmap, StaticLinkError &err, string &errMsg)
Offset layoutRegions (deque< Region * > &regions, map< Region *, LinkMap::AllocPair > &regionAllocs, Offset currentOffset, Offset globalOffset)
Offset allocStubRegions (LinkMap &lmap, Offset globalOffset)
bool addNewRegions (Symtab *target, Offset globalOffset, LinkMap &lmap)
void copyRegions (LinkMap &lmap)
bool applyRelocations (Symtab *target, vector< Symtab * > &relocatableObjects, Offset globalOffset, LinkMap &lmap, StaticLinkError &err, string &errMsg)
bool buildPLT (Symtab *target, Offset globalOffset, LinkMap &lmap, StaticLinkError &err, string &errMsg)
bool buildRela (Symtab *target, Offset globalOffset, LinkMap &lmap, StaticLinkError &err, string &errMsg)
bool hasRewrittenTLS () const

Static Public Member Functions

static std::string printStaticLinkError (StaticLinkError)

Private Types

typedef boost::tuple< Offset,
Offset, Offset
TOCstub

Private Member Functions

Offset computePadding (Offset candidateOffset, Offset alignment)
char getPaddingValue (Region::RegionType rtype)
bool archSpecificRelocation (Symtab *targetSymtab, Symtab *srcSymtab, char *targetData, relocationEntry &rel, Offset dest, Offset relOffset, Offset globalOffset, LinkMap &lmap, string &errMsg)
bool handleInterModuleSpecialCase (Symtab *target, Symtab *src, LinkMap &lmap, char *data, relocationEntry rel, Offset newTOC, Offset oldTOC, Offset dest, Offset relOffset, Offset globalOffset)
Offset findOrCreateStub (Symbol *sym, LinkMap &lmap, Offset newTOC, Offset oldTOC, char *data, Offset global)
void createStub (unsigned *stub, Offset stubOffset, Offset newTOC, Offset oldTOC, Offset dest)
Offset layoutTLSImage (Offset globalOffset, Region *dataTLS, Region *bssTLS, LinkMap &lmap)
Offset tlsLayoutVariant1 (Offset globalOffset, Region *dataTLS, Region *bssTLS, LinkMap &lmap)
Offset tlsLayoutVariant2 (Offset globalOffset, Region *dataTLS, Region *bssTLS, LinkMap &lmap)
Offset adjustTLSOffset (Offset curOffset, Offset tlsSize)
Offset tlsAdjustVariant2 (Offset curOffset, Offset tlsSize)
void cleanupTLSRegionOffsets (map< Region *, LinkMap::AllocPair > &regionAllocs, Region *dataTLS, Region *bssTLS)
void tlsCleanupVariant1 (map< Region *, LinkMap::AllocPair > &regionAllocs, Region *dataTLS, Region *bssTLS)
void tlsCleanupVariant2 (map< Region *, LinkMap::AllocPair > &regionAllocs, Region *dataTLS, Region *bssTLS)
bool isGOTRelocation (unsigned long relType)
void buildGOT (Symtab *target, LinkMap &lmap)
Offset getGOTSize (Symtab *target, LinkMap &lmap, Offset &layoutStart)
Offset getGOTAlign (LinkMap &lmap)
bool isConstructorRegion (Region *reg)
Offset layoutNewCtorRegion (LinkMap &lmap)
bool createNewCtorRegion (LinkMap &lmap)
bool isDestructorRegion (Region *reg)
bool isGOTRegion (Region *reg)
Offset layoutNewDtorRegion (LinkMap &lmap)
bool createNewDtorRegion (LinkMap &lmap)
void getExcludedSymbolNames (std::set< std::string > &symNames)
bool checkSpecialCaseSymbols (Symtab *member, Symbol *checkSym)
bool calculateTOCs (Symtab *target, deque< Region * > &regions, Offset GOTbase, Offset newGOToffset, Offset globalOffset)
Offset allocatePLTEntries (std::map< Symbol *, std::pair< Offset, Offset > > &entries, Offset pltOffset, Offset &size)
Offset allocateRelocationSection (std::map< Symbol *, std::pair< Offset, Offset > > &entries, Offset relocOffset, Offset &size, Symtab *target)
Offset allocateRelGOTSection (const std::map< Symbol *, std::pair< Offset, Offset > > &entries, Offset relocOffset, Offset &size)
bool addIndirectSymbol (Symbol *sym, LinkMap &lmap)
bool updateTOC (Symtab *file, LinkMap &lmap, Offset globalOffset)
Offset getStubOffset (TOCstub &t)
Offset getNewTOC (TOCstub &t)
Offset getOldTOC (TOCstub &t)

Private Attributes

unsigned addressWidth_
bool isStripped_
bool hasRewrittenTLS_
std::map< Symbol *, TOCstubstubMap

Detailed Description

Definition at line 86 of file emitElfStatic.h.


Member Typedef Documentation

Definition at line 399 of file emitElfStatic.h.


Member Enumeration Documentation

Enumerator:
No_Static_Link_Error 
Link_Location_Error 
Symbol_Resolution_Failure 
Relocation_Computation_Failure 
Storage_Allocation_Failure 

Definition at line 91 of file emitElfStatic.h.


Constructor & Destructor Documentation

emitElfStatic::emitElfStatic ( unsigned  addressWidth,
bool  isStripped 
)

Definition at line 80 of file emitElfStatic.C.


Member Function Documentation

bool emitElfStatic::addIndirectSymbol ( Symbol sym,
LinkMap lmap 
) [private]

Definition at line 1746 of file emitElfStatic.C.

References Dyninst::SymtabAPI::LinkMap::pltEntries.

Referenced by resolveSymbols().

bool emitElfStatic::addNewRegions ( Symtab target,
Offset  globalOffset,
LinkMap lmap 
)

Definition at line 1035 of file emitElfStatic.C.

References Dyninst::SymtabAPI::Symtab::addRegion(), Dyninst::SymtabAPI::LinkMap::allocatedData, BSS_NAME, Dyninst::SymtabAPI::LinkMap::bssRegionAlign, Dyninst::SymtabAPI::LinkMap::bssRegionOffset, Dyninst::SymtabAPI::LinkMap::bssSize, buildGOT(), CODE_NAME(), Dyninst::SymtabAPI::LinkMap::codeRegionAlign, Dyninst::SymtabAPI::LinkMap::codeRegionOffset, Dyninst::SymtabAPI::LinkMap::codeSize, createNewCtorRegion(), createNewDtorRegion(), CTOR_NAME(), Dyninst::SymtabAPI::LinkMap::ctorRegionAlign, Dyninst::SymtabAPI::LinkMap::ctorRegionOffset, Dyninst::SymtabAPI::LinkMap::ctorSize, DATA_NAME, Dyninst::SymtabAPI::LinkMap::dataRegionAlign, Dyninst::SymtabAPI::LinkMap::dataRegionOffset, Dyninst::SymtabAPI::LinkMap::dataSize, DTOR_NAME(), Dyninst::SymtabAPI::LinkMap::dtorRegionAlign, Dyninst::SymtabAPI::LinkMap::dtorRegionOffset, Dyninst::SymtabAPI::LinkMap::dtorSize, GOT_NAME, Dyninst::SymtabAPI::LinkMap::gotRegionAlign, Dyninst::SymtabAPI::LinkMap::gotRegionOffset, Dyninst::SymtabAPI::LinkMap::gotSize, Dyninst::SymtabAPI::LinkMap::newCtorRegions, Dyninst::SymtabAPI::LinkMap::newDtorRegions, PLT_NAME, Dyninst::SymtabAPI::LinkMap::pltRegionAlign, Dyninst::SymtabAPI::LinkMap::pltRegionOffset, Dyninst::SymtabAPI::LinkMap::pltSize, REL_GOT_NAME(), REL_NAME(), Dyninst::SymtabAPI::LinkMap::relGotRegionAlign, Dyninst::SymtabAPI::LinkMap::relGotRegionOffset, Dyninst::SymtabAPI::LinkMap::relGotSize, Dyninst::SymtabAPI::LinkMap::relRegionAlign, Dyninst::SymtabAPI::LinkMap::relRegionOffset, Dyninst::SymtabAPI::LinkMap::relSize, Dyninst::SymtabAPI::Region::RT_BSS, Dyninst::SymtabAPI::Region::RT_DATA, Dyninst::SymtabAPI::Region::RT_RELA, Dyninst::SymtabAPI::Region::RT_TEXTDATA, STUB_NAME(), Dyninst::SymtabAPI::LinkMap::stubRegionOffset, Dyninst::SymtabAPI::LinkMap::stubSize, TLS_DATA_NAME(), Dyninst::SymtabAPI::LinkMap::tlsRegionAlign, Dyninst::SymtabAPI::LinkMap::tlsRegionOffset, and Dyninst::SymtabAPI::LinkMap::tlsSize.

Referenced by linkStatic().

Offset emitElfStatic::adjustTLSOffset ( Offset  curOffset,
Offset  tlsSize 
) [private]

Architecture specific

Updates the TLS offset of a Symbol, given the size of the new TLS initialization image.

curOffset The current offset of the TLS symbol tlsSize The size of the new TLS initialization image

Returns the adjusted offset

Definition at line 476 of file emitElfStatic-ppc32.C.

Referenced by createLinkMap().

Offset emitElfStatic::allocatePLTEntries ( std::map< Symbol *, std::pair< Offset, Offset > > &  entries,
Offset  pltOffset,
Offset size 
) [private]

Somewhat architecture specific

Allocate PLT entries for each INDIRECT-typed symbol Each PLT entry has an arch-specific size

Definition at line 1719 of file emitElfStatic.C.

Referenced by createLinkMap().

Offset emitElfStatic::allocateRelGOTSection ( const std::map< Symbol *, std::pair< Offset, Offset > > &  entries,
Offset  relocOffset,
Offset size 
) [private]

Definition at line 1812 of file emitElfStatic.C.

Referenced by createLinkMap().

Offset emitElfStatic::allocateRelocationSection ( std::map< Symbol *, std::pair< Offset, Offset > > &  entries,
Offset  relocOffset,
Offset size,
Symtab target 
) [private]

Aaand... architecture specific. Generate a new relocation section that combines relocs from any indirect symbols with original relocs

Definition at line 1786 of file emitElfStatic.C.

References Dyninst::SymtabAPI::Symtab::findRegion(), Dyninst::SymtabAPI::Symtab::getObject(), and Dyninst::SymtabAPI::Region::getRelocations().

Referenced by createLinkMap().

Offset emitElfStatic::allocStubRegions ( LinkMap lmap,
Offset  globalOffset 
)

Definition at line 691 of file emitElfStatic-ppc32.C.

References Dyninst::SymtabAPI::LinkMap::stubRegionOffset.

Referenced by createLinkMap().

bool emitElfStatic::applyRelocations ( Symtab target,
vector< Symtab * > &  relocatableObjects,
Offset  globalOffset,
LinkMap lmap,
StaticLinkError err,
string &  errMsg 
)

Given a collection of newly allocated regions in the specified storage space, computes relocations and places the values at the location specified by the relocation entry (stored with the Regions)

target The Symtab object being rewritten relocatableObjects A list of relocatable files being linked into target globalOffset The location of the new storage space in target lmap Contains all the information necessary to apply relocations

Definition at line 1182 of file emitElfStatic.C.

References Dyninst::SymtabAPI::LinkMap::allocatedData, archSpecificRelocation(), Dyninst::SymtabAPI::Symtab::getAllRegions(), Dyninst::SymtabAPI::LinkMap::regionAllocs, Relocation_Computation_Failure, rewrite_printf(), and Dyninst::SymtabAPI::Region::RT_TEXT.

Referenced by linkStatic().

bool emitElfStatic::archSpecificRelocation ( Symtab targetSymtab,
Symtab srcSymtab,
char *  targetData,
relocationEntry rel,
Offset  dest,
Offset  relOffset,
Offset  globalOffset,
LinkMap lmap,
string &  errMsg 
) [private]

Architecture specific

Calculates a relocation and applies it to the specified location in the target.

targetData The target buffer rel The relocation entry dest The offset in the target buffer relOffset The absolute offset of the relocation globalOffset The absolute offset of the newly linked code lmap Holds information necessary to compute relocation

Returns true, on success; false, otherwise and sets errMsg

Definition at line 138 of file emitElfStatic-ppc32.C.

References Dyninst::SymtabAPI::relocationEntry::addend(), addressWidth_, computeCtorDtorAddress(), Dyninst::SymtabAPI::relocationEntry::getDynSym(), Dyninst::SymtabAPI::Symbol::getOffset(), Dyninst::SymtabAPI::relocationEntry::getRelType(), Dyninst::SymtabAPI::LinkMap::gotSymbols, Dyninst::SymtabAPI::relocationEntry::name(), PPC32_WIDTH, Dyninst::SymtabAPI::relocationEntry::regionType(), Dyninst::SymtabAPI::relocationEntry::relType2Str(), rewrite_printf(), Dyninst::SymtabAPI::Region::RT_REL, Dyninst::SymtabAPI::Region::RT_RELA, setBits(), and UNKNOWN_ADDRESS_WIDTH_ASSERT.

Referenced by applyRelocations().

void emitElfStatic::buildGOT ( Symtab target,
LinkMap lmap 
) [private]

Architecture specific

Constructions a new GOT Region from information in the LinkMap

Definition at line 685 of file emitElfStatic-ppc32.C.

Referenced by addNewRegions().

bool emitElfStatic::buildPLT ( Symtab target,
Offset  globalOffset,
LinkMap lmap,
StaticLinkError err,
string &  errMsg 
)
bool emitElfStatic::buildRela ( Symtab target,
Offset  globalOffset,
LinkMap lmap,
StaticLinkError err,
string &  errMsg 
)
bool emitElfStatic::calculateTOCs ( Symtab target,
deque< Region * > &  regions,
Offset  GOTbase,
Offset  newGOToffset,
Offset  globalOffset 
) [private]

More with the architecture specific

Calculate new TOC values if we care (PPC64)

Definition at line 1686 of file emitElfStatic.C.

References Dyninst::SymtabAPI::Region::getDiskSize(), Dyninst::SymtabAPI::Symtab::getTOCoffset(), rewrite_printf(), Dyninst::SymtabAPI::Symtab::setTOCOffset(), and Dyninst::SymtabAPI::Region::symtab().

Referenced by createLinkMap().

bool emitElfStatic::checkSpecialCaseSymbols ( Symtab member,
Symbol checkSym 
) [private]

Architecture specific

Checks if the specified symbol satisfies a special case that is currently not handled by emitElfStatic.

member The reloctable object to examine checkSym The symbol to check

Returns false if the symbol satisfies a special case

Definition at line 466 of file emitElfStatic-ppc32.C.

Referenced by resolveSymbols().

void emitElfStatic::cleanupTLSRegionOffsets ( map< Region *, LinkMap::AllocPair > &  regionAllocs,
Region dataTLS,
Region bssTLS 
) [private]

Architecture specific

In order to simplify the creation of a new TLS initialization image, some cleanup work may be necessary after the new TLS initialization image is created.

regionAllocs The map of Regions to their place in the newly linked code dataTLS The original TLS data section from the target (can be NULL) bssTLS The original TLS bss section from the target (can be NULL)

Definition at line 486 of file emitElfStatic-ppc32.C.

References tlsCleanupVariant2().

Referenced by createLinkMap().

Offset emitElfStatic::computePadding ( Offset  candidateOffset,
Offset  alignment 
) [inline, private]

Computes the padding necessary to satisfy the specified alignment

candidateOffset A possible offset for an item alignment The alignment for an item

Definition at line 1164 of file emitElfStatic.C.

Referenced by createLinkMap(), and layoutRegions().

void emitElfStatic::copyRegions ( LinkMap lmap  ) 

Copys the new Regions, as indicated by the LinkMap, into the allocated storage space

lmap Contains all the information necessary to perform the copy

Definition at line 1136 of file emitElfStatic.C.

References Dyninst::SymtabAPI::LinkMap::allocatedData, Dyninst::SymtabAPI::Region::getMemSize(), getPaddingValue(), Dyninst::SymtabAPI::Region::getPtrToRawData(), Dyninst::SymtabAPI::Region::getRegionType(), Dyninst::SymtabAPI::Region::isBSS(), and Dyninst::SymtabAPI::LinkMap::regionAllocs.

Referenced by createLinkMap().

bool emitElfStatic::createLinkMap ( Symtab target,
vector< Symtab * > &  relocatableObjects,
Offset globalOffset,
LinkMap lmap,
StaticLinkError err,
string &  errMsg 
)

Given a collection of Symtab objects, combines the code, data, bss and other miscellaneous Regions into groups and places them in a new block of data.

Allocates COMMON symbols in the collection of Symtab objects as bss

Creates a new TLS initialization image, combining the target image and the image that exists in the collection of Symtab objects

Creates a GOT used for indirect memory accesses that is required by some relocations

Creates a new global constructor and/or destructor table if necessary, combining tables from the target and collection of Symtab objects

target New code/data/etc. will be linked into this Symtab relocatableObjects The new code/data/etc. globalOffset The location of the new block of data in the target lmap The LinkMap to be populated by this function

Definition at line 466 of file emitElfStatic.C.

References adjustTLSOffset(), Dyninst::SymtabAPI::LinkMap::allocatedData, Dyninst::SymtabAPI::LinkMap::allocatedSize, allocatePLTEntries(), allocateRelGOTSection(), allocateRelocationSection(), allocStubRegions(), Dyninst::SymtabAPI::LinkMap::bssRegionAlign, Dyninst::SymtabAPI::LinkMap::bssRegionOffset, Dyninst::SymtabAPI::LinkMap::bssRegions, Dyninst::SymtabAPI::LinkMap::bssSize, calculateTOCs(), cleanupTLSRegionOffsets(), Dyninst::SymtabAPI::LinkMap::codeRegionAlign, Dyninst::SymtabAPI::LinkMap::codeRegionOffset, Dyninst::SymtabAPI::LinkMap::codeRegions, Dyninst::SymtabAPI::LinkMap::codeSize, Dyninst::SymtabAPI::LinkMap::commonStorage, computePadding(), copyRegions(), Dyninst::SymtabAPI::Region::createRegion(), Dyninst::SymtabAPI::LinkMap::ctorRegionAlign, Dyninst::SymtabAPI::LinkMap::ctorRegionOffset, Dyninst::SymtabAPI::LinkMap::ctorSize, Dyninst::SymtabAPI::LinkMap::dataRegionAlign, Dyninst::SymtabAPI::LinkMap::dataRegionOffset, Dyninst::SymtabAPI::LinkMap::dataRegions, Dyninst::SymtabAPI::LinkMap::dataSize, DEFAULT_COM_NAME(), Dyninst::SymtabAPI::LinkMap::dtorRegionAlign, Dyninst::SymtabAPI::LinkMap::dtorRegionOffset, Dyninst::SymtabAPI::LinkMap::dtorSize, Dyninst::SymtabAPI::Symtab::getAllDefinedSymbols(), Dyninst::SymtabAPI::Symtab::getAllRegions(), getGOTAlign(), getGOTSize(), Dyninst::SymtabAPI::Region::getMemAlignment(), Dyninst::SymtabAPI::Region::getMemSize(), Dyninst::SymtabAPI::LinkMap::gotRegionAlign, Dyninst::SymtabAPI::LinkMap::gotRegionOffset, Dyninst::SymtabAPI::LinkMap::gotRegions, Dyninst::SymtabAPI::LinkMap::gotSize, Dyninst::SymtabAPI::LinkMap::gotSymbols, Dyninst::SymtabAPI::LinkMap::gotSymbolTable, hasRewrittenTLS_, isConstructorRegion(), isDestructorRegion(), isGOTRegion(), isGOTRelocation(), Dyninst::SymtabAPI::Symtab::isStaticBinary(), layoutNewCtorRegion(), layoutNewDtorRegion(), layoutRegions(), layoutTLSImage(), Dyninst::SymtabAPI::LinkMap::newCtorRegions, Dyninst::SymtabAPI::LinkMap::newDtorRegions, Dyninst::SymtabAPI::LinkMap::originalCtorRegion, Dyninst::SymtabAPI::LinkMap::originalDtorRegion, Dyninst::SymtabAPI::LinkMap::origSymbols, Dyninst::SymtabAPI::LinkMap::pltEntries, Dyninst::SymtabAPI::LinkMap::pltRegionAlign, Dyninst::SymtabAPI::LinkMap::pltRegionOffset, Dyninst::SymtabAPI::LinkMap::pltSize, Dyninst::SymtabAPI::LinkMap::regionAllocs, Dyninst::SymtabAPI::LinkMap::relGotRegionAlign, Dyninst::SymtabAPI::LinkMap::relGotRegionOffset, Dyninst::SymtabAPI::LinkMap::relGotSize, Dyninst::SymtabAPI::LinkMap::relRegionAlign, Dyninst::SymtabAPI::LinkMap::relRegionOffset, Dyninst::SymtabAPI::LinkMap::relSize, rewrite_printf(), Dyninst::SymtabAPI::Region::RP_RW, Dyninst::SymtabAPI::Region::RT_BSS, Dyninst::SymtabAPI::Region::RT_DATA, Dyninst::SymtabAPI::Region::RT_TEXT, Dyninst::SymtabAPI::Region::RT_TEXTDATA, Dyninst::SymtabAPI::Symbol::SL_UNKNOWN, Dyninst::SymtabAPI::Symbol::ST_TLS, Dyninst::SymtabAPI::Symbol::ST_UNKNOWN, Storage_Allocation_Failure, Dyninst::SymtabAPI::LinkMap::stubRegionOffset, Dyninst::SymtabAPI::LinkMap::stubSize, Dyninst::SymtabAPI::Symbol::SV_UNKNOWN, Dyninst::SymtabAPI::LinkMap::tlsRegionAlign, Dyninst::SymtabAPI::LinkMap::tlsRegionOffset, Dyninst::SymtabAPI::LinkMap::tlsRegions, Dyninst::SymtabAPI::LinkMap::tlsSize, and Dyninst::SymtabAPI::LinkMap::tlsSymbols.

Referenced by linkStatic().

bool emitElfStatic::createNewCtorRegion ( LinkMap lmap  )  [private]
bool emitElfStatic::createNewDtorRegion ( LinkMap lmap  )  [private]
void emitElfStatic::createStub ( unsigned *  stub,
Offset  stubOffset,
Offset  newTOC,
Offset  oldTOC,
Offset  dest 
) [private]
Offset emitElfStatic::findOrCreateStub ( Symbol sym,
LinkMap lmap,
Offset  newTOC,
Offset  oldTOC,
char *  data,
Offset  global 
) [private]
void Dyninst::SymtabAPI::emitElfStatic::getExcludedSymbolNames ( std::set< std::string > &  symNames  )  [private]

Architecture specific

Gets the symbols that should be excluded when resolving symbols

symNames This set is populated by the function

Referenced by resolveSymbols().

Offset emitElfStatic::getGOTAlign ( LinkMap lmap  )  [private]

Architecture specific

Determines the GOT Region alignment from information in the LinkMap

Definition at line 681 of file emitElfStatic-ppc32.C.

Referenced by createLinkMap().

Offset emitElfStatic::getGOTSize ( Symtab target,
LinkMap lmap,
Offset layoutStart 
) [private]

Architecture specific

Determines the size of the GOT Region from information in the LinkMap

Definition at line 677 of file emitElfStatic-ppc32.C.

Referenced by createLinkMap().

Offset Dyninst::SymtabAPI::emitElfStatic::getNewTOC ( TOCstub t  )  [inline, private]

Definition at line 402 of file emitElfStatic.h.

Referenced by findOrCreateStub().

Offset Dyninst::SymtabAPI::emitElfStatic::getOldTOC ( TOCstub t  )  [inline, private]

Definition at line 403 of file emitElfStatic.h.

Referenced by findOrCreateStub().

char emitElfStatic::getPaddingValue ( Region::RegionType  rtype  )  [private]

Architecture specific

Given the Region type of a combined Region, gets the padding value to use in between Regions that make up the combined Region.

rtype The Region type for the combined Region

Returns the padding character

Definition at line 480 of file emitElfStatic-ppc32.C.

Referenced by copyRegions().

Offset Dyninst::SymtabAPI::emitElfStatic::getStubOffset ( TOCstub t  )  [inline, private]

Definition at line 401 of file emitElfStatic.h.

Referenced by findOrCreateStub().

bool emitElfStatic::handleInterModuleSpecialCase ( Symtab target,
Symtab src,
LinkMap lmap,
char *  data,
relocationEntry  rel,
Offset  newTOC,
Offset  oldTOC,
Offset  dest,
Offset  relOffset,
Offset  globalOffset 
) [private]
bool emitElfStatic::hasRewrittenTLS (  )  const

Indicates if a new TLS initialization image has been created

Definition at line 1315 of file emitElfStatic.C.

References hasRewrittenTLS_.

bool emitElfStatic::isConstructorRegion ( Region reg  )  [private]

Architecture specific

Determines if the passed Region corresponds to a constructor table Region

Definition at line 642 of file emitElfStatic-ppc32.C.

References CTOR_NAME(), and Dyninst::SymtabAPI::Region::getRegionName().

Referenced by createLinkMap().

bool emitElfStatic::isDestructorRegion ( Region reg  )  [private]

Architecture specific

Determines if the passed Region corresponds to a destructor table Region

Definition at line 647 of file emitElfStatic-ppc32.C.

References DTOR_NAME(), and Dyninst::SymtabAPI::Region::getRegionName().

Referenced by createLinkMap().

bool emitElfStatic::isGOTRegion ( Region reg  )  [private]

Definition at line 651 of file emitElfStatic-ppc32.C.

Referenced by createLinkMap().

bool emitElfStatic::isGOTRelocation ( unsigned long  relType  )  [private]

Architecture specific

Determines if the passed relocation type requires the building of a GOT

relType The relocation type to check

Returns true if the relocation type requires a GOT

Definition at line 655 of file emitElfStatic-ppc32.C.

References addressWidth_, PPC32_WIDTH, and UNKNOWN_ADDRESS_WIDTH_ASSERT.

Referenced by createLinkMap().

Offset emitElfStatic::layoutNewCtorRegion ( LinkMap lmap  )  [private]

Architecture specific

Lays out a new constructor table Region from the existing constructor table in the target and any new constructor Regions in the relocatable files

Returns the ending offset of the new Region

Definition at line 494 of file emitElfStatic-ppc32.C.

References addressWidth_, Dyninst::SymtabAPI::LinkMap::ctorRegionOffset, Dyninst::SymtabAPI::Region::getDiskSize(), Dyninst::SymtabAPI::LinkMap::newCtorRegions, Dyninst::SymtabAPI::LinkMap::originalCtorRegion, and Dyninst::SymtabAPI::LinkMap::regionAllocs.

Referenced by createLinkMap().

Offset emitElfStatic::layoutNewDtorRegion ( LinkMap lmap  )  [private]

Architecture specific

Lays out a new destructor table Region from the existing destructor table in the target and any new destructor Regions in the relocatable files

Returns the ending offset of the new Region

Definition at line 569 of file emitElfStatic-ppc32.C.

References addressWidth_, Dyninst::SymtabAPI::LinkMap::dtorRegionOffset, Dyninst::SymtabAPI::Region::getDiskSize(), Dyninst::SymtabAPI::LinkMap::newDtorRegions, Dyninst::SymtabAPI::LinkMap::originalDtorRegion, and Dyninst::SymtabAPI::LinkMap::regionAllocs.

Referenced by createLinkMap().

Offset emitElfStatic::layoutRegions ( deque< Region * > &  regions,
map< Region *, LinkMap::AllocPair > &  regionAllocs,
Offset  currentOffset,
Offset  globalOffset 
)

Lays out the specified regions, storing the layout info in the passed map.

regions A collection of Regions to layout regionAllocs A map of Regions to their layout information currentOffset The starting offset for the passed Regions in the new storage space globalOffset The location of the new storage space in the target (used for padding calculation)

Definition at line 997 of file emitElfStatic.C.

References computePadding().

Referenced by createLinkMap(), tlsLayoutVariant1(), and tlsLayoutVariant2().

Offset emitElfStatic::layoutTLSImage ( Offset  globalOffset,
Region dataTLS,
Region bssTLS,
LinkMap lmap 
) [private]

Architecture specific (similar to layoutRegions)

Creates a new TLS initialization image from the existing TLS Regions in the target and any new TLS Regions from the relocatable objects.

globalOffset The absolute offset of the newly linked code dataTLS The original TLS data Region from the target (can be NULL) bssTLS The original TLS bss Region from the target (can be NULL) lmap Holds information necessary to do layout

Returns the ending Offset of the Region

Definition at line 472 of file emitElfStatic-ppc32.C.

References tlsLayoutVariant1().

Referenced by createLinkMap().

char * emitElfStatic::linkStatic ( Symtab target,
StaticLinkError err,
string &  errMsg 
)

NOTE: Most of these functions take a reference to a StaticLinkError and a string for error reporting purposes. These should prove useful in identifying the cause of an error Statically links relocatable files into the specified Symtab object, as specified by state in the Symtab object

target relocatable files will be linked into this Symtab

Returns a pointer to a block of data containing the results of the link The caller is responsible for delete'ing this block of data

Definition at line 102 of file emitElfStatic.C.

References addNewRegions(), Dyninst::SymtabAPI::LinkMap::allocatedData, applyRelocations(), buildPLT(), buildRela(), createLinkMap(), Dyninst::SymtabAPI::Symtab::getAllNewRegions(), Link_Location_Error, No_Static_Link_Error, Dyninst::SymtabAPI::LinkMap::origRels, Dyninst::SymtabAPI::LinkMap::origSymbols, Dyninst::SymtabAPI::LinkMap::printAll(), Dyninst::SymtabAPI::LinkMap::printBySymtab(), resolveSymbols(), rewrite_printf(), Storage_Allocation_Failure, sym_debug_rewrite, and updateTOC().

string emitElfStatic::printStaticLinkError ( StaticLinkError  err  )  [static]
bool emitElfStatic::resolveSymbols ( Symtab target,
vector< Symtab * > &  relocatableObjects,
LinkMap lmap,
StaticLinkError err,
string &  errMsg 
)

Resolves undefined symbols in the specified Symtab object, usually due to the addition of new Symbols to the Symtab object. The target Symtab object must have a collection of Archives associated with it. These Archives will be searched for the defined versions of the undefined symbols in the specified Symtab objects.

target the Symtab containing the undefined symbols relocatableObjects populated by this function, this collection specifies all the Symtabs needed to ensure that the target has no undefined Symbols once the link is performed

Definition at line 227 of file emitElfStatic.C.

References addIndirectSymbol(), addressWidth_, checkSpecialCaseSymbols(), Dyninst::SymtabAPI::Symtab::findSymbol(), Dyninst::SymtabAPI::Symtab::getAddressWidth(), Dyninst::SymtabAPI::Symtab::getAllRegions(), Dyninst::SymtabAPI::Symtab::getAllUndefinedSymbols(), getExcludedSymbolNames(), Dyninst::SymtabAPI::Symtab::getExplicitSymtabRefs(), Dyninst::SymtabAPI::Symbol::getLinkage(), Dyninst::SymtabAPI::Symtab::getLinkingResources(), Dyninst::SymtabAPI::Symbol::getMangledName(), Dyninst::SymtabAPI::Symbol::getOffset(), Dyninst::SymtabAPI::Symtab::getParentArchive(), Dyninst::SymtabAPI::Symbol::getPrettyName(), Dyninst::SymtabAPI::Symbol::getSymtab(), Dyninst::SymtabAPI::Symbol::getType(), isStripped_, Dyninst::SymtabAPI::Symtab::memberName(), Dyninst::SymtabAPI::Archive::name(), Dyninst::SymtabAPI::LinkMap::origRels, rewrite_printf(), Dyninst::SymtabAPI::Symbol::SL_WEAK, Dyninst::SymtabAPI::Symbol::ST_INDIRECT, Dyninst::SymtabAPI::Symbol::ST_UNKNOWN, and Symbol_Resolution_Failure.

Referenced by linkStatic().

Offset emitElfStatic::tlsAdjustVariant2 ( Offset  curOffset,
Offset  tlsSize 
) [private]

Definition at line 1485 of file emitElfStatic.C.

void emitElfStatic::tlsCleanupVariant1 ( map< Region *, LinkMap::AllocPair > &  regionAllocs,
Region dataTLS,
Region bssTLS 
) [private]

Definition at line 1492 of file emitElfStatic.C.

void emitElfStatic::tlsCleanupVariant2 ( map< Region *, LinkMap::AllocPair > &  regionAllocs,
Region dataTLS,
Region bssTLS 
) [private]

Definition at line 1499 of file emitElfStatic.C.

Referenced by cleanupTLSRegionOffsets().

Offset emitElfStatic::tlsLayoutVariant1 ( Offset  globalOffset,
Region dataTLS,
Region bssTLS,
LinkMap lmap 
) [private]
Offset emitElfStatic::tlsLayoutVariant2 ( Offset  globalOffset,
Region dataTLS,
Region bssTLS,
LinkMap lmap 
) [private]
bool emitElfStatic::updateTOC ( Symtab file,
LinkMap lmap,
Offset  globalOffset 
) [private]

Definition at line 696 of file emitElfStatic-ppc32.C.

Referenced by linkStatic().


Field Documentation

Definition at line 397 of file emitElfStatic.h.

Referenced by createLinkMap(), and hasRewrittenTLS().

Definition at line 396 of file emitElfStatic.h.

Referenced by resolveSymbols().

Definition at line 400 of file emitElfStatic.h.

Referenced by findOrCreateStub().


The documentation for this class was generated from the following files:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1