Ejemplo n.º 1
0
void CELF2ELF<ELFSTRUCTURES>::Convert() {
   // Some compilers require this-> for accessing members of template base class,
   // according to the so-called two-phase lookup rule.
   MakeSymbolTable();               // Remake symbol tables and string tables
   ChangeSections();                // Modify section names and relocation table symbol indices
   MakeBinaryFile();                // Put everyting together into ToFile
   *this << ToFile;                 // Take over new file buffer
}
Ejemplo n.º 2
0
   void CELF2MAC<ELFSTRUCTURES,MACSTRUCTURES>::Convert() {
   // Do the conversion
   // Some compilers require this-> for accessing members of template base class,
   // according to the so-called two-phase lookup rule.

   // Call the subfunctions
   ToFile.SetFileType(FILETYPE_MACHO_LE);             // Set type of new file
   MakeFileHeader();                                  // Make file header
   MakeSectionsIndex();                               // Make sections index translation table
   FindUnusedSymbols();                               // Check if symbols used, remove unused symbols
   MakeSymbolTable();                                 // Make symbol table and string tables
   MakeSections();                                    // Make sections and relocation tables
   MakeBinaryFile();                                  // Put sections together
   *this << ToFile;                                   // Take over new file buffer
}
Ejemplo n.º 3
0
void CCOF2ELF<ELFSTRUCTURES>::Convert() {
    // Do the conversion
    NumSectionsNew = 5;                                    // Number of sections generated so far

    // Allocate variable size buffers
    MaxSectionsNew    = NumSectionsNew + 2 * NSections;    // Max number of sections needed
    NewSections.SetNum(MaxSectionsNew);                    // Allocate buffers for each section
    NewSections.SetZero();                                 // Initialize
    NewSectionHeaders.SetNum(MaxSectionsNew);              // Allocate array for temporary section headers
    NewSectionHeaders.SetZero();                           // Initialize
    NewSectIndex.SetNum(NSections);                        // Array for translating old section index (0-based) to new section index
    NewSectIndex.SetZero();                                // Initialize
    NewSymbolIndex.SetNum(NumberOfSymbols);                // Array of new symbol indices
    NewSymbolIndex.SetZero();                              // Initialize

    // Call the subfunctions
    ToFile.SetFileType(FILETYPE_ELF);   // Set type of to file
    MakeSegments();                     // Make segment headers and code/data segments
    MakeSymbolTable();                  // Symbol table and string tables
    MakeRelocationTables();             // Relocation tables
    MakeBinaryFile();                   // Putting sections together
    *this << ToFile;                    // Take over new file buffer
}