emitElfStatic-x86.C File Reference

#include <cstdlib>
#include <cstdio>
#include <cassert>
#include <iostream>
#include <set>
#include <map>
#include <sstream>
#include "emitElfStatic.h"
#include "Symtab.h"
#include "Symbol.h"
#include "Archive.h"
#include "Object.h"
#include "Region.h"
#include "debug.h"

Go to the source code of this file.

Defines

#define UNKNOWN_ADDRESS_WIDTH_ASSERT   "An unknown address width was encountered, can't continue"

Functions

static bool computeCtorDtorAddress (relocationEntry &rel, Offset globalOffset, LinkMap &lmap, string &errMsg, Offset &symbolOffset)
static const string LIBC_ATEXIT_INTERNAL ("__cxa_exit")
static const string LIBC_ATEXIT ("atexit")
static const string DTOR_NAME (".dtors")
static const string CTOR_NAME (".ctors")

Variables

static const Offset GOT_RESERVED_SLOTS = 3
static const unsigned X86_WIDTH = 4
static const unsigned X86_64_WIDTH = 8
static const Elf64_Word X86_HEADER = 0xffffffff
static const Elf64_Word X86_TRAILER = 0x00000000
static const Elf64_Xword X86_64_HEADER = 0xffffffffffffffffULL
static const Elf64_Xword X86_64_TRAILER = 0x0000000000000000ULL

Define Documentation

#define UNKNOWN_ADDRESS_WIDTH_ASSERT   "An unknown address width was encountered, can't continue"

Definition at line 64 of file emitElfStatic-x86.C.


Function Documentation

static bool computeCtorDtorAddress ( relocationEntry rel,
Offset  globalOffset,
LinkMap lmap,
string &  errMsg,
Offset &  symbolOffset 
) [static]

Specific to x86

Given a relocation, determines if the relocation corresponds to a .ctors or .dtors table that requires special consideration. Modifies the passed symbol offset to point to the right table, if applicable.

rel The relocation entry to examine globalOffset The offset of the linked code (used for symbol offset calculation) lmap Holds information about .ctors/.dtors tables errMsg Set on error symbolOffset Modified by this routine to contain the offset of the table

Returns true, if there are no errors including the case where the relocation entry doesn't reference the .ctors/.dtors tables.

Definition at line 88 of file emitElfStatic-x86.C.

References Dyninst::SymtabAPI::LinkMap::ctorRegionOffset, Dyninst::SymtabAPI::LinkMap::dtorRegionOffset, Dyninst::SymtabAPI::Region::getDiskOffset(), Dyninst::SymtabAPI::relocationEntry::name(), Dyninst::SymtabAPI::LinkMap::newCtorRegions, Dyninst::SymtabAPI::LinkMap::newDtorRegions, Dyninst::SymtabAPI::LinkMap::originalCtorRegion, Dyninst::SymtabAPI::LinkMap::originalDtorRegion, Dyninst::SymtabAPI::LinkMap::relRegionOffset, Dyninst::SymtabAPI::LinkMap::relSize, Dyninst::SymtabAPI::SYMTAB_CTOR_LIST_REL, Dyninst::SymtabAPI::SYMTAB_DTOR_LIST_REL, Dyninst::SymtabAPI::SYMTAB_IREL_END, and Dyninst::SymtabAPI::SYMTAB_IREL_START.

static const string CTOR_NAME ( ".ctors"   )  [static]
static const string DTOR_NAME ( ".dtors"   )  [static]
static const string LIBC_ATEXIT ( "atexit"   )  [static]
static const string LIBC_ATEXIT_INTERNAL ( "__cxa_exit"   )  [static]

Variable Documentation

const Offset GOT_RESERVED_SLOTS = 3 [static]

Definition at line 55 of file emitElfStatic-x86.C.

const Elf64_Xword X86_64_HEADER = 0xffffffffffffffffULL [static]

Definition at line 570 of file emitElfStatic-x86.C.

const Elf64_Xword X86_64_TRAILER = 0x0000000000000000ULL [static]

Definition at line 571 of file emitElfStatic-x86.C.

const unsigned X86_64_WIDTH = 8 [static]

Definition at line 57 of file emitElfStatic-x86.C.

const Elf64_Word X86_HEADER = 0xffffffff [static]

Definition at line 568 of file emitElfStatic-x86.C.

const Elf64_Word X86_TRAILER = 0x00000000 [static]

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

const unsigned X86_WIDTH = 4 [static]

Definition at line 56 of file emitElfStatic-x86.C.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1