Remove elf2e32 and other mmp references which eclipse the binaries_prebuilt versions from sftools/dev/build
NB. transasm should go as well, but the prebuilt binaries don't have the GCC_SURGE fix yet.
--- a/toolsandutils/e32tools/checklib/library/library.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Class for reading libraries in Unix "ar" format.
-//
-//
-
-#include "library.h"
-
-#include "misc/endian.h" // For misc::reverse_bytes()
-
-#include <fstream>
-#include <stdexcept>
-#include <cassert>
-#include <iostream>
-#include <iomanip>
-#include <cstdlib>
-
-namespace
-{
- // An ar library begins with this string.
- const char MAGIC[] = "!<arch>\n";
-
- // The size of an object header.
- const int HEADER_LENGTH = 60;
-
- // Each object *header* has this trailer.
- const char TRAILER[] = "`\n";
-}
-
-
-Library::Library(const char a_file_name[])
-{
- std::ifstream file(a_file_name, std::ios::in | std::ios::binary | std::ios::ate);
-
- if ( ! file.is_open() )
- {
- throw std::runtime_error("couldn't open file");
- }
-
- unsigned size = file.tellg();
- m_mem_p = new char[size];
-
- file.seekg(0, std::ios::beg);
- file.read( const_cast<char*>(m_mem_p), size );
-
- file.close();
-
- const char* p1 = m_mem_p;
- const char* p2 = p1 + size - 1;
-
- // Eat all meta objects.
-
- p1 = _eat_ar_header(p1, p2);
- p1 = _eat_sym_table(p1, p2);
- p1 = _eat_junk_objs(p1, p2);
-
- m_first_p = p1; // Pointer to the start of the first "real" object.
- m_last_p = p2; // Pointer to end of the last real object.
-}
-
-Library::~Library()
-{
- delete[] m_mem_p;
-}
-
-bool Library::contains_symbol(const char a_sym_name[]) const
-{
- std::vector<const char*>::const_iterator p = m_symbols.begin();
- std::vector<const char*>::const_iterator end_p = m_symbols.end();
-
- for ( ; p != end_p; ++p)
- {
- if ( std::strcmp(a_sym_name, *p) == 0 ) return 1;
- }
-
- return 0;
-}
-
-const std::vector< std::pair<const char*, const char*> >* Library::get_objects() const
-{
- if ( m_objects.empty() )
- {
- const char* p = m_first_p;
-
- unsigned long size;
-
- while (p < m_last_p)
- {
- p = _eat_obj_header(p, m_last_p, &size);
-
- m_objects.push_back( std::pair<const char*, const char*>(p, p + size) );
-
- p += size;
- }
- }
-
- return &m_objects;
-}
-
-const char* Library::_eat_ar_header(const char* p1, const char* p2) const
-{
- int magic_length = std::strlen(MAGIC);
-
- if (p2 - p1 + 1 < magic_length)
- {
- throw std::runtime_error("library too small for magic word");
- }
-
- if ( std::strncmp(p1, MAGIC, magic_length) != 0 )
- {
- throw std::runtime_error("bad magic; this is not a valid library");
- }
-
- return (p1 + magic_length);
-}
-
-const char* Library::_eat_sym_table(const char* a_first_p, const char* a_last_p) const
-{
- unsigned long obj_size;
-
- const char* p = _eat_obj_header(a_first_p, a_last_p, &obj_size, "/ "); // Read the header of the symbol table.
-
- if (p == a_first_p)
- {
- throw std::runtime_error("no library symbol table found");
- }
-
- const char* obj_end_p = p + obj_size;
-
- // Check that we're 4-byte aligned.
- assert( (reinterpret_cast<int>(p) & 0x3) == 0 );
-
- uint32_t nr_of_syms = *reinterpret_cast<const int*>(p);
- nr_of_syms = misc::reverse_bytes(nr_of_syms);
-
- p += sizeof(nr_of_syms); // Go past the integer we just read.
- p += nr_of_syms * sizeof(uint32_t); // Go past all the offsets.
-
- unsigned n = 0;
-
- while (n < nr_of_syms && p < a_last_p)
- {
- m_symbols.push_back(p);
-
- p += std::strlen(p) + 1;
-
- n++;
- }
-
- if (n != nr_of_syms)
- {
- throw std::runtime_error("inconsistent symbol table");
- }
-
- if (p > obj_end_p)
- {
- throw std::runtime_error("over-running symbol table");
- }
-
- return obj_end_p;
-}
-
-const char* Library::_eat_junk_objs(const char* p1, const char* p2) const
-{
- unsigned long obj_size;
- const char* p;
-
- p = _eat_obj_header(p1, p2, &obj_size, "// ");
-
- if (p > p1)
- {
- p1 = p + obj_size;
- }
-
- p = _eat_obj_header(p1, p2, &obj_size, "/ ");
-
- if (p > p1)
- {
- p1 = p + obj_size;
- }
-
- p = _eat_obj_header(p1, p2, &obj_size, "// ");
-
- if (p > p1)
- {
- p1 = p + obj_size;
- }
-
- return p1;
-}
-
-const char* Library::_eat_obj_header(const char* a_first_p, const char* a_last_p, unsigned long* a_size_p, const char* a_name) const
-{
- const char* p = a_first_p;
-
- // The header is 2-byte aligned, so ignore the previous object's trailing
- // padding byte.
- if ( reinterpret_cast<int>(p) & 1)
- {
- p++;
- }
-
- if (a_last_p - p + 1 < HEADER_LENGTH)
- {
- throw std::runtime_error("no space for library object header");
- }
-
- // At the moment We can only handle short names. This is enough for identifying
- // the meta objects "/" (symbol table) and "//" (object table).
-
- if ( a_name && std::strncmp(p, a_name, std::strlen(a_name)) != 0 )
- {
- return a_first_p;
- }
-
- p += 16; // Ignore the name field.
- p += 12; // Ignore the modification time.
- p += 6; // Ignore the group ID.
- p += 6; // Ignore the user ID.
- p += 8; // Ignore the file mode.
-
- // Read the object size.
-
- if (a_size_p)
- {
- char* tail_p;
- *a_size_p = std::strtoul(p, &tail_p, 0);
-
- if (tail_p == p || tail_p > a_last_p + 1)
- {
- throw std::runtime_error("could not read library object size");
- }
- }
-
- p += 10; // Jump over the object size field.
-
- // Verify that the header trailer is correct.
-
- int trailer_length = std::strlen(TRAILER);
-
- if ( std::strncmp(p, TRAILER, trailer_length) != 0 )
- {
- throw std::runtime_error("incorrect library object header trailer");
- }
-
- return (p + trailer_length);
-}
-
-
--- a/toolsandutils/e32tools/checklib/library/library.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Class for reading libraries in Unix "ar" format.
-//
-//
-
-#ifndef LIBRARY_H
-#define LIBRARY_H
-
-#include <vector>
-#include <utility>
-
-
-class Library
-{
-public:
- Library(const char a_file_name[]);
- ~Library();
-public:
- bool contains_symbol(const char[]) const;
-
- const std::vector< std::pair<const char*, const char*> >* get_objects() const;
-private:
- const char* _eat_ar_header(const char*, const char*) const;
- const char* _eat_sym_table(const char*, const char*) const;
- const char* _eat_junk_objs(const char*, const char*) const;
-
- const char* _eat_obj_header(const char*, const char*, unsigned long*, const char* = 0) const;
-
-private:
- const char* m_mem_p;
-
- const char* m_first_p;
- const char* m_last_p;
-
- mutable std::vector<const char*> m_symbols;
- mutable std::vector< std::pair<const char*, const char*> > m_objects;
-};
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/main.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Entry point for the checklib utility.
-//
-//
-
-#include "library/library.h" // For handling libraries of Unix "ar" format.
-#include "object/object.h" // For handling (parts of) ELF and COFF object files.
-
-#include <string>
-#include <sstream>
-#include <iostream>
-#include <stdexcept>
-
-
-const char SELF_NAME[] = "checklib";
-
-// Describes what kind of library it is.
-enum libkind_t
-{
- STDCPP, // Library should be compatible with Symbian C++.
- SYMCPP // Library should be compatible with standard C++ (Open Environment).
-};
-
-// Describes what kind of objects are in the library: ELF or COFF.
-typedef Object_factory::objkind_t objkind_t;
-
-void _usage_and_exit(int exit_code=EXIT_FAILURE);
-void _error_and_exit(const std::string&, int exit_code=EXIT_FAILURE);
-
-// These are the ::operator new symbols we are worried about.
-const char* NEW_NAMES[2][4] = {
- {"_Znwj", "_Znaj", "_ZnwjRKSt9nothrow_t", "_ZnajRKSt9nothrow_t"}, // ELF
- {"??2@YAPAXI@Z", "??_U@YAPAXI@Z", "??2@YAPAXIABUnothrow_t@std@@@Z", "??_U@YAPAXIABUnothrow_t@std@@@Z"} // COFF
-};
-
-// Checks whether the object files in the given library references any of the
-// ::operator new functions.
-bool _lib_ref_new(const Library&, objkind_t);
-
-
-int main(int argc, const char* argv[])
-{
- // Do we have any standard module for handling the command-line interface? If
- // not, see if we can start using getopt or Boost.
-
- if (argc < 4)
- {
- _usage_and_exit();
- }
-
- // Command-line options.
- libkind_t opt_libkind;
- objkind_t opt_objkind;
-
- if ( std::strcmp(argv[1], "stdc++") == 0 )
- {
- opt_libkind = STDCPP;
- }
- else if ( std::strcmp(argv[1], "symc++") == 0 )
- {
- opt_libkind = SYMCPP;
- }
- else
- {
- _usage_and_exit();
- }
-
- if ( std::strcmp(argv[2], "--elf") == 0 )
- {
- opt_objkind = Object_factory::ELF;
- }
- else if ( std::strcmp(argv[2], "--coff") == 0 )
- {
- opt_objkind = Object_factory::COFF;
- }
- else
- {
- _usage_and_exit();
- }
-
- try
- {
- // Check each library that was given on the command-line.
- for (int i = 3; i < argc; i++)
- {
- Library lib( argv[i] ); // May throw std::runtime_error.
-
- // If the library has the tag, we know that it was built to be OE
- // compatible, and vice versa.
- bool lib_is_tagged = lib.contains_symbol("____symbian_stdcpp_mmviii");
-
- // Handle the two only possible error cases:
-
- if ( opt_libkind == STDCPP && !lib_is_tagged && _lib_ref_new(lib, opt_objkind) )
- {
- std::ostringstream err_msg;
- err_msg << "library " << argv[i] << " is incompatible with standard C++";
-
- _error_and_exit(err_msg.str());
- }
- else if ( opt_libkind == SYMCPP && lib_is_tagged && _lib_ref_new(lib, opt_objkind) )
- {
- std::ostringstream err_msg;
- err_msg << "library " << argv[i] << " is incompatible with Symbian C++";
-
- _error_and_exit(err_msg.str());
- }
- }
- }
- catch (std::runtime_error& e)
- {
- _error_and_exit( e.what() );
- }
-
- return 0;
-}
-
-void _error_and_exit(const std::string& a_msg, int a_exit_code)
-{
- std::cerr << SELF_NAME << ": error: " << a_msg << "." << std::endl;
- std::exit(a_exit_code);
-}
-
-void _usage_and_exit(int a_exit_code)
-{
- using std::cout;
- using std::endl;
-
- cout << "usage: " << SELF_NAME << " stdc++ --elf|--coff <lib_list>\n"
- << " " << SELF_NAME << " symc++ --elf|--coff <lib_list>" << endl;
-
- std::exit(a_exit_code);
-}
-
-bool _lib_ref_new(const Library& a_lib, objkind_t a_objkind)
-{
- typedef std::vector< std::pair<const char*, const char*> > T;
-
- const T* objects_p = a_lib.get_objects();
-
- T::const_iterator p = objects_p->begin();
- T::const_iterator end_p = objects_p->end();
-
- // Iterate over all the objects ...
- for (; p != end_p; ++p)
- {
- std::auto_ptr<Object> obj_p = Object_factory::create(a_objkind, p->first, p->second);
-
- // ... And check for references to any ::operator new function.
- for (unsigned i = 0; i < sizeof(NEW_NAMES[a_objkind]) / sizeof(NEW_NAMES[a_objkind][0]); i++)
- {
- if ( obj_p->is_undef(NEW_NAMES[a_objkind][i]) )
- {
- return 1;
- }
- }
- }
-
- return 0;
-}
-
--- a/toolsandutils/e32tools/checklib/misc/endian.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Some utility functions for converting between big and little endian.
-//
-//
-
-#include "endian.h"
-
-
-uint32_t misc::reverse_bytes(uint32_t n)
-{
- unsigned char b0 = (n >> 0*8) & 0xff;
- unsigned char b1 = (n >> 1*8) & 0xff;
- unsigned char b2 = (n >> 2*8) & 0xff;
- unsigned char b3 = (n >> 3*8) & 0xff;
-
- return (b0 << 3*8) | (b1 << 2*8) | (b2 << 1*8) | (b3 << 0*8);
-}
-
-uint16_t misc::reverse_bytes(uint16_t n)
-{
- unsigned char b0 = (n >> 0*8) & 0xff;
- unsigned char b1 = (n >> 1*8) & 0xff;
-
- return (b0 << 1*8) | (b1 << 0*8);
-}
-
--- a/toolsandutils/e32tools/checklib/misc/endian.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Some utility functions for converting between big and little endian.
-//
-//
-
-#ifndef ENDIAN_H
-#define ENDIAN_H
-
-#include <stdint.h> // For uint16_t and uint32_t.
-
-namespace misc
-{
- // Big endian <-> little endian.
- uint32_t reverse_bytes(uint32_t);
- uint16_t reverse_bytes(uint16_t);
-}
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef COFF_H
-#define COFF_H
-
-
-struct coff_file_header_t
-{
- unsigned short magic;
-
- unsigned short _junk1;
- unsigned long _junk2;
-
- unsigned long symtab;
- unsigned long nsyms;
-
- unsigned short _junk3;
- unsigned short _junk4;
-};
-
-struct coff_symentry_t
-{
- unsigned long is_inline __attribute__((packed));
- unsigned long offset __attribute__((packed));
- unsigned long _junk1 __attribute__((packed));
-
- short section;
-
- unsigned short _junk2;
-
- unsigned char _junk3;
- unsigned char aux_count;
-};
-
-
-#endif
-
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_file_header.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "coff_file_header.h"
-#include <stdexcept>
-#include <string>
-
-
-namespace coff
-{
- File_header::File_header(const char* p1, const char* p2, bool a_pedantic)
- : m_data( reinterpret_cast<const coff_file_header_t*>(p1) )
- {
- if ( unsigned(p2 - p1 + 1) < sizeof(coff_file_header_t) )
- {
- throw std::runtime_error("not a COFF object: the file is too small");
- }
-
- if (m_data->magic != 0x014c)
- {
- throw std::runtime_error("not a COFF object: bad magic");
- }
-
- if (a_pedantic) // Do some extra checks for correctness.
- {
- // ...
- }
- }
-
- unsigned File_header::get_symtab_offset() const
- {
- return m_data->symtab;
- }
-
- unsigned File_header::get_symcount() const
- {
- return m_data->nsyms;
- }
-}
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_file_header.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef COFF_FILE_HEADER_H
-#define COFF_FILE_HEADER_H
-
-#include "coff.h"
-
-
-namespace coff
-{
- class File_header
- {
- public:
- File_header(const char*, const char*, bool = 0);
- public:
- unsigned get_symtab_offset() const;
- unsigned get_symcount() const;
- private:
- const coff_file_header_t* m_data;
- };
-}
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_string_table.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "coff_string_table.h"
-
-static const char NULL_STRING[] = "";
-
-namespace coff
-{
- String_table::String_table(const char* p) : m_first_p(p)
- {
- m_size = *reinterpret_cast<const int*>(m_first_p);
- }
-
- const char* String_table::get_string(unsigned n) const
- {
- if (n < 4)
- {
- return NULL_STRING;
- }
-
- return (m_first_p + n);
- }
-}
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_string_table.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef COFF_STRING_TABLE_H
-#define COFF_STRING_TABLE_H
-
-
-namespace coff
-{
- class String_table
- {
- public:
- String_table(const char*);
-
- const char* get_string(unsigned) const;
- private:
- const char* m_first_p;
- unsigned m_size;
- };
-}
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_symbol.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "coff_symbol.h"
-
-
-namespace coff
-{
- Symbol::Symbol(const char* p1, const char* p2)
- : m_data( reinterpret_cast<const coff_symentry_t*>(p1) )
- {
- if ( unsigned(p2 - p1 + 1) < sizeof(coff_symentry_t) )
- {
- //throw
- }
- }
-
- unsigned Symbol::get_entrysize()
- {
- return sizeof(coff_symentry_t);
- }
-
- unsigned Symbol::get_name() const
- {
- // At the moment we can't handle inlined names. It shouldn't be necessary
- // right now, though, as the mangled name of all ::operator new functions
- // are more than eight characters long.
- if (m_data->is_inline)
- {
- return 0;
- }
-
- return m_data->offset;
- }
-
- unsigned Symbol::get_section() const
- {
- return m_data->section;
- }
-
- unsigned Symbol::get_auxcount() const
- {
- return m_data->aux_count;
- }
-
-}
-
-
--- a/toolsandutils/e32tools/checklib/object/coff/coff_symbol.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef COFF_SYMBOL_H
-#define COFF_SYMBOL_H
-
-#include "coff.h"
-
-
-namespace coff
-{
- class Symbol
- {
- public:
- Symbol(const char*, const char*);
- public:
- static unsigned get_entrysize();
-
- unsigned get_name() const;
- unsigned get_section() const;
- unsigned get_auxcount() const;
- private:
- const coff_symentry_t* m_data;
- };
-}
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/coff_object.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "object.h"
-
-#include "coff/coff_file_header.h"
-#include "coff/coff_symbol.h"
-#include "coff/coff_string_table.h"
-
-#include <algorithm>
-#include <functional>
-
-Coff_object::Coff_object(const char* p1, const char* p2)
-{
- coff::File_header fh(p1, p2);
-
- unsigned nr_of_syms = fh.get_symcount();
- unsigned sym_size = coff::Symbol::get_entrysize();
-
- // Pointer to the first entry in the symbol table.
- p1 += fh.get_symtab_offset();
-
- // The string table is locates directly after the symbol table.
- coff::String_table strtab( p1 + nr_of_syms * sym_size);
-
- // Iterate over the whole symbol table.
- for (unsigned i = 0; i < nr_of_syms; i++, p1 += sym_size)
- {
- coff::Symbol s(p1, p2);
-
- // A symbol can have auxiliary entries that follows it.
- unsigned aux_count = s.get_auxcount();
-
- p1 += sym_size * aux_count;
- i += aux_count;
-
- if ( s.get_section() == 0 ) // If symbol is undefined ...
- {
- m_undef_symbols.push_back( strtab.get_string( s.get_name() ) );
- }
- }
-}
-
-Coff_object::~Coff_object() {}
-
-bool Coff_object::is_undef(const char a_sym[]) const
-{
- using std::find_if;
- using std::not1;
- using std::bind2nd;
- using std::ptr_fun;
- using std::strcmp;
-
- typedef std::vector<const char*> T;
-
- T::const_iterator beg_p = m_undef_symbols.begin();
- T::const_iterator end_p = m_undef_symbols.end();
-
- T::const_iterator pos = find_if( beg_p, end_p, not1(bind2nd( ptr_fun(strcmp), a_sym)) );
-
- return (pos != end_p);
-}
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_file_header.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "elf_file_header.h"
-#include <stdexcept>
-#include <string>
-
-
-namespace elf
-{
- File_header::File_header(const char* p1, const char* p2, bool a_pedantic)
- : m_data( reinterpret_cast<const Elf32_Ehdr*>(p1) )
- {
- if ( p1 + sizeof(Elf32_Ehdr) > p2 )
- {
- throw std::runtime_error("not an ELF object; file too small");
- }
-
- uint8_t m0 = m_data->e_ident[0];
- uint8_t m1 = m_data->e_ident[1];
- uint8_t m2 = m_data->e_ident[2];
- uint8_t m3 = m_data->e_ident[3];
-
- if (m0 != 0x7f || m1 != 'E' || m2 != 'L' || m3 != 'F')
- {
- throw std::runtime_error("not an ELF object; bad magic");
- }
-
- if (a_pedantic) // Do some extra checks for correctness.
- {
- //if (m_data->e_ident[4] != 1)
- //{
- // throw std::runtime_error("invalid class; this program can only handle 32-bit objects");
- //}
-
- //if (m_data->e_ident[5] != 1)
- //{
- // throw std::runtime_error("invalid encoding; this program can only handle little-endian objects");
- //}
-
- //for (unsigned i = EI_PAD; i < sizeof(m_data->e_ident); ++i)
- //{
- // if (m_data->e_ident[i] != 0)
- // {
- // throw std::runtime_error("non-zero pading");
- // }
- //}
-
- //if (m_data->e_type == ET_NONE)
- //{
- // throw std::runtime_error("invalid type");
- //}
-
- //if (m_data->e_phoff == 0 && m_data->e_shoff == 0)
- //{
- // throw std::runtime_error("no program headers and no section headers");
- //}
-
- //if ( m_data->e_phoff + m_data->e_phentsize * m_data->e_phnum > p2 - p1 + 1 )
- //{
- // throw std::runtime_error("file too small for header table");
- //}
-
- //if (m_data->e_shoff + m_data->e_shentsize * m_data->e_shnum > a_mem.get_size() )
- //{
- // throw std::runtime_error("file too small for header table");
- //}
-
- //if ( m_data->e_shentsize != sizeof(Elf32_Shdr) )
- //{
- // throw std::runtime_error("e_shentsize doesn't match the actual size of the type");
- //}
-
- //if (m_data->e_shoff > 0 && m_data->e_shnum == 0)
- //{
- // throw std::runtime_error("this program can't handle the combination e_shoff > 0 and e_shnum == 0");
- //}
-
- //if (m_data->e_shstrndx >= 0xff00)
- //{
- // throw std::runtime_error("this program can only handle e_shstrndx < 0xff00");
- //}
-
- } // if (a_pedantic)
- }
-
- // The following functions are obvious candidates for inlining ...
-
- // e_type
-
- bool File_header::is_type_rel() const
- {
- return (m_data->e_type == ET_REL);
- }
- bool File_header::is_type_exec() const
- {
- return (m_data->e_type == ET_EXEC);
- }
- bool File_header::is_type_dyn() const
- {
- return (m_data->e_type == ET_DYN);
- }
-
- // e_machine
-
- bool File_header::is_machine_none() const
- {
- return (m_data->e_machine == EM_NONE);
- }
- bool File_header::is_machine_arm() const
- {
- return (m_data->e_machine == EM_ARM);
- }
- bool File_header::is_machine_386() const
- {
- return (m_data->e_machine == EM_386);
- }
-
- uint32_t File_header::get_entry() const
- {
- return m_data->e_entry;
- }
-
- uint32_t File_header::get_phoff() const
- {
- return m_data->e_phoff;
- }
-
- uint32_t File_header::get_shoff() const
- {
- return m_data->e_shoff;
- }
-
- uint32_t File_header::get_flags() const
- {
- return m_data->e_flags;
- }
-
- uint16_t File_header::get_ehsize() const
- {
- return m_data->e_ehsize;
- }
-
- uint16_t File_header::get_phentsize() const
- {
- return m_data->e_phentsize;
- }
-
- uint16_t File_header::get_phnum() const
- {
- return m_data->e_phnum;
- }
-
- uint16_t File_header::get_shentsize() const
- {
- return m_data->e_shentsize;
- }
-
- uint16_t File_header::get_shnum() const
- {
- return m_data->e_shnum;
- }
-
- uint16_t File_header::get_shstrndx() const
- {
- return m_data->e_shstrndx;
- }
-
-} // namespace elf
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_file_header.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ELF_FILE_HEADER_H
-#define ELF_FILE_HEADER_H
-
-#include "elftools/inc/elfdefs.h"
-#include <stdint.h>
-
-
-namespace elf
-{
- class File_header
- {
- public:
- File_header(const char*, const char*, bool = 0);
- public:
- // e_ident[]
- // No functions are defined; they shouldn't be needed.
-
- // e_type
- bool is_type_rel() const;
- bool is_type_exec() const;
- bool is_type_dyn() const;
-
- // e_machine
- bool is_machine_none() const;
- bool is_machine_arm() const;
- bool is_machine_386() const;
-
- // e_version
- // No functions necessary.
-
- uint32_t get_entry() const;
- uint32_t get_phoff() const;
- uint32_t get_shoff() const;
- uint32_t get_flags() const;
- uint16_t get_ehsize() const;
- uint16_t get_phentsize() const;
- uint16_t get_phnum() const;
- uint16_t get_shentsize() const;
- uint16_t get_shnum() const;
- uint16_t get_shstrndx() const;
-
- private:
- const Elf32_Ehdr* m_data;
- };
-}
-
-
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_section_header.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "elf_section_header.h"
-
-
-namespace elf
-{
- Section_header::Section_header(const char* p1, const char* p2)
- : m_data( reinterpret_cast<const Elf32_Shdr*>(p1) )
- {
- // This could be useful for future error checking.
- (void) p2;
-
- //--if (m_data->sh_type != SHT_NOBITS)
- //--{
- //-- if (m_data->sh_offset + m_data->sh_size > a_mem.get_size() )
- //-- {
- //-- throw std::runtime_error("file is too small");
- //-- }
- //--}
-
- //--if (m_data->sh_addralign > 1)
- //--{
- //-- if (m_data->sh_addr % m_data->sh_addralign != 0)
- //-- {
- //-- throw std::runtime_error("incorrect alignment");
- //-- }
- //--}
- }
-
- uint32_t Section_header::get_name()
- {
- return m_data->sh_name;
- }
-
- bool Section_header::is_type_null() const
- {
- return (m_data->sh_type == SHT_NULL);
- }
-
- bool Section_header::is_type_progbits() const
- {
- return (m_data->sh_type == SHT_PROGBITS);
- }
-
- bool Section_header::is_type_symtab() const
- {
- return (m_data->sh_type == SHT_SYMTAB);
- }
-
- bool Section_header::is_type_dynsym() const
- {
- return (m_data->sh_type == SHT_DYNSYM);
- }
-
- bool Section_header::is_type_strtab() const
- {
- return (m_data->sh_type == SHT_STRTAB);
- }
-
- bool Section_header::is_type_rela() const
- {
- return (m_data->sh_type == SHT_RELA);
- }
-
- bool Section_header::is_type_nobits() const
- {
- return (m_data->sh_type == SHT_NOBITS);
- }
-
- bool Section_header::is_type_rel() const
- {
- return (m_data->sh_type == SHT_REL);
- }
-
- bool Section_header::is_flags_write() const
- {
- return (m_data->sh_flags & SHF_WRITE) != 0;
- }
- bool Section_header::is_flags_alloc() const
- {
- return (m_data->sh_flags & SHF_ALLOC) != 0;
- }
- bool Section_header::is_flags_execinstr() const
- {
- return (m_data->sh_flags & SHF_EXECINSTR) != 0;
- }
-
- uint32_t Section_header::get_addr()
- {
- return m_data->sh_addr;
- }
-
- uint32_t Section_header::get_offset() const
- {
- return m_data->sh_offset;
- }
-
- uint32_t Section_header::get_size() const
- {
- return m_data->sh_size;
- }
-
- uint32_t Section_header::get_link()
- {
- return m_data->sh_link;
- }
-
- uint32_t Section_header::get_info()
- {
- return m_data->sh_info;
- }
-
- uint32_t Section_header::get_addralign()
- {
- return m_data->sh_addralign;
- }
-
- uint32_t Section_header::get_entsize() const
- {
- return m_data->sh_entsize;
- }
-
-} // namespace elf
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_section_header.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ELF_SECTION_HEADER_H
-#define ELF_SECTION_HEADER_H
-
-#include "elftools/inc/elfdefs.h"
-#include <stdint.h>
-
-namespace elf
-{
- class Section_header
- {
- public:
- Section_header(const char*, const char*);
-
- uint32_t get_name();
-
- bool is_type_null() const;
- bool is_type_progbits() const;
- bool is_type_symtab() const;
- bool is_type_dynsym() const;
- bool is_type_strtab() const;
- bool is_type_rela() const;
- bool is_type_nobits() const;
- bool is_type_rel() const;
-
- bool is_flags_write() const;
- bool is_flags_alloc() const;
- bool is_flags_execinstr() const;
-
- uint32_t get_addr();
- uint32_t get_offset() const;
- uint32_t get_size() const;
- uint32_t get_link();
- uint32_t get_info();
- uint32_t get_addralign();
- uint32_t get_entsize() const;
-
- private:
- const Elf32_Shdr* m_data;
- };
-
-} // namespace elf
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_string_table.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "elf_string_table.h"
-#include <cassert>
-
-namespace elf
-{
- const char* String_table::get_string(unsigned n) const
- {
- return (m_first_p + n);
- }
-
- String_table::String_table(const char* p, unsigned size)
- : m_first_p(p), m_last_p(p + size - 1)
- {
- assert(m_first_p <= m_last_p);
-
- if (*m_first_p != '\0')
- {
- //throw String_table_error("the first character is non-NUL");
- assert(0);
- }
-
- if (*m_last_p != '\0')
- {
- //throw String_table_error("the last character is non-NUL");
- assert(0);
- }
- }
-}
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_string_table.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ELF_STRING_TABLE_H
-#define ELF_STRING_TABLE_H
-
-namespace elf
-{
- class String_table
- {
- public:
- String_table(const char*, unsigned);
-
- const char* get_string(unsigned) const;
- private:
- const char* m_first_p;
- const char* m_last_p;
- };
-}
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_symbol.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "elf_symbol.h"
-
-
-namespace elf
-{
- // All of the following functions are candidates for inlining ...
-
- Symbol::Symbol(const char* p) : m_data( reinterpret_cast<const Elf32_Sym*>(p) )
- {
- }
-
- uint32_t Symbol::get_name() const
- {
- return m_data->st_name;
- }
-
- uint32_t Symbol::get_value() const
- {
- return m_data->st_value;
- }
-
- uint32_t Symbol::get_size() const
- {
- return m_data->st_size;
- }
-
- bool Symbol::is_info_bind_local() const
- {
- return (m_data->st_info >> 4) == STB_LOCAL;
- }
-
- bool Symbol::is_info_bind_global() const
- {
- return (m_data->st_info >> 4) == STB_GLOBAL;
- }
-
- bool Symbol::is_info_bind_weak() const
- {
- return (m_data->st_info >> 4) == STB_WEAK;
- }
-
- bool Symbol::is_info_type_notype() const
- {
- return (m_data->st_info & 0x0f) == STT_NOTYPE;
- }
-
- bool Symbol::is_info_type_object() const
- {
- return (m_data->st_info & 0x0f) == STT_OBJECT;
- }
-
- bool Symbol::is_info_type_func() const
- {
- return (m_data->st_info & 0x0f) == STT_FUNC;
- }
-
- bool Symbol::is_info_type_section() const
- {
- return (m_data->st_info & 0x0f) == STT_SECTION;
- }
-
- bool Symbol::is_info_type_file() const
- {
- return (m_data->st_info & 0x0f) == STT_FILE;
- }
-
- //bool Symbol::is_info_type_common() const
- //{
- // return (m_data->st_info == STT_COMMON);
- //}
-
- //bool Symbol::is_info_type_tls() const
- //{
- // return (m_data->st_info == STT_TLS);
- //}
-
- uint8_t Symbol::get_other() const
- {
- return m_data->st_other;
- }
-
- uint16_t Symbol::get_shndx() const
- {
- return m_data->st_shndx;
- }
-
-} // namespace elf
-
-
--- a/toolsandutils/e32tools/checklib/object/elf/elf_symbol.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ELF_SYMBOL_H
-#define ELF_SYMBOL_H
-
-#include "elftools/inc/elfdefs.h"
-#include <stdint.h>
-
-
-namespace elf
-{
- class Symbol
- {
- public:
- Symbol(const char*);
-
- uint32_t get_name() const ;
- uint32_t get_value() const ;
- uint32_t get_size() const ;
-
- bool is_info_bind_local() const;
- bool is_info_bind_global() const;
- bool is_info_bind_weak() const;
-
- bool is_info_type_notype() const;
- bool is_info_type_object() const;
- bool is_info_type_func() const;
- bool is_info_type_section() const;
- bool is_info_type_file() const;
- //bool is_info_type_common() const;
- //bool is_info_type_tls() const;
-
- uint8_t get_info_other() const ;
- uint8_t get_other() const ;
- uint16_t get_shndx() const ;
- private:
- const Elf32_Sym* m_data;
- };
-
-}
-
-
-#endif
-
--- a/toolsandutils/e32tools/checklib/object/elf_object.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "object.h"
-
-#include "elf/elf_file_header.h"
-#include "elf/elf_section_header.h"
-#include "elf/elf_symbol.h"
-#include "elf/elf_string_table.h"
-
-#include <algorithm>
-#include <functional>
-
-Elf_object::Elf_object(const char* p1, const char* p2)
-{
- const char* first_p = p1;
- const char* last_p = p2;
-
- elf::File_header fh(first_p, last_p);
-
- const char* sh_table_p = first_p + fh.get_shoff();
-
- const char* p = sh_table_p;
-
- unsigned D = fh.get_shentsize();
- unsigned N = fh.get_shnum();
-
- // Iterate over the section header table.
- for (unsigned i = 0; i < N; i++, p += D )
- {
- elf::Section_header sh(p, last_p);
-
- if ( sh.is_type_symtab() ) // We've found the symbol table's section header.
- {
- // Locate the string table.
- elf::Section_header strtab_sh( sh_table_p + D*sh.get_link(), last_p );
- elf::String_table strtab(first_p + strtab_sh.get_offset(), strtab_sh.get_size() );
-
- unsigned D = sh.get_entsize(); // The difference between two symbol pointers.
- unsigned N = sh.get_size() / D; // The number of symbols.
-
- const char* p = first_p + sh.get_offset();
-
- // Iterate over all symbols.
- for (unsigned i = 0; i < N; i++, p += D)
- {
- const elf::Symbol s(p);
-
- if (s.get_shndx() == 0)
- {
- m_undef_symbols.push_back( strtab.get_string( s.get_name() ) );
- }
- }
-
- break; // We're only interested in the symbol table ...
- }
- }
-}
-
-Elf_object::~Elf_object() {}
-
-bool Elf_object::is_undef(const char a_sym[]) const
-{
- using std::find_if;
- using std::not1;
- using std::bind2nd;
- using std::ptr_fun;
- using std::strcmp;
-
- typedef std::vector<const char*> T;
-
- T::const_iterator beg_p = m_undef_symbols.begin();
- T::const_iterator end_p = m_undef_symbols.end();
-
- // "STL considered harmful."
- T::const_iterator pos = find_if( beg_p, end_p, not1(bind2nd( ptr_fun(strcmp), a_sym)) );
-
- return (pos != end_p);
-}
-
--- a/toolsandutils/e32tools/checklib/object/object.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "object.h"
-#include <cassert>
-
-
-std::auto_ptr<Object> Object_factory::create(objkind_t a_kind, const char* p1, const char* p2)
-{
- switch(a_kind)
- {
- case ELF:
- return std::auto_ptr<Object>( new Elf_object(p1, p2) );
- break;
- case COFF:
- return std::auto_ptr<Object>( new Coff_object(p1, p2) );
- break;
- default:
- break;
- }
-
- assert(0);
-
- // Dead code, just to get rid of the warning.
- return std::auto_ptr<Object>(0);
-}
-
-Object::~Object() {}
-
--- a/toolsandutils/e32tools/checklib/object/object.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Classes for interpreting a memory area as an ELF or COFF object.
-// <creates>
-// Object_factory -----------------> Object
-// Elf_object Coff_object
-//
-//
-
-#ifndef OBJECT_H
-#define OBJECT_H
-
-#include <vector>
-#include <memory>
-
-
-class Object
-{
-public:
- virtual ~Object() = 0;
-public:
- // Does the object have an unresolved reference to the given symbol.
- virtual bool is_undef(const char*) const = 0;
-};
-
-class Elf_object : public Object
-{
-public:
- Elf_object(const char*, const char*);
- virtual ~Elf_object();
-public:
- virtual bool is_undef(const char*) const;
-private:
- std::vector<const char*> m_undef_symbols;
-};
-
-class Coff_object : public Object
-{
-public:
- Coff_object(const char*, const char*);
- virtual ~Coff_object();
-public:
- virtual bool is_undef(const char*) const;
-private:
- std::vector<const char*> m_undef_symbols;
-};
-
-class Object_factory
-{
-public:
- enum objkind_t {ELF, COFF};
-public:
- static std::auto_ptr<Object> create(objkind_t, const char*, const char*);
-};
-
-
-#endif
-
Binary file toolsandutils/e32tools/checklib/tag/tag_coff has changed
Binary file toolsandutils/e32tools/checklib/tag/tag_elf has changed
--- a/toolsandutils/e32tools/elf2e32/group/elf2e32.mmp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-
-target elf2e32.exe
-targettype exe
-
-sourcepath ../source
-source deffile.cpp deflatecompress.cpp dll_fb_target.cpp dll_rebuild_target.cpp e32exporttable.cpp
-source filedump.cpp e32imagefile.cpp elf2e32.cpp elffilesupplied.cpp errorhandler.cpp exetarget.cpp exexp_fb_target.cpp
-source exexp_rebuild_target.cpp export_type_fb_target.cpp export_type_rebuild_target.cpp export_type_target.cpp h_utl.cpp
-source huffman.cpp imgdump.cpp inflate.cpp librarytarget.cpp main.cpp messagehandler.cpp messageimplementation.cpp
-source parameterlistinterface.cpp parametermanager.cpp pl_common.cpp pl_dllsymbol.cpp pl_dso_handler.cpp pl_elfconsumer.cpp
-source pl_elfexecutable.cpp pl_elfexports.cpp pl_elfimportrelocation.cpp pl_elfimports.cpp pl_elflocalrelocation.cpp pl_elfproducer.cpp
-source pl_elfrelocation.cpp pl_elfrelocations.cpp pl_symbol.cpp polydll_fb_target.cpp polydll_rebuild_target.cpp usecasebase.cpp
-source byte_pair.cpp pagedcompress.cpp checksum.cpp stdexe_target.cpp
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-userinclude ../source
-userinclude ../include
-
-option GCC -w
-
-VENDORID 0x70000001
--- a/toolsandutils/e32tools/elf2e32/include/h_ver.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __H_VER_H__
-#define __H_VER_H__
-
-const TInt MajorVersion=2;
-const TInt MinorVersion=1;
-const TInt Build=15;
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/byte_pair.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,488 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "byte_pair.h"
-
-
-#undef ASSERT
-#define ASSERT(c) if(!(c)) \
- { \
- __BREAKPOINT() \
- }
-
-const TInt MaxBlockSize = 0x1000;
-
-TUint16 PairCount[0x10000];
-TUint16 PairBuffer[MaxBlockSize*2];
-
-TUint16 GlobalPairs[0x10000] = {0};
-TUint16 GlobalTokenCounts[0x100] = {0};
-
-TUint16 ByteCount[0x100+4];
-
-void CountBytes(TUint8* data, TInt size)
- {
- memset(ByteCount,0,sizeof(ByteCount));
- TUint8* dataEnd = data+size;
- while(data<dataEnd)
- ++ByteCount[*data++];
- }
-
-
-inline void ByteUsed(TInt b)
- {
- ByteCount[b] = 0xffff;
- }
-
-
-// 11915620
-// 11913551 return -ByteCount[b1]-ByteCount[b2];
-// 11913185
-
-#if 0
-int TieBreak(int b1,int b2)
- {
- int i;
- int x = 0;
- for(i=0; i<0x100; i++)
- x += PairCount[(b1<<8)+i];
- int y = 0;
- for(i=b2; i<0x10000; i+=0x100)
- y += PairCount[i];
- return -x-y;
- }
-#endif
-
-int TieBreak(int b1,int b2)
- {
- return -ByteCount[b1]-ByteCount[b2];
- }
-
-TInt MostCommonPair(TInt& pair, TUint8* data, TInt size, TInt minFrequency, TInt marker)
- {
- memset(PairCount,0,sizeof(PairCount));
- TUint8* dataEnd = data+size-1;
- TInt pairsFound = 0;
- TInt lastPair = -1;
- while(data<dataEnd)
- {
- TInt b1 = *data++;
- if(b1==marker)
- {
- // skip marker and following byte
- lastPair = -1;
- ++data;
- continue;
- }
- TInt b2 = *data;
- if(b2==marker)
- {
- // skip marker and following byte
- lastPair = -1;
- data+=2;
- continue;
- }
- TInt p = (b2<<8)|b1;
- if(p==lastPair)
- {
- // ensure a pair of identical bytes don't get double counted
- lastPair = -1;
- continue;
- }
- lastPair = p;
- ++PairCount[p];
- if(PairCount[p]==minFrequency)
- PairBuffer[pairsFound++] = (TUint16)p;
- }
-
- TInt bestCount = -1;
- TInt bestPair = -1;
- TInt bestTieBreak = 0;
- TInt p;
- while(pairsFound--)
- {
- p = PairBuffer[pairsFound];
- TInt f=PairCount[p];
- if(f>bestCount)
- {
- bestCount = f;
- bestPair = p;
- bestTieBreak = TieBreak(p&0xff,p>>8);
- }
- else if(f==bestCount)
- {
- TInt tieBreak = TieBreak(p&0xff,p>>8);
- if(tieBreak>bestTieBreak)
- {
- bestCount = f;
- bestPair = p;
- bestTieBreak = tieBreak;
- }
- }
- }
- pair = bestPair;
- return bestCount;
- }
-
-
-TInt LeastCommonByte(TInt& byte)
- {
- TInt bestCount = 0xffff;
- TInt bestByte = -1;
- for(TInt b=0; b<0x100; b++)
- {
- TInt f = ByteCount[b];
- if(f<bestCount)
- {
- bestCount = f;
- bestByte = b;
- }
- }
- byte = bestByte;
- return bestCount;
- }
-
-
-TInt Pak(TUint8* dst, TUint8* src, TInt size)
- {
- TInt originalSize = size;
- TUint8* dst2 = dst+size*2;
- TUint8* in = src;
- TUint8* out = dst;
-
- TUint8 tokens[0x100*3];
- TInt tokenCount = 0;
-
- CountBytes(in,size);
-
- TInt marker = -1;
- TInt overhead = 1+3+LeastCommonByte(marker);
- ByteUsed(marker);
-
- TUint8* inEnd = in+size;
- TUint8* outStart = out;
- while(in<inEnd)
- {
- TInt b=*in++;
- if(b==marker)
- *out++ = (TUint8)b;
- *out++ = (TUint8)b;
- }
- size = out-outStart;
-
- TInt outToggle = 1;
- in = dst;
- out = dst2;
-
- for(TInt r=256; r>0; --r)
- {
- TInt byte;
- TInt byteCount = LeastCommonByte(byte);
- TInt pair;
- TInt pairCount = MostCommonPair(pair,in,size,overhead+1,marker);
- TInt saving = pairCount-byteCount;
- if(saving<=overhead)
- break;
-
- overhead = 3;
- if(tokenCount>=32)
- overhead = 2;
-
- TUint8* d=tokens+3*tokenCount;
- ++tokenCount;
- *d++ = (TUint8)byte;
- ByteUsed(byte);
- *d++ = (TUint8)pair;
- ByteUsed(pair&0xff);
- *d++ = (TUint8)(pair>>8);
- ByteUsed(pair>>8);
- ++GlobalPairs[pair];
-
- inEnd = in+size;
- outStart = out;
- while(in<inEnd)
- {
- TInt b=*in++;
- if(b==marker)
- {
- *out++ = (TUint8)marker;
- b = *in++;
- }
- else if(b==byte)
- {
- *out++ = (TUint8)marker;
- --byteCount;
- }
- else if(b==(pair&0xff) && in<inEnd && *in==(pair>>8))
- {
- ++in;
- b = byte;
- --pairCount;
- }
- *out++ = (TUint8)b;
- }
- ASSERT(!byteCount);
- ASSERT(!pairCount);
- size = out-outStart;
-
- outToggle ^= 1;
- if(outToggle)
- {
- in = dst;
- out = dst2;
- }
- else
- {
- in = dst2;
- out = dst;
- }
- }
-
- // sort tokens with a bubble sort...
- for(TInt x=0; x<tokenCount-1; x++)
- for(TInt y=x+1; y<tokenCount; y++)
- if(tokens[x*3]>tokens[y*3])
- {
- TInt z = tokens[x*3];
- tokens[x*3] = tokens[y*3];
- tokens[y*3] = (TUint8)z;
- z = tokens[x*3+1];
- tokens[x*3+1] = tokens[y*3+1];
- tokens[y*3+1] = (TUint8)z;
- z = tokens[x*3+2];
- tokens[x*3+2] = tokens[y*3+2];
- tokens[y*3+2] = (TUint8)z;
- }
-
- // check for not being able to compress...
- if(size>originalSize)
- {
- *dst++ = 0; // store zero token count
- memcpy(dst,src,originalSize); // store original data
- return originalSize+1;
- }
-
- // make sure data is in second buffer (dst2)
- if(in!=dst2)
- memcpy(dst2,dst,size);
-
- // store tokens...
- TUint8* originalDst = dst;
- *dst++ = (TUint8)tokenCount;
- if(tokenCount)
- {
- *dst++ = (TUint8)marker;
- if(tokenCount<32)
- {
- memcpy(dst,tokens,tokenCount*3);
- dst += tokenCount*3;
- }
- else
- {
- TUint8* bitMask = dst;
- memset(bitMask,0,32);
- dst += 32;
- TUint8* d=tokens;
- do
- {
- TInt t=*d++;
- bitMask[t>>3] |= (1<<(t&7));
- *dst++ = *d++;
- *dst++ = *d++;
- }
- while(--tokenCount);
- }
- }
- // store data...
- memcpy(dst,dst2,size);
- dst += size;
-
- // get stats...
- ++GlobalTokenCounts[tokenCount];
-
- // return total size of compressed data...
- return dst-originalDst;
- }
-
-
-TInt Unpak(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext)
- {
- TUint8* dstStart = dst;
- TUint8* dstEnd = dst+dstSize;
- TUint8* srcEnd = src+srcSize;
-
- TUint32 LUT[0x100/2];
- TUint8* LUT0 = (TUint8*)LUT;
- TUint8* LUT1 = LUT0+0x100;
-
- TUint8 stack[0x100];
- TUint8* stackStart = stack+sizeof(stack);
- TUint8* sp = stackStart;
-
- TUint32 marker = ~0u;
- TInt numTokens;
- TUint32 p1;
- TUint32 p2;
-
- TUint32* l = (TUint32*)LUT;
- TUint32 b = 0x03020100;
- TUint32 step = 0x04040404;
- do
- {
- *l++ = b;
- b += step;
- }
- while(b>step);
-
- if(src>=srcEnd)
- goto error;
- numTokens = *src++;
- if(numTokens)
- {
- if(src>=srcEnd)
- goto error;
- marker = *src++;
- LUT0[marker] = (TUint8)~marker;
-
- if(numTokens<32)
- {
- TUint8* tokenEnd = src+3*numTokens;
- if(tokenEnd>srcEnd)
- goto error;
- do
- {
- TInt b = *src++;
- TInt p1 = *src++;
- TInt p2 = *src++;
- LUT0[b] = (TUint8)p1;
- LUT1[b] = (TUint8)p2;
- }
- while(src<tokenEnd);
- }
- else
- {
- TUint8* bitMask = src;
- src += 32;
- if(src>srcEnd)
- goto error;
- TInt b=0;
- do
- {
- TUint8 mask = bitMask[b>>3];
- if(mask&(1<<(b&7)))
- {
- if(src>srcEnd)
- goto error;
- TInt p1 = *src++;
- if(src>srcEnd)
- goto error;
- TInt p2 = *src++;
- LUT0[b] = (TUint8)p1;
- LUT1[b] = (TUint8)p2;
- --numTokens;
- }
- ++b;
- }
- while(b<0x100);
- if(numTokens)
- goto error;
- }
- }
-
- if(src>=srcEnd)
- goto error;
- b = *src++;
- if(dst>=dstEnd)
- goto error;
- p1 = LUT0[b];
- if(p1!=b)
- goto not_single;
-next:
- if(src>=srcEnd)
- goto done_s;
- b = *src++;
- *dst++ = (TUint8)p1;
- if(dst>=dstEnd)
- goto done_d;
- p1 = LUT0[b];
- if(p1==b)
- goto next;
-
-not_single:
- if(b==marker)
- goto do_marker;
-
-do_pair:
- p2 = LUT1[b];
- b = p1;
- p1 = LUT0[b];
- if(sp<=stack)
- goto error;
- *--sp = (TUint8)p2;
-
-recurse:
- if(b!=p1)
- goto do_pair;
-
- if(sp==stackStart)
- goto next;
- b = *sp++;
- if(dst>=dstEnd)
- goto error;
- *dst++ = (TUint8)p1;
- p1 = LUT0[b];
- goto recurse;
-
-do_marker:
- if(src>=srcEnd)
- goto error;
- p1 = *src++;
- goto next;
-
-error:
- srcNext = 0;
- return KErrCorrupt;
-
-done_s:
- *dst++ = (TUint8)p1;
- srcNext = src;
- return dst-dstStart;
-
-done_d:
- if(dst>=dstEnd)
- --src;
- srcNext = src;
- return dst-dstStart;
- }
-
-
-TUint8 PakBuffer[MaxBlockSize*4];
-TUint8 UnpakBuffer[MaxBlockSize];
-
-
-TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size)
- {
- ASSERT(size<=MaxBlockSize);
- TInt compressedSize = Pak(PakBuffer,src,size);
- TUint8* pakEnd;
- TInt us = Unpak(UnpakBuffer,MaxBlockSize,PakBuffer,compressedSize,pakEnd);
- ASSERT(us==size)
- ASSERT(pakEnd==PakBuffer+compressedSize)
- ASSERT(!memcmp(src,UnpakBuffer,size))
- if(compressedSize>=size)
- return KErrTooBig;
- memcpy(dst,PakBuffer,compressedSize);
- return compressedSize;
- }
--- a/toolsandutils/e32tools/elf2e32/source/byte_pair.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef BYTE_PAIR_H
-#define BYTE_PAIR_H
-#define __PLACEMENT_NEW_INLINE
-#define __PLACEMENT_VEC_NEW_INLINE
-/*
-#ifdef __VC32__
- #ifdef __MSVCDOTNET__
- #include <strstream>
- #include <iomanip>
-// #include <ostream.h>
- #else //!__MSVCDOTNET__
- #include <strstrea.h>
- #include <iomanip.h>
- #endif //__MSVCDOTNET__
-#else // !__VC32__
- #include <strstream.h>
- #include <iomanip.h>
-#endif // __VC32__
-*/
-#ifdef __TOOLS2__
-#include <sstream>
-#include <ostream>
-using namespace std;
-#else
-#include <strstream>
-#include <ostream.h>
-#endif
-
-
-#include <e32cmn.h>
-
-TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size);
-TInt Pak(TUint8* dst, TUint8* src, TInt size);
-TInt Unpak(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext);
-void BytePairCompress(char * bytes, TInt size, ostream &os);
-
-#endif
\ No newline at end of file
--- a/toolsandutils/e32tools/elf2e32/source/checksum.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the checksum for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "checksum.h"
-#include "e32imagedefs.h"
-
-typedef unsigned long uint32;
-typedef unsigned short uint16;
-typedef unsigned char uint8;
-
-/**
-Checksum every other byte
-
-@param aPtr A pointer to the start of the data to be checksummed.
-
-@internalComponent
-@released
-*/
-uint32 checkSum(const void *aPtr)
-{
-
- const uint8 * pB=(const uint8 *)aPtr;
- const uint8 * pE=pB+(KMaxCheckedUid*sizeof(TUid));
- uint8 buf[(KMaxCheckedUid*sizeof(TUid))>>1];
- uint8 * pT=(&buf[0]);
- while (pB<pE)
- {
- *pT++=(*pB);
- pB+=2;
- }
- unsigned short crc=0;
- Crc(crc,&buf[0],(KMaxCheckedUid*sizeof(TUid))>>1);
- return(crc);
-}
-
-//crc table
-static const uint32 crcTab[256] =
- {
- 0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,0x8108,0x9129,0xa14a,
- 0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,
- 0x72f7,0x62d6,0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,0x2462,
- 0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,0xa56a,0xb54b,0x8528,0x9509,
- 0xe5ee,0xf5cf,0xc5ac,0xd58d,0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,
- 0x46b4,0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc,0x48c4,0x58e5,
- 0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,
- 0x9969,0xa90a,0xb92b,0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,
- 0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a,0x6ca6,0x7c87,0x4ce4,
- 0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,
- 0x8d68,0x9d49,0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,0xff9f,
- 0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78,0x9188,0x81a9,0xb1ca,0xa1eb,
- 0xd10c,0xc12d,0xf14e,0xe16f,0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,
- 0x6067,0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,0x02b1,0x1290,
- 0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256,0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,
- 0xe54f,0xd52c,0xc50d,0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405,
- 0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,0x26d3,0x36f2,0x0691,
- 0x16b0,0x6657,0x7676,0x4615,0x5634,0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,
- 0xb98a,0xa9ab,0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3,0xcb7d,
- 0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,0x4a75,0x5a54,0x6a37,0x7a16,
- 0x0af1,0x1ad0,0x2ab3,0x3a92,0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,
- 0x8dc9,0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1,0xef1f,0xff3e,
- 0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,
- 0x3eb2,0x0ed1,0x1ef0
-};
-
-/**
-Performs a CCITT CRC checksum on the specified data.
-
-On return from this function, the referenced 16 bit integer contains the checksummed
-value.
-
-@param aCrc A reference to a 16 bit integer to contain the checksummed value.
-@param aPtr A pointer to the start of the data to be checksummed.
-@param aLength The length of the data to be checksummed.
-@internalComponent
-@released
-*/
-void Crc(unsigned short & aCrc,const void * aPtr,size_t aLength)
-{
-
- const uint8 * pB=(const uint8 *)aPtr;
- const uint8 * pE=pB+aLength;
- uint32 crc=aCrc;
- while (pB<pE)
- crc=(crc<<8)^crcTab[((crc>>8)^*pB++)&0xff];
- aCrc=(unsigned short)crc;
-}
-
-//crc table
-static const uint32 CrcTab32[256] =
- {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
- 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
- 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
- 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
- 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
- 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
- 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
- 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
- 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
- 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
- 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
- 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
- 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
- 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
- };
-
-/**
-Performs a CCITT CRC-32 checksum on the specified data.
-
-On return from this function, the referenced 32 bit integer contains the CRC
-value.
-
-@param aCrc A reference to a 32 bit integer to contain the CRC value.
-@param aPtr A pointer to the start of the data to be checksummed.
-@param aLength The length of the data to be checksummed.
-@internalComponent
-@released
-*/
-void Crc32(unsigned long & aCrc, const void * aPtr, size_t aLength)
-{
- const uint8 * p = (const uint8 *)aPtr;
- const uint8 * q = p + aLength;
- unsigned long crc = aCrc;
- while (p < q)
- crc = (crc >> 8) ^ CrcTab32[(crc ^ *p++) & 0xff];
- aCrc = crc;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/checksum.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for CheckSum implementation of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef CHECKSUM_H
-#define CHECKSUM_H
-
-#include <stddef.h>
-unsigned long checkSum(const void *aPtr);
-void Crc(unsigned short & aCrc,const void * aPtr,size_t aLength);
-void Crc32(unsigned long & aCrc, const void * aPtr, size_t aLength);
-
-#endif // CHECKSUM_H
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/deffile.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1002 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DefFile for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-//
-#include <stdio.h>
-#include <iostream>
-#include <stdlib.h>
-
-#include "pl_symbol.h"
-#include "deffile.h"
-#include "errorhandler.h"
-
-#ifdef __LINUX__
- #include "h_utl.h"
- #define STRUPR strupr
-#else
- #define STRUPR _strupr
-#endif
-
-using std::cerr;
-using std::cout;
-using std::endl;
-
-#define SUCCESS 1
-#define FAILURE 0
-
-/**
-Destructor to release all the allocated memory
-@internalComponent
-@released
-*/
-DefFile::~DefFile()
-{
- if(iSymbolList && iSymbolList->size())
- {
- SymbolList::iterator aItr = iSymbolList->begin();
- SymbolList::iterator last = iSymbolList->end();
- Symbol *temp;
-
- while(aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- iSymbolList->clear();
- }
- delete iSymbolList;
-}
-/**
-Function to Get File Size.
-@param fptrDef - File pointer to DEF file
-@internalComponent
-@released
-*/
-int DefFile::GetFileSize(FILE *fptrDef)
-{
- int fileSize,status;
-
- status=fseek(fptrDef, 0, SEEK_END);
- if(status!=0)
- {
- throw FileError(FILEREADERROR,iFileName);
- }
- fileSize=ftell(fptrDef);
- rewind(fptrDef);
-
- return fileSize;
-
-}
-
-/**
-Function to Open File and read it in memory.
-@param defFile - DEF File name
-@internalComponent
-@released
-*/
-char* DefFile::OpenDefFile(char * defFile)
-{
- int fileSize;
- char *defFileEntries;
- FILE *fptrDef;
-
- iFileName=defFile;
- if((fptrDef=fopen(defFile,"rb"))==NULL)
- {
- throw FileError(FILEOPENERROR,defFile);
- }
-
- fileSize=GetFileSize(fptrDef);
-
- if((defFileEntries= new char[fileSize+2]) ==NULL)
- {
- throw MemoryAllocationError(MEMORYALLOCATIONERROR,defFile);
- }
-
- //Getting whole file in memory
- if(!fread(defFileEntries, fileSize, 1, fptrDef))
- {
- throw FileError(FILEREADERROR,defFile);
- }
-
- //Adding ENTER at end
- *(defFileEntries+fileSize)='\n';
- //Adding '\0' at end
- *(defFileEntries+fileSize+1)='\0';
-
- fclose(fptrDef);
-
- return defFileEntries;
-
-}
-
-/**
-Function to Parse Def File which has been read in buffer.
-@param defFileEntries - pointer to def file entries which has been read in buffer
-@internalComponent
-@released
-*/
-void DefFile::ParseDefFile(char *defFileEntries)
-{
- iSymbolList = new SymbolList;
-
- int ordinalNo = 0;
- int symbolType=SymbolTypeCode;
- int PreviousOrdinal=0;
- char MultiLineStatement[1024]="";
- bool NAMEorLIBRARYallowed=true;
- int LineNum = 0;
- bool isComment;
-
- char *lineToken;
- int aLineLength = 0, width = 0;
- unsigned i;
- char *ptrEntry,*ptrEntryType;
- char entryType[256];
- bool entryFlag;
-
-
- lineToken=strtok(defFileEntries,"\n");
- while(lineToken != NULL)
- {
- symbolType=SymbolTypeCode;
- isComment=false;
- entryType[0]='\0';
- aLineLength = strlen(lineToken);
- LineNum++;
-
- if (lineToken == NULL || lineToken[0]==13)
- {
- lineToken=strtok(NULL,"\n");
- continue;
- }
-
- // comment lines
- if (lineToken[0] == ';')
- {
- lineToken=strtok(NULL,"\n");
- continue;
- }
-
- ptrEntry=lineToken;
-
- if((!strstr(lineToken, "NONAME") && ((ptrEntryType=strstr(lineToken, "NAME")) != NULL)) ||
- ((ptrEntryType=strstr(lineToken, "EXPORTS")) != NULL) ||
- ((ptrEntryType=strstr(lineToken, "IMPORTS")) != NULL) ||
- ((ptrEntryType=strstr(lineToken, "SECTIONS")) != NULL) ||
- ((ptrEntryType=strstr(lineToken, "LIBRARY")) != NULL) ||
- ((ptrEntryType=strstr(lineToken, "DESCRIPTION")) != NULL)||
- ((ptrEntryType=strstr(lineToken, "STACKSIZE")) != NULL)||
- ((ptrEntryType=strstr(lineToken, "VERSION")) != NULL)
- )
- {
- entryFlag=true;
-
- for(i=0; ptrEntry!=ptrEntryType; i++,ptrEntry++)
- {
- switch(lineToken[i])
- {
- case ' ':
- case '\t':
- continue;
- default:
- entryFlag=false;
- break;
- }
- if(entryFlag==false)
- break;
- }
-
- if(entryFlag==false && !strcmp(MultiLineStatement,""))
- {
- throw DEFFileError(UNRECOGNIZEDTOKEN,iFileName,LineNum,lineToken);
- }
-
- if(entryFlag==true)
- {
- switch(ptrEntryType[0])
- {
- case 'E':
- case 'I':
- case 'L':
- case 'V':
- width=7;
- break;
- case 'S':
- if(ptrEntryType[1]=='E')
- width=8;
- else
- width=9;
- break;
- case 'N':
- width=4;
- break;
- case 'D':
- width=11;
- break;
- }
- }
-
- if(entryFlag==true)
- {
- for(i=i+width; i<strlen(lineToken); i++)
- {
- switch(lineToken[i])
- {
- case ' ':
- case '\t':
- continue;
- case '\r':
- case '\0':
- break;
- default:
- entryFlag=false;
- break;
- }
-
- if(entryFlag==false)
- break;
- }
- }
-
- if(entryFlag==false && !strcmp(MultiLineStatement,""))
- {
- throw DEFFileError(UNRECOGNIZEDTOKEN,iFileName,LineNum,lineToken+i);
- }
-
- if(entryFlag==true)
- {
- strncpy(entryType, ptrEntryType, width);
- entryType[width]='\0';
-
- switch(ptrEntryType[0])
- {
- case 'E': // check for multi-line sections starting
- strcpy(MultiLineStatement, STRUPR(entryType)); // Uppercase token
- NAMEorLIBRARYallowed = false;
- lineToken = strtok(NULL, "\n" ); // Get the next line
- continue;
- case 'N':
- break;
- case 'L':
- break;
- case 'D':
- break;
- case 'S':
- case 'V':
- if(entryType[1]!='E')
- {
- // set MULTI-LINE statement to OFF
- strcpy(MultiLineStatement, STRUPR(entryType)); // Uppercase token
- // check single-line statements are specified correctly
- // check NAME or LIBRARY statements aren't supplied incorrectly
- if (!strcmp(entryType, "NAME") ||
- !strcmp(entryType, "LIBRARY")
- )
- {
- if (NAMEorLIBRARYallowed == false)
- {
- throw DEFFileError(NAMELIBRARYNOTCORRECT,iFileName,LineNum,lineToken);
- }
- lineToken=strtok(NULL,"\n");
- continue;
- }
- NAMEorLIBRARYallowed = false;
- lineToken=strtok(NULL,"\n");
- continue;
- }
- continue;
- case 'I':
- strcpy(MultiLineStatement, STRUPR(entryType)); // Uppercase token
- lineToken = strtok(NULL, "\n" ); // Get the next line
- continue;
- }
- }
-
- }
- else
- {
- if (!strcmp(MultiLineStatement,""))
- {
- throw DEFFileError(EXPORTSEXPECTED,iFileName,LineNum,lineToken);
- }
- }
-
- // Get Export entries
- if (!strcmp(MultiLineStatement,"EXPORTS"))
- {
- Symbol aSymbol(NULL, SymbolTypeCode);
- if( Tokenize(lineToken, LineNum, aSymbol) )
- {
- Symbol *newSymbolEntry = new Symbol(aSymbol);
- iSymbolList->push_back(newSymbolEntry);
-
- ordinalNo = aSymbol.OrdNum();
- //Check for ordinal sequence
- if (ordinalNo != PreviousOrdinal+1)
- {
- throw DEFFileError(ORDINALSEQUENCEERROR,iFileName,LineNum,(char*)aSymbol.SymbolName());
- }
-
- PreviousOrdinal = ordinalNo;
-
- }
- lineToken=strtok(NULL,"\n");
- continue;
- }
- else if(strcmp(MultiLineStatement,"")!=0)//For entry other than exports
- lineToken = strtok(NULL, "\n" ); // Get the next line
-
- }//End of while
-}
-
-/**
-This Function calls LineToken's Tokenize function.
-@param aTokens - Input string at the current line number
-@param aLineNum - Current line number
-@param aSymbol - Symbol to be populated while parsing the line.
-Return value - It returns true if a valid def file entry is found.
-@internalComponent
-@released
-*/
-bool DefFile::Tokenize(char* aTokens, int aLineNum, Symbol& aSymbol)
-{
- /*
- * Pattern to match is:
- * START\s*(\S+)\s+@\s*(d+)\s*(NONAME)?\s*(R3UNUSED)?\s*(ABSENT)?\s*(;\s*(.*))END
- */
- LineToken aLine(iFileName, aLineNum, aTokens, &aSymbol);
- return aLine.Tokenize();
-}
-
-
-char * DefFilePatterns[] =
- {
- "NONAME",//index 0
- "DATA",
- "R3UNUSED",
- "ABSENT"
- };
-
-#define DEF_NONAME 0
-#define DEF_DATA 1
-#define DEF_R3UNUSED 2
-#define DEF_ABSENT 3
-
-/**
-This constructor creates an instance of LineToken class.
-@param aFileName - Def File Name.
-@param aLineNum - Current line number
-@param aLn - Input string at the current line number
-@param aSym - Symbol to be populated while parsing the line.
-@internalComponent
-@released
-*/
-LineToken::LineToken(char* aFileName, int aLineNum, char *aLn, Symbol* aSym) : \
- iLine(aLn) , iSymbol(aSym) , iOffset(0), iState(EInitState),iFileName(aFileName), iLineNum(aLineNum)
-{
-}
-
-/**
-This function tokenizes the line and populates a symbol entry
-if there is one.
-Return Value - True, if the current line has a valid def entry.
-@internalComponent
-@released
-*/
-bool LineToken::Tokenize()
-{
- while (1)
- {
- switch( iState )
- {
- case EFinalState:
- return true;
- case EInitState:
- if( *(iLine + iOffset) == '\0' ||
- *(iLine + iOffset) == '\r' ||
- *(iLine + iOffset) == '\n')
- {
- /*
- * Skip empty lines.
- */
- return false;
- }
- else
- {
- NextToken();
- }
- break;
- default:
- NextToken();
- break;
- }
- }
- return false;
-}
-
-/**
-This function parses a line of the def file based on the current
-state it is in.
-@internalComponent
-@released
-*/
-void LineToken::NextToken()
-{
- int aCurrentPos = 0;
- char *aSymbolName;
-
- switch( iState )
- {
- case EInitState:
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
-
- if(IsWord(iLine + iOffset, aCurrentPos))
- {
- SetState(ESymbolName);
- }
- break;
-
- case ESymbolName:
- {
- // Get the length of the symbol
- IsWord(iLine + iOffset, aCurrentPos);
-
- char *cmt = strchr(iLine + iOffset, ';');
- char *aAlias = strchr(iLine + iOffset, '=');
-
- if( aAlias && (!cmt || (aAlias < cmt)) )
- {
- int aAliasPos = aAlias - (iLine+ iOffset);
-
- //Check if alias name is also supplied, they should be separated
- // by whitespace, i.e., SymbolName=AliasName is valid while,
- // SymbolName =AliasName is invalid.
- if( aAliasPos > aCurrentPos)
- {
- char *aToken = (iLine + iOffset + aCurrentPos);
- throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum, aToken);
- }
-
- aSymbolName = new char[aAliasPos+1];
- strncpy(aSymbolName, iLine + iOffset, aAliasPos);
- aSymbolName[aAliasPos] = '\0';
- char *aExportName = new char[aCurrentPos - aAliasPos + 1];
- strncpy(aExportName, aAlias +1, (aCurrentPos - aAliasPos));
- aExportName[(aCurrentPos - aAliasPos)] = '\0';
- iSymbol->ExportName(aExportName);
- }
- else
- {
- aSymbolName = new char[aCurrentPos+1];
- strncpy(aSymbolName, iLine+ iOffset, aCurrentPos);
- aSymbolName[aCurrentPos] = '\0';
- }
- iSymbol->SymbolName(aSymbolName);
-
- IncrOffset(aCurrentPos);
-
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
-
- if(*(iLine+iOffset) == '@')
- {
- SetState(EAtSymbol);
- IncrOffset(1);
- }
- else
- {
- /*
- * The first non-whitespace entry in a line is assumed to be the
- * symbol name and a symbol name might also have a '@' char. Hence
- * there MUST be a whitespace between symbol name and '@'.
- */
- throw DEFFileError(ATRATEMISSING,iFileName,iLineNum,(iLine+iOffset));
- }
- }
- break;
-
- case EAtSymbol:
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
-
- SetState(EOrdinal);
- break;
- case EOrdinal:
- {
- if(!IsDigit(iLine+iOffset, aCurrentPos ) )
- {
- throw DEFFileError(ORDINALNOTANUMBER, iFileName, iLineNum, (iLine+iOffset));
- }
- char aTmp[32];
- strncpy(aTmp, iLine+iOffset, aCurrentPos);
- aTmp[aCurrentPos] = '\0';
- int aOrdinal = atoi(aTmp);
- iSymbol->SetOrdinal(aOrdinal);
-
- IncrOffset(aCurrentPos);
-
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
- SetState(EOptionals);
- }
- break;
-
- case EOptionals:
- {
- int aPrevPatternIndex, aPatternIdx = 0;
- aPrevPatternIndex = -1;
- while (*(iLine + iOffset) != '\n' || *(iLine + iOffset) != '\r')
- {
- if(IsPattern(iLine+iOffset, aCurrentPos, aPatternIdx) )
- {
- switch(aPatternIdx)
- {
- case DEF_NONAME:
- break;
- case DEF_DATA:
- iSymbol->CodeDataType(SymbolTypeData);
-
- IncrOffset(aCurrentPos);
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
- if(IsDigit(iLine+iOffset, aCurrentPos ) )
- {
- char aSymSz[16];
- strncpy(aSymSz, (iLine + iOffset), aCurrentPos);
- aSymSz[aCurrentPos] = '\0';
- iSymbol->SetSymbolSize(atoi(aSymSz));
- }
- break;
- case DEF_R3UNUSED:
- iSymbol->R3Unused(true);
- break;
- case DEF_ABSENT:
- iSymbol->SetAbsent(true);
- break;
- default:
- break;
- }
-
- /*
- * NONAME , DATA, R3UNUSED and ABSENT, all the 3 are optional. But, if more than
- * one of them appear, they MUST appear in that order.
- * Else, it is not accepted.
- */
- if( aPrevPatternIndex >= aPatternIdx)
- {
- throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum,(iLine + iOffset));
- }
- aPrevPatternIndex = aPatternIdx;
-
- IncrOffset(aCurrentPos);
-
- if(IsWhiteSpace((iLine + iOffset), aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
- }
- else
- {
- if( *(iLine + iOffset) == ';' )
- {
- SetState(EComment);
- IncrOffset(1);
- return;
- }
- else if( *(iLine + iOffset) == '\0' ||
- *(iLine + iOffset) == '\r' ||
- *(iLine + iOffset) == '\n')
- {
- SetState(EFinalState);
- return;
- }
- else
- {
- throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum,(iLine + iOffset));
- }
- }
- }
- }
- break;
-
- case EComment:
- {
- if(IsWhiteSpace(iLine + iOffset, aCurrentPos))
- {
- IncrOffset(aCurrentPos);
- }
-
-
- int aLen = strlen(iLine + iOffset);
- if( *(iLine + iOffset + aLen - 1 ) == '\n' || *(iLine + iOffset + aLen - 1 ) == '\r')
- aLen -=1;
-
- char * aComment = new char[ aLen + 1];
- strncpy( aComment, iLine + iOffset, aLen);
- aComment[aLen] = '\0';
-
- IncrOffset(aLen);
-
- iSymbol->Comment(aComment);
- SetState(EFinalState);
- }
- break;
-
- case EFinalState:
- return;
- default:
- break;
- }
-}
-
-/**
-This function returns true if the string starts with one
-of the fixed patterns.
-It also updates the length and index of this pattern.
-@param aChar - Line Token
-@param aTill - Length of the pattern
-@param aTill - Index of the pattern
-Return Value - True, if the string starts with one of the patterns.
-@internalComponent
-@released
-*/
-bool LineToken::IsPattern(char* aStr, int& aTill, int& aIndex)
-{
- int pos = 0;
- int aLength;
- int size = sizeof(DefFilePatterns)/sizeof(char*);
- while(size > pos)
- {
- aLength = strlen(DefFilePatterns[pos]);
- if(!strncmp(aStr, DefFilePatterns[pos], aLength))
- {
- aTill = aLength;
- aIndex = pos;
- return true;
- }
- pos++;
- }
- return false;
-}
-
-/**
-This function returns true if the string starts with digits.
-It also updates the length of this digit string.
-@param aChar - Line Token
-@param aTill - Length of the digit string
-Return Value - True, if the string starts with digit(s)
-@internalComponent
-@released
-*/
-bool LineToken::IsDigit(char *aChar, int &aTill)
-{
- int pos = 0;
- if( aChar[pos] - '0' >= 0 && aChar[pos] - '0' <= 9)
- {
- pos++;
- while(aChar[pos] - '0' >= 0 && aChar[pos] - '0' <= 9)
- {
- pos++;
- }
- aTill = pos;
- return true;
- }
- else
- {
- return false;
- }
-}
-
-/**
-This function returns true if the string starts with white space.
-It also updates the length of this white string!
-@param aStr - Line Token
-@param aTill - Length of the white string
-Return Value - True, if the string starts with whitespace
-@internalComponent
-@released
-*/
-bool LineToken::IsWhiteSpace(char *aStr, int &aTill)
-{
- int pos = 0;
- switch( aStr[pos] )
- {
- case ' ':
- case '\t':
- break;
- default:
- return false;
- }
-
- pos++;
- while( aStr[pos])
- {
- switch(aStr[pos])
- {
- case ' ':
- case '\t':
- pos++;
- break;
- default:
- aTill = pos;
- return true;
- }
-
- }
- aTill = pos;
- return true;
-}
-
-/**
-This function returns true if the string starts with non-whitespace.
-It also updates the length of this word.
-@param aStr - Line Token
-@param aTill - Length of the word
-Return Value - True, if the string starts with non-whitespace chars.
-It also updates the length of the word.
-@internalComponent
-@released
-*/
-bool LineToken::IsWord(char *aStr, int &aTill)
-{
- int pos = 0;
- switch( aStr[pos] )
- {
- case '\0':
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- return false;
- default:
- break;
- }
-
- pos++;
- while( aStr[pos])
- {
- switch(aStr[pos])
- {
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- aTill = pos;
- return true;
- default:
- pos++;
- break;
- }
-
- }
- aTill = pos;
- return true;
-}
-
-/**
-This function increments the current offset.
-@param aOff - increment by this value
-@internalComponent
-@released
-*/
-void LineToken::IncrOffset(int aOff)
-{
- iOffset += aOff;
-}
-
-/**
-This function sets the state of the tokenizer that is parsing
-the line.
-@param aState - next state
-@internalComponent
-@released
-*/
-void LineToken::SetState(DefStates aState)
-{
- iState = aState;
-}
-
-/**
-Function to Read def file and get the internal representation in structure.
-@param defFile - DEF File name
-@internalComponent
-@released
-*/
-SymbolList* DefFile::ReadDefFile(char *defFile)
-{
- char *defFileEntries;
-
- defFileEntries=OpenDefFile(defFile);
- ParseDefFile(defFileEntries);
-
- delete [] defFileEntries;//Free the memory which was required to read def file
-
- return iSymbolList;
-
-}
-
-/**
-Function to get the internal representation of Def File.
-@param defFile - DEF File name
-@internalComponent
-@released
-*/
-SymbolList* DefFile::GetSymbolEntryList(char *defFile)
-{
- if(iSymbolList)
- {
- return iSymbolList;
- }
- else
- {
- iSymbolList=ReadDefFile(defFile);
- return iSymbolList;
- }
-
-}
-
-/**
-Function to write DEF file from symbol entry List.
-@param fileName - Def file name
-@param newSymbolList - pointer to SymbolList which we get as an input for writing in DEF File
-@internalComponent
-@released
-*/
-void DefFile::WriteDefFile(char *fileName, SymbolList * newSymbolList)
-{
-
- char ordinal[6];
- int newDefEntry=0;
- FILE *fptr;
-
- if((fptr=fopen(fileName,"wb"))==NULL)
- {
- throw FileError(FILEOPENERROR,fileName);
- }
- else
- {
- SymbolList::iterator aItr = newSymbolList->begin();
- SymbolList::iterator last = newSymbolList->end();
- Symbol *aSym;
-
- fputs("EXPORTS",fptr);
- fputs("\r\n",fptr);
- while( aItr != last)
- {
- aSym = *aItr;
- //Do not write now if its a new entry
- if(aSym->GetSymbolStatus()==New)
- {
- newDefEntry=1;
- aItr++;
- continue;
- }
-
- //Make it comment if its missing def entry
- if(aSym->GetSymbolStatus()==Missing)
- fputs("; MISSING:",fptr);
-
- fputs("\t",fptr);
- if((aSym->ExportName()) && strcmp(aSym->SymbolName(),aSym->ExportName())!=0)
- {
- fputs(aSym->ExportName(),fptr);
- fputs("=",fptr);
- }
- fputs(aSym->SymbolName(),fptr);
- fputs(" @ ",fptr);
- sprintf(ordinal,"%d",aSym->OrdNum());
- fputs(ordinal,fptr);
- fputs(" NONAME",fptr);
- if(aSym->CodeDataType()==SymbolTypeData) {
- fputs(" DATA",fptr);
- fputs(" ",fptr);
- char aSymSize[16];
- sprintf(aSymSize, "%d", aSym->SymbolSize());
- fputs(aSymSize,fptr);
- }
- if(aSym->R3unused())
- fputs(" R3UNUSED",fptr);
- if(aSym->Absent())
- fputs(" ABSENT",fptr);
-
- if(aSym->Comment()!=NULL)
- {
- fputs(" ; ",fptr);
- fputs(aSym->Comment(),fptr);
- }
- fputs("\r\n",fptr);
- aItr++;
- }
-
- //This is for writing new def entry in DEF File
- if(newDefEntry)
- {
- fputs("; NEW:",fptr);
- fputs("\r\n",fptr);
- aItr = newSymbolList->begin();
- last = newSymbolList->end();
-
- while( aItr != last)
- {
- aSym = *aItr;
- if(aSym->GetSymbolStatus()!=New)
- {
- aItr++;
- continue;
- }
- fputs("\t",fptr);
- if((aSym->ExportName()) && strcmp(aSym->SymbolName(),aSym->ExportName())!=0)
- {
- fputs(aSym->ExportName(),fptr);
- fputs("=",fptr);
- }
- fputs(aSym->SymbolName(),fptr);
- fputs(" @ ",fptr);
- sprintf(ordinal,"%d",aSym->OrdNum());
- fputs(ordinal,fptr);
- fputs(" NONAME",fptr);
-
- if(aSym->CodeDataType()==SymbolTypeData) {
- fputs(" DATA",fptr);
- fputs(" ",fptr);
- char aSymSize[16];
- sprintf(aSymSize, "%d", aSym->SymbolSize());
- fputs(aSymSize,fptr);
- }
-
- if(aSym->R3unused())
- fputs(" R3UNUSED",fptr);
- if(aSym->Absent())
- fputs(" ABSENT",fptr);
-
- if(aSym->Comment()!=NULL)
- {
- if(aSym->CodeDataType()!=SymbolTypeCode &&
- aSym->CodeDataType()!=SymbolTypeData)
- {
- fputs(" ; ",fptr);
- fputs(aSym->Comment(),fptr);
- }
- else
- {
- fputs(" ",fptr);
- fputs(aSym->Comment(),fptr);
- }
- }
- fputs("\r\n",fptr);
- aItr++;
- }
- }
- fputs("\r\n",fptr);
- fclose(fptr);
- }
-}
--- a/toolsandutils/e32tools/elf2e32/source/deffile.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DefFile for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef _DEF_FILE_
-#define _DEF_FILE_
-
-#include <list>
-
-class Symbol;
-typedef std::list <Symbol*> SymbolList;
-
-/**
-Class for DEF File Handler.
-@internalComponent
-@released
-*/
-class DefFile
-{
- public:
- DefFile():iSymbolList(NULL){};
- virtual ~DefFile();
- SymbolList* ReadDefFile(char *defFile);
- void WriteDefFile(char *fileName, SymbolList *newSymbolList);
- SymbolList* GetSymbolEntryList(char *defFile);
- SymbolList* GetSymbolEntryList() { return iSymbolList;}
- private:
- char *iFileName;
- SymbolList *iSymbolList;
- int GetFileSize(FILE * fptrDef);
- char* OpenDefFile(char *defFile);
- void ParseDefFile(char *defData);
- bool Tokenize(char* tokens, int aLineNum, Symbol& aSymbol);
-};
-
-//Different states while parsing a line in the def file.
-enum DefStates
-{
- EInitState = 0,
- ESymbolName = 1,
- EAtSymbol,
- EOrdinal,
- EOptionals,
- EComment,
- EFinalState,
- EInvalidState
-};
-
-#define CODESYM "CODE"
-#define DATASYM "DATA"
-
-/**
-Class for parsing a line from the DEF File.
-@internalComponent
-@released
-*/
-class LineToken
-{
-public:
- LineToken(char* , int , char *, Symbol *aSym);
- char *iLine;
- Symbol *iSymbol;
- int iOffset;
- DefStates iState;
-
- char *iFileName;
- int iLineNum;
-
- bool Tokenize();
- void NextToken();
- void IncrOffset(int aOff);
- void SetState(DefStates aState);
-
- bool IsWhiteSpace(char *aStr, int&);
- bool IsPattern(char*, int&, int&);
- bool IsDigit(char*, int&);
- bool IsWord(char*, int&);
-};
-#endif
--- a/toolsandutils/e32tools/elf2e32/source/deflatecompress.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,514 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include <fstream>
-#include <cassert>
-
-#include "e32imagedefs.h"
-#include "errorhandler.h"
-#include "farray.h"
-#include "huffman.h"
-
-const TInt KDeflateMinLength=3;
-const TInt KDeflateMaxLength=KDeflateMinLength-1 + (1<<KDeflateLengthMag);
-const TInt KDeflateMaxDistance=(1<<KDeflateDistanceMag);
-
-// hashing
-const TUint KDeflateHashMultiplier=0xAC4B9B19u;
-const TInt KDeflateHashShift=24;
-
-#define COMPILE_TIME_ASSERT(e) \
- switch (0) \
- { \
- case 0: \
- case e: \
- ; \
- }
-
-/**
-Class HDeflateHash
-@internalComponent
-@released
-*/
-class HDeflateHash
-{
- public:
- inline static HDeflateHash* NewLC(TInt aLinks);
-//
- inline TInt First(const TUint8* aPtr,TInt aPos);
- inline TInt Next(TInt aPos,TInt aOffset) const;
- private:
- inline HDeflateHash();
- inline static TInt Hash(const TUint8* aPtr);
- private:
- typedef TUint16 TOffset;
- private:
- TInt iHash[256];
- TOffset iOffset[1]; // or more
-};
-
-/**
-Class MDeflater
-@internalComponent
-@released
-*/
-class MDeflater
-{
- public:
- void DeflateL(const TUint8* aBase,TInt aLength);
- private:
- const TUint8* DoDeflateL(const TUint8* aBase,const TUint8* aEnd,HDeflateHash& aHash);
- static TInt Match(const TUint8* aPtr,const TUint8* aEnd,TInt aPos,HDeflateHash& aHas);
- void SegmentL(TInt aLength,TInt aDistance);
- virtual void LitLenL(TInt aCode) =0;
- virtual void OffsetL(TInt aCode) =0;
- virtual void ExtraL(TInt aLen,TUint aBits) =0;
-};
-
-/**
-Class TDeflateStats
-@internalComponent
-@released
-*/
-class TDeflateStats : public MDeflater
-{
- public:
- inline TDeflateStats(TEncoding& aEncoding);
- private:
- // from MDeflater
- void LitLenL(TInt aCode);
- void OffsetL(TInt aCode);
- void ExtraL(TInt aLen,TUint aBits);
- private:
- TEncoding& iEncoding;
-};
-
-/**
-Class TDeflater
-@internalComponent
-@released
-*/
-class TDeflater : public MDeflater
-{
- public:
- inline TDeflater(TBitOutput& aOutput,const TEncoding& aEncoding);
- private:
- // from MDeflater
- void LitLenL(TInt aCode);
- void OffsetL(TInt aCode);
- void ExtraL(TInt aLen,TUint aBits);
- private:
- TBitOutput& iOutput;
- const TEncoding& iEncoding;
-};
-
-
-/**
-Constructor for class HDeflateHash
-@internalComponent
-@released
-*/
-inline HDeflateHash::HDeflateHash()
-{TInt* p=iHash+256;do *--p=-KDeflateMaxDistance-1; while (p>iHash);}
-
-/**
-@Leave - OutOfMemory
-This function allocates memory for HDeflateHash
-@param aLinks
-@return pointer to allocated memory
-@internalComponent
-@released
-*/
-inline HDeflateHash* HDeflateHash::NewLC(TInt aLinks)
-{
-#if __GNUC__ >= 4
- // Try to detect if the class' layout has changed.
- COMPILE_TIME_ASSERT( sizeof(HDeflateHash) == 1028 );
- COMPILE_TIME_ASSERT( sizeof(TOffset) == 2 );
- COMPILE_TIME_ASSERT( offsetof(HDeflateHash, iHash) < offsetof(HDeflateHash, iOffset) );
-
- // Compute the size of the class, including rounding it up to a multiple of 4
- // bytes.
-
- unsigned n = sizeof(TInt) * 256 + sizeof(TOffset) * Min(aLinks, KDeflateMaxDistance);
-
- while (n & 0x1f)
- {
- n++;
- }
-
- // Allocate the raw memory ...
- void* p = ::operator new(n);
-
- // ... And create the object in that memory.
- return new(p) HDeflateHash;
-#else
- return new(new char[_FOFF(HDeflateHash,iOffset[Min(aLinks,KDeflateMaxDistance)])]) HDeflateHash;
-#endif
-}
-
-/**
-Hash function for HDeflateHash
-@param aPtr
-@return Hash value
-@internalComponent
-@released
-*/
-inline TInt HDeflateHash::Hash(const TUint8* aPtr)
-{
- TUint x=aPtr[0]|(aPtr[1]<<8)|(aPtr[2]<<16);
- return (x*KDeflateHashMultiplier)>>KDeflateHashShift;
-}
-
-/**
-Function First
-@param aPtr
-@param aPos
-@internalComponent
-@released
-*/
-inline TInt HDeflateHash::First(const TUint8* aPtr,TInt aPos)
-{
- TInt h=Hash(aPtr);
- TInt offset=Min(aPos-iHash[h],KDeflateMaxDistance<<1);
- iHash[h]=aPos;
- iOffset[aPos&(KDeflateMaxDistance-1)]=TOffset(offset);
- return offset;
-}
-
-/**
-Function Next
-@param aPtr
-@param aPos
-@internalComponent
-@released
-*/
-inline TInt HDeflateHash::Next(TInt aPos,TInt aOffset) const
-{return aOffset+iOffset[(aPos-aOffset)&(KDeflateMaxDistance-1)];}
-
-
-// Class TDeflater
-//
-// generic deflation algorithm, can do either statistics and the encoder
-
-/**
-Function Match
-@param aPtr
-@param aEnd
-@param aPos
-@param aHash
-@internalComponent
-@released
-*/
-TInt MDeflater::Match(const TUint8* aPtr,const TUint8* aEnd,TInt aPos,HDeflateHash& aHash)
-{
- TInt offset=aHash.First(aPtr,aPos);
- if (offset>KDeflateMaxDistance)
- return 0;
- TInt match=0;
- aEnd=Min(aEnd,aPtr+KDeflateMaxLength);
- TUint8 c=*aPtr;
- do
- {
- const TUint8* p=aPtr-offset;
- if (p[match>>16]==c)
- { // might be a better match
- const TUint8* m=aPtr;
- for (;;)
- {
- if (*p++!=*m++)
- break;
- if (m<aEnd)
- continue;
- return ((m-aPtr)<<16)|offset;
- }
- TInt l=m-aPtr-1;
- if (l>match>>16)
- {
- match=(l<<16)|offset;
- c=m[-1];
- }
- }
- offset=aHash.Next(aPos,offset);
- } while (offset<=KDeflateMaxDistance);
- return match;
-}
-
-/*
-Apply the deflation algorithm to the data [aBase,aEnd)
-Return a pointer after the last byte that was deflated (which may not be aEnd)
-@param aBase
-@param aEnd
-@param aHash
-@internalComponent
-@released
-*/
-const TUint8* MDeflater::DoDeflateL(const TUint8* aBase,const TUint8* aEnd,HDeflateHash& aHash)
-{
- const TUint8* ptr=aBase;
- TInt prev=0; // the previous deflation match
- do
- {
- TInt match=Match(ptr,aEnd,ptr-aBase,aHash);
-// Extra deflation applies two optimisations which double the time taken
-// 1. If we have a match at p, then test for a better match at p+1 before using it
-// 2. When we have a match, add the hash links for all the data which will be skipped
- if (match>>16 < prev>>16)
- { // use the previous match--it was better
- TInt len=prev>>16;
- SegmentL(len,prev-(len<<16));
- // fill in missing hash entries for better compression
- const TUint8* e=ptr+len-2;
- do
- {
- ++ptr;
- if (ptr + 2 < aEnd)
- aHash.First(ptr,ptr-aBase);
- } while (ptr<e);
- prev=0;
- }
- else if (match<=(KDeflateMinLength<<16))
- LitLenL(*ptr); // no deflation match here
- else
- { // save this match and test the next position
- if (prev) // we had a match at ptr-1, but this is better
- LitLenL(ptr[-1]);
- prev=match;
- }
- ++ptr;
- } while (ptr+KDeflateMinLength-1<aEnd);
- if (prev)
- { // emit the stored match
- TInt len=prev>>16;
- SegmentL(len,prev-(len<<16));
- ptr+=len-1;
- }
- return ptr;
-}
-
-/*
-The generic deflation algorithm
-@param aBase
-@param aLength
-@internalComponent
-@released
-*/
-void MDeflater::DeflateL(const TUint8* aBase,TInt aLength)
-{
- const TUint8* end=aBase+aLength;
- if (aLength>KDeflateMinLength)
- { // deflation kicks in if there is enough data
- HDeflateHash* hash=HDeflateHash::NewLC(aLength);
-
- aBase=DoDeflateL(aBase,end,*hash);
- delete hash;
- }
- while (aBase<end) // emit remaining bytes
- LitLenL(*aBase++);
- LitLenL(TEncoding::EEos); // eos marker
-}
-
-/*
-Turn a (length,offset) pair into the deflation codes+extra bits before calling the specific
-LitLen(), Offset() and Extra() functions.
-@param aLength
-@param aDistance
-@internalComponent
-@released
-*/
-void MDeflater::SegmentL(TInt aLength,TInt aDistance)
-{
- aLength-=KDeflateMinLength;
- TInt extralen=0;
- TUint len=aLength;
- while (len>=8)
- {
- ++extralen;
- len>>=1;
- }
- LitLenL((extralen<<2)+len+TEncoding::ELiterals);
- if (extralen)
- ExtraL(extralen,aLength);
-//
- aDistance--;
- extralen=0;
- TUint dist=aDistance;
- while (dist>=8)
- {
- ++extralen;
- dist>>=1;
- }
- OffsetL((extralen<<2)+dist);
- if (extralen)
- ExtraL(extralen,aDistance);
-}
-
-/**
-Class TDeflateStats
-This class analyses the data stream to generate the frequency tables
-for the deflation algorithm
-@internalComponent
-@released
-*/
-inline TDeflateStats::TDeflateStats(TEncoding& aEncoding)
- :iEncoding(aEncoding)
- {}
-/*
-Function LitLenL
-@Leave
-@param aCode
-@internalComponent
-@released
-*/
-void TDeflateStats::LitLenL(TInt aCode)
- {
- ++iEncoding.iLitLen[aCode];
- }
-
-/*
-@Leave ArrayIndexOutOfBounds
-Finction OffsetL
-@param aCode
-@internalComponent
-@released
-*/
-void TDeflateStats::OffsetL(TInt aCode)
- {
- ++iEncoding.iDistance[aCode];
- }
-
-/*
-Function ExtraL
-@Leave
-@internalComponent
-@released
-*/void TDeflateStats::ExtraL(TInt,TUint)
- {}
-
-/**
-Constructor of Class TDeflater
-Extends MDeflater to provide huffman encoding of the output
-@internalComponent
-@released
-*/
-inline TDeflater::TDeflater(TBitOutput& aOutput,const TEncoding& aEncoding)
-//
-// construct for encoding
-//
- :iOutput(aOutput),iEncoding(aEncoding)
- {}
-
-/*
-Function LitLenL
-@Leave
-@param aCode
-@internalComponent
-@released
-*/
-void TDeflater::LitLenL(TInt aCode)
- {
- iOutput.HuffmanL(iEncoding.iLitLen[aCode]);
- }
-
-/*
-Function OffsetL
-@Leave
-@param aCdoe
-@internalComponent
-@released
-*/
-void TDeflater::OffsetL(TInt aCode)
- {
- iOutput.HuffmanL(iEncoding.iDistance[aCode]);
- }
-
-/*
-Function ExtraL
-@Leave
-@param aLen
-@param aBits
-@internalComponent
-@released
-*/
-void TDeflater::ExtraL(TInt aLen,TUint aBits)
- {
- iOutput.WriteL(aBits,aLen);
- }
-/*
-Function DoDeflateL
-@Leave
-@param aBuf
-@param aLength
-@param aOutput
-@param aEncoding
-@internalComponent
-@released
-*/
-void DoDeflateL(const TUint8* aBuf,TInt aLength,TBitOutput& aOutput,TEncoding& aEncoding)
- {
-// analyse the data for symbol frequency
- TDeflateStats analyser(aEncoding);
- analyser.DeflateL(aBuf,aLength);
-
-// generate the required huffman encodings
- Huffman::HuffmanL(aEncoding.iLitLen,TEncoding::ELitLens,aEncoding.iLitLen);
- Huffman::HuffmanL(aEncoding.iDistance,TEncoding::EDistances,aEncoding.iDistance);
-
-// Store the encoding table
- Huffman::ExternalizeL(aOutput,aEncoding.iLitLen,KDeflationCodes);
-
-// generate the tables
- Huffman::Encoding(aEncoding.iLitLen,TEncoding::ELitLens,aEncoding.iLitLen);
- Huffman::Encoding(aEncoding.iDistance,TEncoding::EDistances,aEncoding.iDistance);
-
-// now finally deflate the data with the generated encoding
- TDeflater deflater(aOutput,aEncoding);
- deflater.DeflateL(aBuf,aLength);
- aOutput.PadL(1);
- }
-
-/*
-Function DeflateL
-@Leave
-@param aBuf
-@param aLength
-@param aOutput
-@internalComponent
-@released
-*/
-void DeflateL(const TUint8* aBuf, TInt aLength, TBitOutput& aOutput)
- {
- TEncoding* encoding=new TEncoding;
- memset(encoding,0,sizeof(TEncoding));
- DoDeflateL(aBuf,aLength,aOutput,*encoding);
- delete encoding;
- }
-/*
-Function DeflateCompress
-@param bytes
-@param size
-@param os
-@internalComponent
-@released
-*/
-void DeflateCompress(char *bytes,size_t size, std::ofstream & os)
- {
- TFileOutput* output=new TFileOutput(os);
- output->iDataCount = 0;
- DeflateL((TUint8*)bytes,size,*output);
- output->FlushL();
- delete output;
- }
-
--- a/toolsandutils/e32tools/elf2e32/source/dll_fb_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExeTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "dll_fb_target.h"
-
-/**
-Constructor for the DLLFBTarget Class
-
-@internalComponent
-@released
-*/
-DLLFBTarget::DLLFBTarget(ParameterListInterface* aParameterListInterface) : ExportTypeFBTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the DLLFBTarget Class
-
-@internalComponent
-@released
-*/
-DLLFBTarget::~DLLFBTarget() {
-}
-
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/dll_fb_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for DLL First build Target Type
-// @internalComponent
-// @released
-//
-//
-
-#ifndef DLLFB_TARGET_H
-#define DLLFB_TARGET_H
-
-#include "export_type_fb_target.h"
-
-/**
-This class is derived from the base class ExportTypeFBTarget and is responsible for creation of
-DLL Target.It passes the input ELF file to the ELFfile Handler to get the Symbol list
-and then passes the Symbol List to the DSOHandler to generate the DSO file and then the E32 image.
-
-@internalComponent
-@released
-*/
-class DLLFBTarget : public ExportTypeFBTarget
-{
-
-public:
- DLLFBTarget(ParameterListInterface* aParameterListInterface);
- ~DLLFBTarget();
-};
-
-
-#endif // DLLFB_TARGET_H
--- a/toolsandutils/e32tools/elf2e32/source/dll_rebuild_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// dll_fb_target.cpp
-// Implementation of the Class ExeTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "dll_rebuild_target.h"
-
-/**
-Constructor for the DLLRebuildTarget Class
-
-@internalComponent
-@released
-*/
-DLLRebuildTarget::DLLRebuildTarget(ParameterListInterface* aParameterListInterface) : ExportTypeRebuildTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the DLLRebuildTarget Class
-
-@internalComponent
-@released
-*/
-DLLRebuildTarget::~DLLRebuildTarget() {
-}
-
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/dll_rebuild_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for DLL Rebuild Target Type
-// @internalComponent
-// @released
-//
-//
-
-#ifndef DLL_REBUILD_TARGET_H
-#define DLL_REBUILD_TARGET_H
-
-#include "export_type_rebuild_target.h"
-
-/**
-This class is derived from the base class ExportTypeRebuildTarget and is responsible for creation of
-DLL Target.
-
-@internalComponent
-@released
-*/
-
-class DLLRebuildTarget : public ExportTypeRebuildTarget
-{
-
-public:
- DLLRebuildTarget(ParameterListInterface* aParameterListInterface);
- ~DLLRebuildTarget();
-};
-
-#endif // DLL_REBUILD_TARGET_H
-
--- a/toolsandutils/e32tools/elf2e32/source/e32defwrap.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Wrapper for e32def.h to undefine _L macros to prevent
-// warnings.
-// @internalComponent
-// @released
-
-//
-//
-
-#ifndef __E32DEFWRAP_H__
-#define __E32DEFWRAP_H__
-
-#ifdef _L
-#undef _L
-#endif
-
-
-
-#include <e32def.h>
-#include <e32def_private.h>
-
-#ifdef _L
-#undef _L
-#endif
-
-
-#endif // E32IMAGEDEFS_H
-
--- a/toolsandutils/e32tools/elf2e32/source/e32exporttable.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "e32exporttable.h"
-#include "pl_elfexecutable.h"
-#include "pl_elfexports.h"
-#include "pl_dllsymbol.h"
-#include "pl_elflocalrelocation.h"
-
-/**
-Destructor for E32ExportTable class.
-@internalComponent
-@released
-*/
-E32ExportTable::~E32ExportTable()
-{
- delete [] iTable;
-}
-
-/**
-This function updates the e32 export table.
-@param aElfExecutable - Elf executable
-@param aExportList - export symbol list
-@internalComponent
-@released
-*/
-void E32ExportTable::CreateExportTable(ElfExecutable * aElfExecutable, ElfExports::ExportList & aExportList)
-{
- iElfExecutable = aElfExecutable;
- // ELFExports::ExportList aExportList = aElfExecutable->GetExportsInOrdinalOrder();
- // The export table has a header containing the number of entries
- // before the entries themselves. So add 1 to number of exports
- iNumExports = aExportList.size();
- size_t aSize = iNumExports + 1;
- iSize = aSize * sizeof(MemAddr);
- iTable = new unsigned int[aSize];
- // Set up header
- iTable[0] = aExportList.size();
- Elf32_Phdr * aROHdr = aElfExecutable->iCodeSegmentHdr;
- // The export table starts after the header. NB this is a virtual address in the RO
- // segment of the E32Image. It is outside the ELF RO segment.
- Elf32_Addr * aPlace = ELF_ENTRY_PTR(Elf32_Addr, aROHdr->p_vaddr, aROHdr->p_filesz) + 1;
- iExportTableAddress = (Elf32_Addr)aPlace;
- // Tell the E32Image constructor that it must allocate the export table
- // i.e. copy it from iTable.
- iAllocateP = true;
- bool aDelSym;
- ElfExports::ExportList::iterator first = aExportList.begin();
- for (PLUINT32 i = 1; i < aSize; i++, first++)
- {
- Elf32_Sym * sym;
-
- unsigned int ptr;
- if ((*first)->Absent())
- {
- ptr = aElfExecutable->iEntryPoint;
- sym = new Elf32_Sym;
- memset(sym, 0, sizeof(Elf32_Sym));
- sym->st_value = ptr;
- aDelSym = true;
- }
- else
- {
- ptr = (*first)->iElfSym->st_value;
- sym = (*first)->iElfSym;
- aDelSym = false;
- }
- // set up the pointer
- iTable[i] = ptr;
- ElfLocalRelocation * aRel = new ElfLocalRelocation(iElfExecutable, (Elf32_Addr)aPlace++, 0, i, R_ARM_ABS32, NULL, ESegmentRO, sym, aDelSym);
- aRel->Add();
-
- }
-}
-
-/**
-This function returns the number of exports.
-@internalComponent
-@released
-*/
-size_t E32ExportTable::GetNumExports()
-{
- return iNumExports;
-}
-
-/**
-This function tells the e32 image allocator if space is required to
-be allocated for export table.
-@internalComponent
-@released
-*/
-bool E32ExportTable::AllocateP(){
- return iAllocateP;
-}
-
-/**
-This function returns the e32 export table size.
-@internalComponent
-@released
-*/
-size_t E32ExportTable::GetExportTableSize(){
- return iSize;
-}
-
-/**
-This function returns e32 export table.
-@internalComponent
-@released
-*/
-unsigned int * E32ExportTable::GetExportTable() {
- return iTable;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/e32exporttable.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Class for E32 Export Table implementation of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef __E32EXPORTTABLE__
-#define __E32EXPORTTABLE__
-
-#include <tools/elfdefs.h>
-
-#include "pl_elfexports.h"
-
-class ElfExecutable;
-
-/**
-class for E32 Export Table
-@internalComponent
-@released
-*/
-class E32ExportTable {
- public:
- E32ExportTable() :
- iElfExecutable(0), iSize(0), iTable(0), iExportTableAddress(0),
- iAllocateP(true), iNumExports(0)
- {};
- ~E32ExportTable();
- void CreateExportTable(ElfExecutable * aElfExecutable, ElfExports::ExportList & aExportList);
- size_t GetNumExports();
- bool AllocateP();
- size_t GetExportTableSize();
- unsigned int * GetExportTable();
-
- public:
- ElfExecutable * iElfExecutable;
- size_t iSize;
- unsigned int * iTable;
- // NB. This a virtual address (within the RO segment).
- Elf32_Addr iExportTableAddress;
- // True if the postlinker must allocate the export table in the E32Image.
- // This should only be false for custom built ELF executables.
- bool iAllocateP;
- size_t iNumExports;
-};
-
-
-#endif
--- a/toolsandutils/e32tools/elf2e32/source/e32imagedefs.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for E32 Image implementation of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#define __PLACEMENT_NEW
-#define __PLACEMENT_VEC_NEW_INLINE
-
-#ifndef E32IMAGEDEFS_H
-#define E32IMAGEDEFS_H
-
-// Pick up E32Image definitions
-// need the following to suppress interence from EPOC definitions
-#define __PLACEMENT_NEW
-#define __PLACEMENT_VEC_NEW_INLINE
-#ifdef _L
-#undef _L
-#endif
-
-#ifdef _S
-#undef _S
-#endif
-#include <e32ldr.h>
-#include <f32image.h>
-#include <e32def_private.h>
-
-#endif // E32IMAGEDEFS_H
-
--- a/toolsandutils/e32tools/elf2e32/source/e32imagefile.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1994 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of e32 image creation and dump for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfexecutable.h"
-
-// get E32ImageHeader class...
-#define INCLUDE_E32IMAGEHEADER_IMPLEMENTATION
-#define RETURN_FAILURE(_r) return (fprintf(stderr, "line %d\n", __LINE__),_r)
-//#define E32IMAGEHEADER_TRACE(_t) printf _t
-#include "e32imagefile.h"
-
-#include "pl_elfimportrelocation.h"
-#include "pl_elflocalrelocation.h"
-#include "pl_elfimports.h"
-#include "elffilesupplied.h"
-#include "pl_dllsymbol.h"
-#include "h_ver.h"
-#include "checksum.h"
-#include "errorhandler.h"
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <iostream>
-#ifndef __LINUX__
- #include <io.h>
-#else
- #include <time.h>
-#endif
-#include <time.h>
-#include <stdio.h>
-
-using namespace std;
-
-template <class T> inline T Align(T v, size_t s)
-{
- unsigned int inc = s-1;
- unsigned int mask = ~inc;
- unsigned int val = (unsigned int)v;
- unsigned int res = (val+inc) & mask;
- return (T)res;
-}
-
-// Need a default constructor for TVersion, but don't want all the other stuff in h_utl.cpp
-/**
-Default constructor for TVersion class.
-@internalComponent
-@released
-*/
-TVersion::TVersion(){}
-
-/**
-Constructor for TVersion class.
-@internalComponent
-@released
-*/
-TVersion::TVersion(TInt aMajor, TInt aMinor, TInt aBuild):
- iMajor((TInt8)aMajor), iMinor((TInt8)aMinor), iBuild((TInt16)aBuild)
-{
-}
-
-
-/**
-Constructor for E32ImageChunkDesc class.
-@internalComponent
-@released
-*/
-E32ImageChunkDesc::E32ImageChunkDesc(char * aData, size_t aSize, size_t aOffset, char * aDoc):
- iData(aData), iSize(aSize), iOffset(aOffset), iDoc(aDoc)
-{
-}
-
-/**
-Destructor for E32ImageChunkDesc class.
-@internalComponent
-@released
-*/
-E32ImageChunkDesc::~E32ImageChunkDesc()
-{
-}
-
-/**
-This function writes its data in the buffer.
-@param aPlace - a location in the buffer
-@internalComponent
-@released
-*/
-void E32ImageChunkDesc::Write(char * aPlace)
-{
- memcpy(aPlace+iOffset, iData, iSize);
-}
-
-/**
-Constructor for E32ImageChunks class.
-@internalComponent
-@released
-*/
-E32ImageChunks::E32ImageChunks():
- iOffset(0)
-{
-}
-
-/**
-Destructor for E32ImageChunks class.
-@internalComponent
-@released
-*/
-E32ImageChunks::~E32ImageChunks()
-{
- if(iChunks.size())
- {
- ChunkList::iterator aItr = iChunks.begin();
- ChunkList::iterator last = iChunks.end();
- E32ImageChunkDesc *temp;
-
- while( aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- }
-}
-
-/**
-This function creates and adds a chunk into a list.
-@param aData - input buffer
-@param asize - size of the input buffer
-@param aOffset - byte offset of this chunk from the 1 byte in e32 image file.
-@param aDoc - name of the chunk
-@internalComponent
-@released
-*/
-void E32ImageChunks::AddChunk(char * aData, size_t aSize, size_t aOffset, char * aDoc)
-{
- E32ImageChunkDesc * aChunk = new E32ImageChunkDesc(aData, aSize, aOffset, aDoc);
- iChunks.push_back(aChunk);
- iOffset += Align(aSize, sizeof(TUint32));
-}
-
-/**
-This function returns the list of chunks.
-@internalComponent
-@released
-*/
-E32ImageChunks::ChunkList & E32ImageChunks::GetChunks()
-{
- return iChunks;
-}
-
-/**
-This function returns the current offset pointing to the last chunk that
-was added into the list of chunks.
-@internalComponent
-@released
-*/
-size_t E32ImageChunks::GetOffset()
-{
- return iOffset;
-}
-
-/**
-This function sets the current offset pointing to the last chunk that
-was added into the list of chunks.
-@internalComponent
-@released
-*/
-void E32ImageChunks::SetOffset(size_t aOffset)
-{
- iOffset = aOffset;
-}
-
-/**
-Constructor for E32ImageFile class.
-@internalComponent
-@released
-*/
-E32ImageFile::E32ImageFile(const char * aFileName, ElfExecutable * aExecutable, ElfFileSupplied *aUseCase) :
- iFileName(aFileName),
- iE32Image(0),
- iExportBitMap(0),
- iElfExecutable(aExecutable),
- iData(0),
- iUseCase(aUseCase),
- iHdr(0),
- iHdrSize(sizeof(E32ImageHeaderV)),
- iImportSection(0),
- iImportSectionSize(0),
- iCodeRelocs(0),
- iCodeRelocsSize(0),
- iDataRelocs(0),
- iDataRelocsSize(0),
- iExportOffset(0),
- iLayoutDone(false),
- iMissingExports(0),
- iSymNameOffset(0)
-{
-}
-
-/**
-This function generates the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::GenerateE32Image()
-{
- if( iUseCase->GetNamedSymLookup() ){
- ProcessSymbolInfo();
- }
- ProcessImports();
- ProcessRelocations();
- ConstructImage();
-}
-
-/**
-This function processes the import map by looking into the dso files
-from which the symbols are imported. It also fetches the ordinal numbers
-for the corresponding symbols.
-@internalComponent
-@released
-*/
-void E32ImageFile::ProcessImports()
-{
- string aStrTab;
- vector<int> aStrTabOffsets;
- int aNumDlls = 0;
- int aNumImports = 0;
- bool aNamedLookup = iUseCase->GetNamedSymLookup();
- TUint aImportTabEntryPos = 0;
-
- ElfImports::ImportMap aImportMap = iElfExecutable->GetImports();
- ElfImports::ImportMap::iterator p;
-
- // First set up the string table and record offsets into string table of each
- // LinkAs name.
- for (p = aImportMap.begin(); p != aImportMap.end(); p++)
- {
- ElfImports::RelocationList & aImports = (*p).second;
- char* aLinkAs = aImports[0]->iVerRecord->iLinkAs;
-
- aStrTabOffsets.push_back(aStrTab.size()); //
- string s = aLinkAs;
- aStrTab.insert(aStrTab.end(),s.begin(),s.end());
- aStrTab.insert(aStrTab.end(),0);
- aNumDlls++;
- aNumImports += aImports.size();
- }
-
- iNumDlls = aNumDlls;
- iNumImports = aNumImports;
-
- // Now we can figure out the size of everything
- size_t aImportSectionSize = sizeof(E32ImportSection) +
- (sizeof(E32ImportBlock) * aNumDlls) +
- (sizeof(unsigned int) * aNumImports);
-
- vector<Elf32_Word> aImportSection;
-
- // This is the 'E32ImportSection' header - fill with 0 for the moment
- aImportSection.push_back(0);
-
- if( aNamedLookup ) {
- // These are the 0th ordinals imported into the import table, one
- // entry for each DLL.
- aImportSectionSize += (sizeof(unsigned int) * aNumDlls);
- }
- // Now fill in the E32ImportBlocks
- int idx = 0;
- char * aDsoName;
- for (p = aImportMap.begin(); p != aImportMap.end(); p++, idx++)
- {
- ElfImports::RelocationList & aImports = (*p).second;
- aDsoName = aImports[0]->iVerRecord->iSOName;
-
- //const char * aDSO = FindDSO((*p).first);
- const char * aDSO = FindDSO(aDsoName);
-
- aImportSection.push_back(aStrTabOffsets[idx] + aImportSectionSize);
- int nImports = aImports.size();
-
- // Take the additional 0th ordinal import into account
- if( aNamedLookup )
- nImports++;
- aImportSection.push_back(nImports);
-
- size_t aSize;
- Elf32_Ehdr * aElfFile = 0;
- ReadInputELFFile(aDSO, aSize, aElfFile);
-
- ElfExecutable aElfExecutable(NULL);//(aElfFile, aSize);
- aElfExecutable.ProcessElfFile(aElfFile);
-
- ElfImports::RelocationList::iterator q;
- for (q = aImports.begin(); q != aImports.end(); q++)
- {
- ElfImportRelocation * aReloc = *q;
- char * aSymName = iElfExecutable->GetSymbolName(aReloc->iSymNdx);
- unsigned int aOrdinal = aElfExecutable.GetSymbolOrdinal(aSymName);
-
- //check the reloc refers to Code Segment
- try
- {
- if (iElfExecutable->SegmentType(aReloc->iAddr) != ESegmentRO)
- {
- throw ImportRelocationError(ILLEGALEXPORTFROMDATASEGMENT, aSymName, iElfExecutable->iParameterListInterface->ElfInput());
- }
- }
- /**This catch block introduced here is to avoid deleting partially constructed object(s).
- Otherwise global catch block will delete the partially constructed object(s) and the tool will crash.
- */
- catch(ErrorHandler& aError)
- {
- aError.Report();
- exit(EXIT_FAILURE);
- }
-
- Elf32_Word aRelocOffset = iElfExecutable->GetRelocationOffset(aReloc);
- aImportSection.push_back(aRelocOffset);
-
- Elf32_Word * aRelocPlace = iElfExecutable->GetRelocationPlace(aReloc);
- if (aOrdinal > 0xFFFF)
- {
- }
- if (aReloc->iAddend > 0xFFFF)
- {
- }
- * aRelocPlace = (aReloc->iAddend<<16) | aOrdinal;
- }
-
- if( aNamedLookup ) {
- aImportTabEntryPos = aImportSection.size();
- // Keep track of the location of the entry
- iImportTabLocations.push_back(aImportTabEntryPos);
- // Put the entry as 0 now, which shall be updated
- aImportSection.push_back(0);
- }
-
- delete [] ((char*)aElfFile);
- }
-
- assert(aImportSectionSize == aImportSection.size() * sizeof(Elf32_Word));
-
- size_t aTotalSize = Align(aImportSectionSize + aStrTab.size(), sizeof(Elf32_Word));
-
- // Fill in the section header now we have the correct value.
- aImportSection[0] = aTotalSize;
-
- // Now construct the unified section
- iImportSectionSize = aTotalSize;
- iImportSection = (uint32 *)new char[aTotalSize];
- memset(iImportSection, 0, aTotalSize);
- memcpy(iImportSection, aImportSection.begin(), aImportSectionSize);
- char * strTab = ((char *)iImportSection) + aImportSectionSize;
- memcpy(strTab, aStrTab.data(), aStrTab.size());
-
-}
-
-
-/**
-This function checks if a DSO file exists.
-@param aPath - DSO file name.
-@internalComponent
-@released
-*/
-static bool ProbePath(string & aPath)
-{
- ifstream aInput;
- const char * p = aPath.c_str();
- aInput.open(p);
- if (aInput.is_open())
- {
- aInput.close();
- return true;
- }
- else
- {
- return false;
- }
-}
-
-/**
-This function allocates space for a DSO file name.
-@param aPath - DSO file name
-@internalComponent
-@released
-*/
-const char * AllocatePath(string & aPath)
-{
- const char * p = aPath.c_str();
- size_t len = aPath.size();
- char * result = new char[len+1];
- strcpy(result, p);
- return (const char *)result;
-}
-
-/**
-This function searches for a DSO in the libpath specified.
-@param aName - DSO file name
-@internalComponent
-@released
-*/
-const char * E32ImageFile::FindDSO(const char * aName)
-{
- string aDSOName(aName);
- string aDSOPath(aName);
-
- const char *aNewDsoName;
-
- if (ProbePath(aDSOName))
- {
- aNewDsoName = AllocatePath(aDSOName);
- cleanupStack.push_back((char*)aNewDsoName);
- return aNewDsoName;
- }
-
- ParameterListInterface::LibSearchPaths & paths = iUseCase->GetLibSearchPaths();
- ParameterListInterface::LibSearchPaths::iterator p = paths.begin();
- for (; p != paths.end(); p++)
- {
- string path(*p);
- char dir = iUseCase->GetDirectorySeparator();
- aDSOPath.erase();
- aDSOPath.insert(aDSOPath.end(), path.begin(), path.end());
- aDSOPath.insert(aDSOPath.end(), dir);
- aDSOPath.insert(aDSOPath.end(), aDSOName.begin(), aDSOName.end());
- if (ProbePath(aDSOPath))
- {
- aNewDsoName = AllocatePath(aDSOPath);
- cleanupStack.push_back((char*)aNewDsoName);
- return aNewDsoName;
- }
- }
- throw ELFFileError(DSONOTFOUNDERROR,(char*)aName);
-}
-
-void E32ImageFile::ReadInputELFFile(const char * aName, size_t & aFileSize, Elf32_Ehdr * & aELFFile )
-{
- ifstream aInput;
- aInput.open(aName, ifstream::binary|ifstream::in);
- if (aInput.is_open())
- {
- aInput.seekg(0,ios::end);
- aFileSize = (unsigned int) aInput.tellg();
- aInput.seekg(0,ios::beg);
- aELFFile = (Elf32_Ehdr *)new char [aFileSize];
- aInput.read((char *)aELFFile, aFileSize);
- aInput.close();
- }
- else
- {
- throw FileError(FILEOPENERROR,(char*)aName);
- }
-}
-
-/**
-This function processes relocations.
-@internalComponent
-@released
-*/
-void E32ImageFile::ProcessRelocations()
-{
- ProcessCodeRelocations();
- ProcessDataRelocations();
-}
-
-/**
-This function processes Code relocations.
-@internalComponent
-@released
-*/
-void E32ImageFile::ProcessCodeRelocations()
-{
- CreateRelocations(iElfExecutable->GetCodeRelocations(), iCodeRelocs, iCodeRelocsSize);
-}
-
-/**
-This function processes Data relocations.
-@internalComponent
-@released
-*/
-void E32ImageFile::ProcessDataRelocations()
-{
- CreateRelocations(iElfExecutable->GetDataRelocations(), iDataRelocs, iDataRelocsSize);
-}
-
-/**
-This function creates Code and Data relocations from the corresponding
-ELF form to E32 form.
-@internalComponent
-@released
-*/
-void E32ImageFile::CreateRelocations(ElfRelocations::RelocationList & aRelocList, char * & aRelocs, size_t & aRelocsSize)
-{
- size_t rsize = RelocationsSize(aRelocList);
- if (rsize)
- {
- aRelocsSize = Align(rsize + sizeof(E32RelocSection), sizeof(uint32));
-
- uint32 aBase = (*aRelocList.begin())->iSegment->p_vaddr;
- //add for cleanup to be done later..
- cleanupStack.push_back(aRelocs);
- aRelocs = new char [aRelocsSize];
- memset(aRelocs, 0, aRelocsSize);
- E32RelocSection * aRelocSection = (E32RelocSection * )aRelocs;
-
- uint16 * data = (uint16 *)(aRelocSection + 1);
- E32RelocPageDesc * startofblock = (E32RelocPageDesc *)data;
-
- int page = -1;
- int pagesize = sizeof(E32RelocPageDesc);
- ElfRelocations::RelocationList::iterator r;
- for (r = aRelocList.begin(); r != aRelocList.end(); r++)
- {
- ElfLocalRelocation * aReloc = *r;
- int p = aReloc->iAddr & 0xfffff000;
- if (page != p)
- {
- if (pagesize%4 != 0)
- {
- *data++ = 0;
- pagesize += sizeof(uint16);
- }
- if (page == -1) page = p;
- startofblock->aOffset = page - aBase;
- startofblock->aSize = pagesize;
- pagesize = sizeof(E32RelocPageDesc);
- page = p;
- startofblock = (E32RelocPageDesc *)data;
- data = (uint16 *)(startofblock + 1);
- }
- uint16 relocType = aReloc->Fixup();
- *data++ = (uint16)((aReloc->iAddr & 0xfff) | relocType);
- pagesize += sizeof(uint16);
- }
- if (pagesize%4 != 0)
- {
- *data++ = 0;
- pagesize += sizeof(uint16);
- }
- startofblock->aOffset = page - aBase;
- startofblock->aSize = pagesize;
- ((E32RelocSection *)aRelocs)->iNumberOfRelocs = aRelocList.size();
- ((E32RelocSection *)aRelocs)->iSize = rsize;
-
- }
-}
-
-/**
-This function calculates the relocation taking into consideration
-the page boundaries if they are crossed. The relocations are
-sorted.
-@param aRelocList - relocations found in the Elf file.
-@internalComponent
-@released
-*/
-size_t E32ImageFile::RelocationsSize(ElfRelocations::RelocationList & aRelocList)
-{
- size_t bytecount = 0;
- int page = -1;
- ElfRelocations::RelocationList::iterator r;
- for (r = aRelocList.begin(); r != aRelocList.end(); r++)
- {
- ElfLocalRelocation * aReloc = *r;
- int p = aReloc->iAddr & 0xfffff000;
- if (page != p)
- {
- if (bytecount%4 != 0)
- bytecount += sizeof(uint16);
- bytecount += sizeof(E32RelocPageDesc); // page, block size
- page = p;
- }
- bytecount += sizeof(uint16);
- }
- if (bytecount%4 != 0)
- bytecount += sizeof(uint16);
- return bytecount;
-}
-
-/**
-This function returns the E32 interpretation for an Elf relocation type.
-@param aReloc - relocation entry.
-@internalComponent
-@released
-*/
-E32ImageFile::uint16 E32ImageFile::GetE32RelocType(ElfRelocation * aReloc)
-{
- ESegmentType aSegType = aReloc->iSegmentType; // iElfExecutable->SegmentType(aReloc->iSymbol->st_value);
- switch (aSegType)
- {
- case ESegmentRO:
- return KTextRelocType;
- case ESegmentRW:
- return KDataRelocType;
- default:
- break;
- };
-
- // maybe this should be an error
- return KInferredRelocType;
-}
-
-/**
-This function constructs the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::ConstructImage()
-{
- InitE32ImageHeader();
- ComputeE32ImageLayout();
- FinalizeE32Image();
- AllocateE32Image();
-}
-
-/**
-This function calculates the timestamp.
-@param aTime
-@internalComponent
-@released
-*/
-Int64 timeToInt64(TInt aTime)
-{
- aTime-=(30*365*24*60*60+7*24*60*60); // seconds since midnight Jan 1st, 2000
- Int64 daysTo2000AD=730497;
- Int64 t=daysTo2000AD*24*3600+aTime; // seconds since 0000
- t=t+3600; // BST (?)
- return t*1000000; // milliseconds
-}
-
-/**
-This function returns the E32 image header size.
-@internalComponent
-@released
-*/
-size_t E32ImageFile::GetE32ImageHeaderSize()
-{
- return sizeof(E32ImageHeaderV);
-}
-
-/**
-This function returns the extended E32 image header size.
-@internalComponent
-@released
-*/
-size_t E32ImageFile::GetExtendedE32ImageHeaderSize()
-{
- return iHdrSize;
-}
-
-/**
-This function sets the extended E32 image header size.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetExtendedE32ImageHeaderSize(size_t aSize)
-{
- iHdrSize = aSize;
-}
-
-/**
-This function initialises the E32 image header fields.
-@internalComponent
-@released
-*/
-void E32ImageFile::InitE32ImageHeader()
-{
- iHdr = iUseCase->AllocateE32ImageHeader();
-
- iHdr->iUid1 = 0;
- iHdr->iUid2 = 0;
- iHdr->iUid3 = 0;
- iHdr->iHeaderCrc = 0;
- iHdr->iSignature = 0x434f5045u;
- iHdr->iModuleVersion = 0x00010000u;
- iHdr->iCompressionType = 0;
- iHdr->iToolsVersion = TVersion(MajorVersion, MinorVersion, Build);
- Int64 ltime(timeToInt64(time(0)));
- iHdr->iTimeLo=(uint32)ltime;
- iHdr->iTimeHi=(uint32)(ltime>>32);
- iHdr->iFlags = KImageHdrFmt_V;
- // Confusingly, CodeSize means everything except writable data
- iHdr->iCodeSize = 0;
- iHdr->iDataSize = iElfExecutable->GetRWSize();
- iHdr->iHeapSizeMin = 0;
- iHdr->iHeapSizeMax = 0;
- iHdr->iStackSize = 0;
- iHdr->iBssSize = iElfExecutable->GetBssSize();
- iHdr->iEntryPoint = 0;
- iHdr->iCodeBase = iElfExecutable->GetROBase();
- iHdr->iDataBase = iElfExecutable->GetRWBase();
- iHdr->iDllRefTableCount = iNumDlls;
- iHdr->iExportDirOffset = 0;
- iHdr->iExportDirCount = iUseCase->GetNumExports();
- iHdr->iTextSize = iElfExecutable->GetROSize();
- iHdr->iCodeOffset = 0;
- iHdr->iDataOffset = 0;
- iHdr->iImportOffset = 0;
- iHdr->iCodeRelocOffset = 0;
- iHdr->iDataRelocOffset = 0;
- iHdr->iProcessPriority = (uint16)EPriorityForeground;
- iHdr->iUncompressedSize = 0;
- iHdr->iS.iSecureId = 0;
- iHdr->iS.iVendorId = 0;
- iHdr->iExceptionDescriptor = 0;
- iHdr->iSpare2 = 0;
-
- iHdr->iExportDescSize = iUseCase->GetExportDescSize();
- iHdr->iExportDescType = iUseCase->GetExportDescType();
- if (iHdr->iExportDescSize == 0) iHdr->iExportDesc[0] = 0;
-
-}
-
-/**
-This function creates the E32 image layout.
-@internalComponent
-@released
-*/
-void E32ImageFile::ComputeE32ImageLayout()
-{
- // E32Image header
- iChunks.AddChunk((char *)iHdr, Align(GetExtendedE32ImageHeaderSize(), sizeof(uint32)), 0, "Image Header");
-
- uint32 endOfHeader = iChunks.GetOffset();
-
- // Code section
- iHdr->iCodeOffset = iChunks.GetOffset();
- iChunks.AddChunk(iElfExecutable->GetRawROSegment(), iElfExecutable->GetROSize(), iHdr->iCodeOffset, "Code Section");
-
- // Exports Next - then we can set up CodeSize
- // Call out to the use case so it can decide how we do this
- // record exporttable offset for default case
-
- bool aSymLkupEnabled = iUseCase->GetNamedSymLookup();
- // The export table is required either when:
- // a. there are exported symbols
- // b. symbol lookup is enabled - because this table also indicates the dependencies
- bool aExportTableNeeded = (iHdr->iExportDirCount || aSymLkupEnabled) ? 1 : 0;
-
- iExportOffset = iChunks.GetOffset() + 4;
- iHdr->iExportDirOffset = aExportTableNeeded ? iUseCase->GetExportOffset() : 0;
- if ( aExportTableNeeded && iUseCase->AllocateExportTableP())
- iChunks.AddChunk(iUseCase->GetExportTable(), iUseCase->GetExportTableSize(), iChunks.GetOffset(), "Export Table");
-
- // Symbol info next
- if( aSymLkupEnabled ){
- E32EpocExpSymInfoHdr* aSymHdrInfo = (E32EpocExpSymInfoHdr*)CreateSymbolInfo(iChunks.GetOffset());
- if( aSymHdrInfo )
- iChunks.AddChunk( (char*)aSymHdrInfo, aSymHdrInfo->iSize, iChunks.GetOffset(), "Symbol Info" );
- }
-
- // CodeSize is current offset - endof header offset
- iHdr->iTextSize = iHdr->iCodeSize = iChunks.GetOffset() - endOfHeader;
-
- // Data section
- if (iElfExecutable->GetRWSize())
- {
- iHdr->iDataOffset = iChunks.GetOffset();
- iChunks.AddChunk(iElfExecutable->GetRawRWSegment(), iElfExecutable->GetRWSize(), iHdr->iDataOffset, "Data Section");
- }
-
- // Import Section
- if (iImportSectionSize)
- {
- iHdr->iImportOffset = iChunks.GetOffset();
- iChunks.AddChunk((char *)iImportSection, iImportSectionSize, iHdr->iImportOffset, "Import Section");
- }
-
- // Code relocs
- if (iCodeRelocsSize)
- {
- iHdr->iCodeRelocOffset = iChunks.GetOffset();
- iChunks.AddChunk((char *)iCodeRelocs, iCodeRelocsSize, iHdr->iCodeRelocOffset, "Code Relocs");
- }
-
- // Data relocs
- if (iDataRelocsSize)
- {
- iHdr->iDataRelocOffset = iChunks.GetOffset();
- iChunks.AddChunk((char *)iDataRelocs, iDataRelocsSize, iHdr->iDataRelocOffset, "Data Relocs");
- }
-
- iLayoutDone = true;
-}
-
-/**
-This function returns the byte offset in the E32 image from where the
-export table starts.
-@internalComponent
-@released
-*/
-size_t E32ImageFile::GetExportOffset()
-{
- return iExportOffset;
-}
-
-/**
-This function returns E32 image size.
-@internalComponent
-@released
-*/
-size_t E32ImageFile::GetE32ImageSize()
-{
- assert(iLayoutDone);
- return iChunks.GetOffset();
-
-}
-
-/**
-This function creates the export bitmap also replacing the absent symbols
-with the entry point functions.
-@internalComponent
-@released
-*/
-void E32ImageFile::CreateExportBitMap()
-{
- int nexp = iUseCase->GetNumExports();
- size_t memsz = (nexp + 7) >> 3;
- iExportBitMap = new uint8[memsz];
- memset(iExportBitMap, 0xff, memsz);
- // skip header
- uint32 * exports = ((uint32 *)iUseCase->GetExportTable()) + 1;
- uint32 absentVal = EntryPointOffset() + iElfExecutable->GetROBase();
- iMissingExports = 0;
- for (int i=0; i<nexp; ++i)
- {
- if (exports[i] == absentVal)
- {
- iExportBitMap[i>>3] &= ~(1u << (i & 7));
- ++iMissingExports;
- }
- }
-}
-
-/**
-This function creates export desription for the absent symbols.
-@internalComponent
-@released
-*/
-void E32ImageFile::AddExportDescription()
-{
- CreateExportBitMap();
- if (iMissingExports == 0)
- return; // nothing to do
-
- int nexp = iUseCase->GetNumExports();
- size_t memsz = (nexp + 7) >> 3; // size of complete bitmap
- size_t mbs = (memsz + 7) >> 3; // size of meta-bitmap
- size_t nbytes = 0;
- unsigned int i;
- for (i=0; i<memsz; ++i)
- if (iExportBitMap[i] != 0xff)
- ++nbytes; // number of groups of 8
- uint8 edt = KImageHdr_ExpD_FullBitmap;
- uint32 extra_space = memsz - 1;
- if (mbs + nbytes < memsz)
- {
- edt = KImageHdr_ExpD_SparseBitmap8;
- extra_space = mbs + nbytes - 1;
- }
- extra_space = (extra_space + sizeof(uint32) - 1) &~ (sizeof(uint32) - 1);
-
- iHdr->iExportDescType = edt;
- if (edt == KImageHdr_ExpD_FullBitmap)
- {
- iHdr->iExportDescSize = (uint16)memsz;
- iHdr->iExportDesc[0] = iExportBitMap[0];
- uint8 * aDesc = new uint8[extra_space];
- memset(aDesc, 0, extra_space);
- memcpy(aDesc, &iExportBitMap[1], memsz-1);
- iChunks.AddChunk((char *)aDesc,extra_space, iChunks.GetOffset(), "Export Description");
- }
- else
- {
- iHdr->iExportDescSize = (uint16)(mbs + nbytes);
- uint8 * aBuf = new uint8[extra_space + 1];
- memset(aBuf , 0, extra_space + 1);
- TUint8* mptr = aBuf;
- TUint8* gptr = mptr + mbs;
- for (i=0; i<memsz; ++i)
- {
- if (iExportBitMap[i] != 0xff)
- {
- mptr[i>>3] |= (1u << (i&7));
- *gptr++ = iExportBitMap[i];
- }
- }
- iHdr->iExportDesc[0] = aBuf[0];
- uint8 * aDesc = new uint8[extra_space];
- memcpy(aDesc, aBuf+1, extra_space);
- delete[] aBuf;
- iChunks.AddChunk((char *)aDesc,extra_space, iChunks.GetOffset(), "Export Description");
- }
-}
-
-/**
-This function sets the fields of the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::FinalizeE32Image()
-{
- // Arrange a header for this E32 Image
- iHdr->iCpuIdentifier = GetCpuIdentifier();
- // Import format is ELF-derived
- iHdr->iFlags |= KImageImpFmt_ELF;
- // ABI is ARM EABI
- iHdr->iFlags |= KImageABI_EABI;
- iHdr->iFlags |= KImageEpt_Eka2;
-
- bool isDllp = iUseCase->ImageIsDll();
- if (isDllp)
- {
- iHdr->iFlags |= KImageDll;
- if (iHdr->iDataSize && !iUseCase->AllowDllData())
- throw ELFFileError(DLLHASINITIALISEDDATAERROR, (char*)iUseCase->InputElfFileName());
-
- if (iHdr->iBssSize && !iUseCase->AllowDllData())
- throw ELFFileError(DLLHASUNINITIALISEDDATAERROR, (char*)iUseCase->InputElfFileName());
-
- }
-
- iHdr->iHeapSizeMin = iUseCase->HeapCommittedSize();
- iHdr->iHeapSizeMax = iUseCase->HeapReservedSize();
- iHdr->iStackSize = iUseCase->StackCommittedSize();
-
-
- iHdr->iEntryPoint = EntryPointOffset();
-
- EEntryPointStatus r = ValidateEntryPoint();
- if (r == EEntryPointCorrupt)
- throw ELFFileError(ENTRYPOINTCORRUPTERROR, (char*)iUseCase->InputElfFileName());
- else if (r == EEntryPointNotSupported)
- throw ELFFileError(ENTRYPOINTNOTSUPPORTEDERROR, (char*)iUseCase->InputElfFileName());
-
- SetUpExceptions();
- SetUids();
- SetSecureId();
- SetVendorId();
- SetCallEntryPoints();
- SetCapability();
- SetPriority(isDllp);
- SetFixedAddress(isDllp);
- SetVersion();
- SetCompressionType();
- SetFPU();
-
- SetPaged();
-
- SetSymbolLookup();
- SetDebuggable();
- SetSmpSafe();
- UpdateHeaderCrc();
-}
-
-/**
-This function returns the CPU identifier for the E32 image header.
-@internalComponent
-@released
-*/
-E32ImageFile::uint16 E32ImageFile::GetCpuIdentifier()
-{
- return (uint16)ECpuArmV5;
-}
-
-/**
-This function returns the entry point of the E32 image .
-@internalComponent
-@released
-*/
-E32ImageFile::uint32 E32ImageFile::EntryPointOffset()
-{
- return iElfExecutable->EntryPointOffset();
-}
-
-/**
-This function validates the entry point of the E32 image .
-@internalComponent
-@released
-*/
-E32ImageFile::EEntryPointStatus E32ImageFile::ValidateEntryPoint()
-{
- uint32 epOffset = iHdr->iEntryPoint;
- if (epOffset & 3)
- return EEntryPointOK; // if entry point not 4 byte aligned, must be old style
- uint32 fileOffset = epOffset + iElfExecutable->iCodeSegmentHdr->p_offset;
- if (fileOffset+4 > iChunks.GetOffset())
- return EEntryPointCorrupt; // entry point is past the end of the file??
- int ept = 0; // old style if first instruction not recognised
- uint8 * p = ELF_ENTRY_PTR(uint8, iElfExecutable->iElfHeader, fileOffset + 4);
- uint32 x = *--p;
- x<<=8;
- x|=*--p;
- x<<=8;
- x|=*--p;
- x<<=8;
- x|=*--p;
- if ((x & 0xffffff00) == 0xe31f0000)
- {
- // starts with tst pc, #n - new entry point
- ept = (x & 0xff) + 1;
- }
- if (ept>7)
- return EEntryPointNotSupported;
- iHdr->iFlags |= (ept<<KImageEptShift);
- return EEntryPointOK;
-}
-
-/**
-This function sets the exciption descriptor in the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetUpExceptions()
-{
- char * aExDescName = "Symbian$$CPP$$Exception$$Descriptor";
- Elf32_Sym * aSym = iElfExecutable->LookupStaticSymbol(aExDescName);
- if (aSym)
- {
- uint32 aSymVaddr = aSym->st_value;
- uint32 aROBase = iElfExecutable->GetROBase();
- uint32 aROSize = iElfExecutable->GetROSize();
- //check its in RO segment
- if (aSymVaddr < aROBase || aSymVaddr >= (aROBase + aROSize))
- {
- throw ELFFileError(EXCEPTIONDESCRIPTOROUTSIDEROERROR,(char*)iUseCase->InputElfFileName());
- }
- // Set bottom bit so 0 in header slot means an old binary.
- // The decriptor is always aligned on a 4 byte boundary.
- iHdr->iExceptionDescriptor = (aSymVaddr - aROBase) | 0x00000001;
- }
-}
-
-/**
-This function sets the UIDs of the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetUids()
-{
- iHdr->iUid1=iUseCase->GetUid1();
- iHdr->iUid2=iUseCase->GetUid2();
- iHdr->iUid3=iUseCase->GetUid3();
-}
-
-/**
-This function sets the secure ID of the E32 image as passed in the command line.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetSecureId()
-{
- if (iUseCase->GetSecureIdOption())
- iHdr->iS.iSecureId = iUseCase->GetSecureId();
- else
- iHdr->iS.iSecureId = iUseCase->GetUid3();
-}
-
-/**
-This function sets the vendor Id of the E32 image as passed in command line.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetVendorId()
-{
- iHdr->iS.iVendorId = iUseCase->GetVendorId();
-}
-
-/**
-This function sets the call entry point of the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetCallEntryPoints()
-{
- if (iUseCase->GetCallEntryPoints())
- iHdr->iFlags|=KImageNoCallEntryPoint;
- else
- iHdr->iFlags&=~KImageNoCallEntryPoint;
-}
-
-/**
-This function sets the capcbility of the E32 image as specified in the command line.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetCapability()
-{
- iHdr->iS.iCaps = iUseCase->GetCapability();
-}
-
-/**
-This function sets the priority of the E32 exe.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetPriority(bool isDllp)
-{
- if (iUseCase->GetPriority())
- {
- if (isDllp)
- {
- cerr << "Warning: Cannot set priority of a DLL." << endl;
- }
- else
- iHdr->iProcessPriority = (unsigned short)iUseCase->GetPriority();
- }
-}
-
-/**
-This function sets the fixed address flag of the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetFixedAddress(bool isDllp)
-{
- if (iUseCase->GetFixedAddress())
- {
- if (isDllp)
- {
- cerr << "Warning: Cannot set fixed address for DLL." << endl;
- }
- else
- iHdr->iFlags|=KImageFixedAddressExe;
- }
- else
- iHdr->iFlags&=~KImageFixedAddressExe;
-}
-
-/**
-This function sets the version of the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetVersion()
-{
- iHdr->iModuleVersion = iUseCase->GetVersion();
-}
-
-/**
-This function sets the compression type of the E32 image .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetCompressionType()
-{
- if(iUseCase->GetCompress())
- iHdr->iCompressionType = iUseCase->GetCompressionMethod();
- else
- iHdr->iCompressionType = KFormatNotCompressed;
-
-}
-
-/**
-This function sets the FPU type that the E32 image targets .
-@internalComponent
-@released
-*/
-void E32ImageFile::SetFPU()
-{
- iHdr->iFlags &=~ KImageHWFloatMask;
-
- if (iUseCase->GetFPU() == 1)
- iHdr->iFlags |= KImageHWFloat_VFPv2;
-}
-
-/**
-This function sets the paging attribute in the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetPaged()
-{
- // Code paging.
-
- if ( iUseCase->IsCodePaged() )
- {
- iHdr->iFlags |= KImageCodePaged;
- iHdr->iFlags &= ~KImageCodeUnpaged;
- }
- else if ( iUseCase->IsCodeUnpaged() )
- {
- iHdr->iFlags |= KImageCodeUnpaged;
- iHdr->iFlags &= ~KImageCodePaged;
- }
- else if ( iUseCase->IsCodeDefaultPaged() )
- {
- iHdr->iFlags &= ~KImageCodePaged;
- iHdr->iFlags &= ~KImageCodeUnpaged;
- }
-
- // Data paging.
-
- if ( iUseCase->IsDataPaged() )
- {
- iHdr->iFlags |= KImageDataPaged;
- iHdr->iFlags &= ~KImageDataUnpaged;
- }
- else if ( iUseCase->IsDataUnpaged() )
- {
- iHdr->iFlags |= KImageDataUnpaged;
- iHdr->iFlags &= ~KImageDataPaged;
- }
- else if ( iUseCase->IsDataDefaultPaged() )
- {
- iHdr->iFlags &= ~KImageDataPaged;
- iHdr->iFlags &= ~KImageDataUnpaged;
- }
-}
-
-/**
-This function sets the Debuggable attribute in the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetDebuggable()
-{
- if (iUseCase->IsDebuggable() == true)
- {
- iHdr->iFlags |= KImageDebuggable;
- }
- else
- {
- iHdr->iFlags &= ~KImageDebuggable;
- }
-}
-
-
-void E32ImageFile::SetSmpSafe()
-{
- if ( iUseCase->IsSmpSafe() )
- {
- iHdr->iFlags |= KImageSMPSafe;
- }
- else
- {
- iHdr->iFlags &= ~KImageSMPSafe;
- }
-}
-
-/**
-This function sets the named symol-lookup attribute in the E32 image.
-@internalComponent
-@released
-*/
-void E32ImageFile::SetSymbolLookup()
-{
- if(iUseCase->GetNamedSymLookup())
- {
- iHdr->iFlags |= KImageNmdExpData;
- }
- else
- {
- iHdr->iFlags &= ~KImageNmdExpData;
- }
-}
-
-/**
-Class for Uids.
-@internalComponent
-@released
-*/
-class TE32ImageUids
-{
-public:
- TE32ImageUids(TUint32 aUid1, TUint32 aUid2, TUint32 aUid3);
- void Set(const TUidType& aUidType);
- TUint Check() { return ((checkSum(((TUint8*)this)+1)<<16)|checkSum(this));}
-private:
- TUidType iType;
- TUint iCheck;
-
-};
-
-/**
-Constructor for TE32ImageUids.
-@internalComponent
-@released
-*/
-TE32ImageUids::TE32ImageUids(TUint32 aUid1, TUint32 aUid2, TUint32 aUid3)
-{
- Set(TUidType(TUid::Uid(aUid1), TUid::Uid(aUid2), TUid::Uid(aUid3)));
-}
-
-/**
-This function sets the Uid.
-@internalComponent
-@released
-*/
-void TE32ImageUids::Set(const TUidType& aUidType)
-{
- iType=aUidType;
- iCheck=Check();
-}
-
-/**
-Default constructor for TUidType class.
-@internalComponent
-@released
-*/
-TUidType::TUidType()
-{
- memset(this, 0, sizeof(TUidType));
-}
-
-/**
-Constructor for TUidType class.
-@internalComponent
-@released
-*/
-TUidType::TUidType(TUid aUid1,TUid aUid2,TUid aUid3)
-{
- iUid[0]=aUid1;
- iUid[1]=aUid2;
- iUid[2]=aUid3;
-}
-
-// needed by E32ImageHeaderV::ValidateHeader...
-TCheckedUid::TCheckedUid(const TUidType& aUidType)
- {
- iType = aUidType;
- iCheck = ((TE32ImageUids*)this)->Check();
- }
-
-// needed by E32ImageHeaderV::ValidateHeader...
-void Mem::Crc32(TUint32& aCrc, const TAny* aPtr, TInt aLength)
- {
- ::Crc32(aCrc, aPtr, aLength);
- }
-
-/**
-This function updates the CRC of the E32 Image.
-@internalComponent
-@released
-*/
-void E32ImageFile::UpdateHeaderCrc()
-{
- TE32ImageUids u(iHdr->iUid1, iHdr->iUid2, iHdr->iUid3);
- iHdr->iUidChecksum = u.Check();
- TInt hdrsz = GetExtendedE32ImageHeaderSize();
- iHdr->iUncompressedSize = iChunks.GetOffset() - Align(GetExtendedE32ImageHeaderSize(), sizeof(uint32));
- iHdr->iHeaderCrc = KImageCrcInitialiser;
- uint32 crc = 0;
- Crc32(crc, iHdr, hdrsz);
- iHdr->iHeaderCrc = crc;
-}
-
-/**
-This function creates a buffer and writes all the data into the buffer.
-@internalComponent
-@released
-*/
-void E32ImageFile::AllocateE32Image()
-{
- size_t aImageSize = iChunks.GetOffset();
- iE32Image = new char[aImageSize];
- memset(iE32Image, 0, aImageSize);
-
- E32ImageChunks::ChunkList aChunkList = iChunks.GetChunks();
- E32ImageChunks::ChunkList::iterator p;
- for(p = aChunkList.begin(); p != aChunkList.end(); p++)
- {
- (*p)->Write(iE32Image);
- }
-
- E32ImageHeaderV* header = (E32ImageHeaderV*)iE32Image;
- TInt headerSize = header->TotalSize();
- if(KErrNone!=header->ValidateWholeImage(iE32Image+headerSize,GetE32ImageSize()-headerSize))
- throw InvalidE32ImageError(VALIDATIONERROR, (char*)iUseCase->OutputE32FileName());
-}
-
-/**
-This function deflates the compressed data.
-@param bytes
-@param size
-@param os
-@internalComponent
-@released
-*/
-void DeflateCompress(char* bytes, size_t size, ofstream & os);
-
-/**
-This function Paged Pack the compressed data.
-@param bytes
-@param size
-@param os
-@internalComponent
-@released
-*/
-void CompressPages(TUint8 * bytes, TInt size, ofstream& os);
-
-
-/**
-This function writes into the final E32 image file.
-@param aName - E32 image file name
-@internalComponent
-@released
-*/
-bool E32ImageFile::WriteImage(const char * aName)
-{
- ofstream *os = new ofstream();
- os->open(aName, ofstream::binary|ofstream::out);
-
- if (os->is_open())
- {
- uint32 compression = iHdr->CompressionType();
- if (compression == KUidCompressionDeflate)
- {
- size_t aHeaderSize = GetExtendedE32ImageHeaderSize();
- size_t aBodySize = GetE32ImageSize() - aHeaderSize;
- os->write(iE32Image, aHeaderSize);
- DeflateCompress(iE32Image + aHeaderSize, aBodySize, *os);
- }
- else if (compression == KUidCompressionBytePair)
- {
- size_t aHeaderSize = GetExtendedE32ImageHeaderSize();
- os->write(iE32Image, aHeaderSize);
-
- // Compress and write out code part
- int srcStart = GetExtendedE32ImageHeaderSize();
- CompressPages( (TUint8*)iE32Image + srcStart, iHdr->iCodeSize, *os);
-
-
- // Compress and write out data part
- srcStart += iHdr->iCodeSize;
- int srcLen = GetE32ImageSize() - srcStart;
-
- CompressPages((TUint8*)iE32Image + srcStart, srcLen, *os);
-
- }
- else if (compression == 0)
- {
- os->write(iE32Image, GetE32ImageSize()); // image not compressed
- }
-
- }
- else
- {
- throw FileError(FILEOPENERROR,(char*)aName);
- }
- os->close();
- if(os!=NULL)
- {
- delete os;
- os = NULL;
- }
- return true;
-}
-
-
-/**
-Constructor for E32ImageFile class.
-@internalComponent
-@released
-*/
-E32ImageFile::E32ImageFile(): iFileName(NULL), iE32Image(NULL),iExportBitMap(0),cleanupStack(0), iData(NULL),iHdr(NULL),iImportSection(0), iSize(0), iOrigHdr(NULL), iError(0), iSource(EE32Image), iOrigHdrOffsetAdj(0)
-{
-
-};
-
-/**
-Destructor for E32ImageFile class.
-@internalComponent
-@released
-*/
-E32ImageFile::~E32ImageFile()
-{
- delete[] iData;
- if (iHdr && iHdr != iOrigHdr)
- delete iHdr;
-
- delete [] iExportBitMap;
- delete [] iE32Image;
- delete [] iImportSection;
-
- std::vector<char*>::iterator aPos;
- char *aPtr;
- aPos = cleanupStack.begin();
- while( aPos != cleanupStack.end() )
- {
- aPtr = *aPos;
- delete [] aPtr;
- aPos++;
- }
-
-}
-
-/**
-Adjust the size of allocated data and fix the member data
-@internalComponent
-@released
-*/
-void E32ImageFile::Adjust(TInt aSize, TBool aAllowShrink)
-{
- TInt asize = ((aSize+0x3)&0xfffffffc);
-
- if (asize == iSize)
- return;
-
- if (iSize == 0)
- {
- iSize = asize;
- iData = new char[iSize];
- memset(iData, 0, iSize);
- }
- else if (aAllowShrink || asize > iSize)
- {
- TInt oldsize = iSize;
- iSize = asize;
- iData = (char*)realloc(iData, iSize);
-
- if (iSize > oldsize)
- memset(iData+oldsize, 0, iSize-oldsize);
- }
-
- if (!iData)
- iSize = 0;
-
- if (iHdr && iHdr == iOrigHdr)
- iHdr = (E32ImageHeaderV*)iData;
-
- iOrigHdr = (E32ImageHeader*)iData;
-}
-
-/**
-Read the E32 image.
-@param is - input stream
-@internalComponent
-@released
-*/
-TInt E32ImageFile::ReadHeader(ifstream& is)
-{
- Adjust(sizeof(E32ImageHeader), EFalse);
- is.read(iData, sizeof(E32ImageHeader));
- TInt hdrsz = iOrigHdr->TotalSize();
-
- if (hdrsz > 0x10000)
- return KErrCorrupt; // sanity check
-
- if (hdrsz > (TInt)sizeof(E32ImageHeader))
- {
- Adjust(hdrsz, EFalse);
- is.read(iData+sizeof(E32ImageHeader), hdrsz-sizeof(E32ImageHeader));
- }
-
- TUint32 uncompressedSize;
- TInt r = iOrigHdr->ValidateHeader(iFileSize,uncompressedSize);
-
- if (r != KErrNone)
- {
- fprintf(stderr, "Integrity check failed %d\n", r);
- return r;
- }
-
- iHdr = (E32ImageHeaderV*)iOrigHdr;
- return KErrNone;
-}
-
-/**
-Return the offset of the text section
-@internalComponent
-@released
-*/
-TUint E32ImageFile::TextOffset()
-{
- return 0;
-}
-
-/**
-Return the offset of the data section
-@internalComponent
-@released
-*/
-TUint E32ImageFile::DataOffset()
-{
- return iHdr->iCodeSize;
-}
-
-/**
-Return the offset of the bss section
-@internalComponent
-@released
-*/
-TUint E32ImageFile::BssOffset()
-{
- return DataOffset()+iHdr->iDataSize;
-}
-
-
-/**
-This function creates the bitmap after reading the E32 image file
-@internalComponent
-@released
-*/
-void E32ImageFile::E32ImageExportBitMap()
-{
- TInt nexp = iOrigHdr->iExportDirCount;
- TInt memsz = (nexp + 7) >> 3;
- iExportBitMap = new TUint8[memsz];
- memset(iExportBitMap, 0xff, memsz);
- TUint* exports = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- TUint absoluteEntryPoint = iOrigHdr->iEntryPoint + iOrigHdr->iCodeBase;
- TUint impfmt = iOrigHdr->ImportFormat();
- TUint hdrfmt = iOrigHdr->HeaderFormat();
- TUint absentVal = (impfmt == KImageImpFmt_ELF) ? absoluteEntryPoint : iOrigHdr->iEntryPoint;
- TInt i;
- iMissingExports = 0;
-
- for (i=0; i<nexp; ++i)
- {
- if (exports[i] == absentVal)
- {
- iExportBitMap[i>>3] &= ~(1u << (i & 7));
- ++iMissingExports;
- }
- }
-
- if (hdrfmt < KImageHdrFmt_V && iMissingExports)
- {
- fprintf(stderr, "Bad exports\n");
- exit(999);
- }
-}
-
-/**
-This function creates the export description after reading the E32 image file
-@internalComponent
-@released
-*/
-TInt E32ImageFile::CheckExportDescription()
-{
- TUint hdrfmt = iOrigHdr->HeaderFormat();
- if (hdrfmt < KImageHdrFmt_V && iMissingExports)
- return KErrCorrupt;
-
- if (iHdr->iExportDescType == KImageHdr_ExpD_NoHoles)
- {
- return iMissingExports ? KErrCorrupt : KErrNone;
- }
-
- TInt nexp = iOrigHdr->iExportDirCount;
- TInt memsz = (nexp + 7) >> 3; // size of complete bitmap
- TInt mbs = (memsz + 7) >> 3; // size of meta-bitmap
- TInt eds = iHdr->iExportDescSize;
-
- if (iHdr->iExportDescType == KImageHdr_ExpD_FullBitmap)
- {
- if (eds != memsz)
- return KErrCorrupt;
- if (memcmp(iHdr->iExportDesc, iExportBitMap, eds) == 0)
- return KErrNone;
- return KErrCorrupt;
- }
-
- if (iHdr->iExportDescType != KImageHdr_ExpD_SparseBitmap8)
- return KErrNotSupported;
-
- TInt nbytes = 0;
- TInt i;
- for (i=0; i<memsz; ++i)
- if (iExportBitMap[i] != 0xff)
- ++nbytes; // number of groups of 8
-
- TInt exp_extra = mbs + nbytes;
- if (eds != exp_extra)
- return KErrCorrupt;
-
- const TUint8* mptr = iHdr->iExportDesc;
- const TUint8* gptr = mptr + mbs;
- for (i=0; i<memsz; ++i)
- {
- TUint mbit = mptr[i>>3] & (1u << (i&7));
- if (iExportBitMap[i] != 0xff)
- {
- if (!mbit || *gptr++ != iExportBitMap[i])
- return KErrCorrupt;
- }
- else if (mbit)
- return KErrCorrupt;
- }
-
- return KErrNone;
-}
-
-
-int DecompressPages(TUint8 * bytes, ifstream& is);
-
-
-/**
-This function creates the E32 image reading from the file
-@param is
-@param aImage
-@internalComponent
-@released
-*/
-ifstream& operator>>(ifstream& is, E32ImageFile& aImage)
-{
- aImage.iError = aImage.ReadHeader(is);
- if (aImage.iError != KErrNone)
- return is;
-
- E32ImageHeader* oh = aImage.iOrigHdr;
- TInt orighdrsz = oh->TotalSize();
- int remainder = aImage.iSize - orighdrsz;
- TUint compression = oh->CompressionType();
- if (compression == 0)
- {
- is.read(aImage.iData + orighdrsz, remainder);
- }
- else if (compression == KUidCompressionDeflate)
- { //Uncompress
- aImage.iError = KErrNoMemory;
- unsigned int uncompsize = ((E32ImageHeaderComp*)aImage.iOrigHdr)->iUncompressedSize;
- aImage.Adjust(uncompsize + orighdrsz);
-
- if (aImage.iData==NULL)
- return is;
-
- oh = aImage.iOrigHdr;
-
- unsigned char* compressedData = new unsigned char[remainder];
- if (compressedData==NULL)
- return is;
-
- is.read(reinterpret_cast<char *>(compressedData), remainder);
- unsigned int destsize = uncompsize;
- InflateUnCompress( compressedData, remainder, (unsigned char*)(aImage.iData + orighdrsz), destsize);
-
- if (destsize != uncompsize)
- MessageHandler::GetInstance()->ReportMessage(WARNING, HUFFMANINCONSISTENTSIZEERROR);
-
- delete [] compressedData;
-
- if ((TUint)orighdrsz > oh->iCodeOffset)
- {
- // need to adjust code offsets in original
- aImage.iOrigHdrOffsetAdj = (TUint)orighdrsz - oh->iCodeOffset;
- aImage.OffsetAdjust(oh->iCodeOffset);
- aImage.OffsetAdjust(oh->iDataOffset);
- aImage.OffsetAdjust(oh->iCodeRelocOffset);
- aImage.OffsetAdjust(oh->iDataRelocOffset);
- aImage.OffsetAdjust(oh->iImportOffset);
- aImage.OffsetAdjust(oh->iExportDirOffset);
- }
- aImage.iError = KErrNone;
- }
- else if(compression == KUidCompressionBytePair)
- { // Uncompress
- aImage.iError = KErrNoMemory;
- unsigned int uncompsize = ((E32ImageHeaderComp*)aImage.iOrigHdr)->iUncompressedSize;
- aImage.Adjust(uncompsize + orighdrsz);
- if (aImage.iData==NULL)
- return is;
- oh = aImage.iOrigHdr;
-
- // Read and decompress code part of the image
-
- unsigned int uncompressedCodeSize = DecompressPages((TUint8 *) (aImage.iData + orighdrsz), is);
-
-
- // Read and decompress data part of the image
-
- unsigned int uncompressedDataSize = DecompressPages((TUint8 *) (aImage.iData + orighdrsz + uncompressedCodeSize), is);
-
- if (uncompressedCodeSize + uncompressedDataSize != uncompsize)
- MessageHandler::GetInstance()->ReportMessage(WARNING, BYTEPAIRINCONSISTENTSIZEERROR);
-
- if ((TUint)orighdrsz > oh->iCodeOffset)
- {
- // need to adjust code offsets in original
- aImage.iOrigHdrOffsetAdj = (TUint)orighdrsz - oh->iCodeOffset;
- aImage.OffsetAdjust(oh->iCodeOffset);
- aImage.OffsetAdjust(oh->iDataOffset);
- aImage.OffsetAdjust(oh->iCodeRelocOffset);
- aImage.OffsetAdjust(oh->iDataRelocOffset);
- aImage.OffsetAdjust(oh->iImportOffset);
- aImage.OffsetAdjust(oh->iExportDirOffset);
- }
- aImage.iError = KErrNone;
- }
- aImage.E32ImageExportBitMap();
-
- return is;
-}
-#ifdef __LINUX__
-#include <sys/stat.h>
-/**
-Simple function uses stdlib fstat to obtain the size of the file.
-@param aFileName - e32 image file name
-@internalComponent
-@released
-*/
-int GetFileSize(const char* aFileName) {
- // Open the file the old-fashioned way :-)
- struct stat fileInfo;
- if(stat(aFileName,&fileInfo)!=0) {
- throw FileError(FILEOPENERROR,(char *)aFileName);
- }
- off_t fileSize = fileInfo.st_size;
- return fileSize;
-}
-#else
-int GetFileSize(const char* aFileName) {
- _finddata_t fileinfo;
- int ret=_findfirst((char *)aFileName,&fileinfo);
- if (ret==-1)
- {
- throw FileError(FILEOPENERROR,(char *)aFileName);
- }
- return fileinfo.size;
-}
-#endif
-
-
-/**
-This function opens the e32 image file.
-@param aFileName - e32 image file name
-@internalComponent
-@released
-*/
-TInt E32ImageFile::Open(const char* aFileName)
-{
- iFileSize = GetFileSize(aFileName);
-
- Adjust(iFileSize);
- ifstream ifile((char *)aFileName, ios::in | ios::binary);
- if(!ifile.is_open())
- {
- throw FileError(FILEOPENERROR,(char *)aFileName);
- }
- ifile >> *this;
- ifile.close();
-
- if (iError != KErrNone)
- return iError;
-
- return KErrNone;
-}
-
-void E32ImageFile::ProcessSymbolInfo() {
-
- Elf32_Addr aPlace = iUseCase->GetExportTableAddress() - 4;// This location points to 0th ord.
- // Create a relocation entry for the 0th ordinal.
- ElfLocalRelocation *aRel = new ElfLocalRelocation(iElfExecutable, aPlace, 0, 0, R_ARM_ABS32, \
- NULL, ESegmentRO, NULL, false);
- aRel->Add();
-
- aPlace += iUseCase->GetExportTableSize();// aPlace now points to the symInfo
- uint32 *aZerothOrd = (uint32*)iUseCase->GetExportTable();
- *aZerothOrd = aPlace;
- aPlace += sizeof(E32EpocExpSymInfoHdr);// aPlace now points to the symbol address
- // which is just after the syminfo header.
- if(!iElfExecutable->iExports)
- return;
-
- // Donot disturb the internal list sorting.
- ElfExports::ExportList aList = iElfExecutable->iExports->GetExports(false);
-
- ElfExports::ExportList::iterator aIter = aList.begin();
- DllSymbol *aSym;
- TUint aAlign, aNameLen;
-
-
- char aPad[] = {'\0', '\0', '\0', '\0'};
-
-
- while ( aIter != aList.end() ) {
- aSym = *aIter;
- iSymAddrTab.push_back(aSym->iElfSym->st_value);
- // The symbol names always start at a 4-byte aligned offset.
- iSymNameOffset = iSymbolNames.size() >> 2;
- iSymNameOffTab.push_back(iSymNameOffset);
-
- iSymbolNames += aSym->SymbolName();
- iSymbolNames += '\0';
- aNameLen = iSymbolNames.size();
- aAlign = Align(aNameLen, sizeof(int));
- aAlign = aAlign - aNameLen;
- if(aAlign % 4){
- iSymbolNames.append(aPad, aAlign);
- }
- //Create a relocation entry...
- aRel = new ElfLocalRelocation(iElfExecutable, aPlace, 0, 0, R_ARM_ABS32, NULL,\
- ESegmentRO, aSym->iElfSym, false);
- aPlace += sizeof(uint32);
- aRel->Add();
- aIter++;
- }
-}
-
-char* E32ImageFile::CreateSymbolInfo(size_t aBaseOffset) {
- E32EpocExpSymInfoHdr aSymInf;
- uint32 aSizeofNames, aSize;
-
- SetSymInfo(aSymInf);
- if( aSymInf.iFlags & 1) {
- aSizeofNames = sizeof(uint32);
- }
- else {
- aSizeofNames = sizeof(uint16);
- }
-
- aSize = aSymInf.iSize;
-
- char* aInfo = new char[aSize];
- memset(aInfo, 0, aSize);
- memcpy(aInfo, (void*)&aSymInf, sizeof(aSymInf));
-
- TUint aPos = aSymInf.iSymbolTblOffset;
- memcpy(aInfo+aPos, iSymAddrTab.begin(), iSymAddrTab.size()*sizeof(uint32));
-
- aPos += iSymAddrTab.size()*aSizeofNames;
- aPos += iSymNameOffTab.size()*aSizeofNames;
- aPos = Align(aPos, sizeof(uint32));
-
- std::vector<uint32>::iterator Iter = iSymNameOffTab.begin();
- TInt aOffLen = 2;
- if(aSymInf.iFlags & 1)
- aOffLen=4;
- while(Iter != iSymNameOffTab.end()){
- memcpy( ((void*)(aInfo+aPos)), ((void*)Iter), aOffLen);
- aPos += aOffLen;
- Iter++;
- }
-
- aPos = aSymInf.iStringTableOffset;
- memcpy(aInfo+aPos, iSymbolNames.begin(), iSymbolNames.size());
-
- // At the end, the dependencies are listed. They remain zeroes and shall be fixed up
- // while relocating.
-
- // Update the import table to have offsets to ordinal zero entries
- uint32 *aLocation, aOffset;
- uint32 *aImportTab = iImportSection;
-
- std::vector<int>::iterator aIter = iImportTabLocations.begin();
- aOffset = aBaseOffset - iHdr->iCodeOffset;// This gives the offset of syminfo table base
- // wrt the code section start
- aOffset += aSymInf.iDepDllZeroOrdTableOffset; // This points to the ordinal zero offset table now
- while( aIter != iImportTabLocations.end()) {
- aLocation = (aImportTab + *aIter);
- *aLocation = aOffset;
- aOffset += sizeof(uint32);
- aIter++;
- }
-
- return aInfo;
-}
-
-void E32ImageFile::SetSymInfo(E32EpocExpSymInfoHdr& aSymInfo)
-{
- uint32 aSize = sizeof(E32EpocExpSymInfoHdr);
- memset(&aSymInfo, 0, aSize);
-
- uint16 aNSymbols = (uint16) iSymAddrTab.size();
- aSymInfo.iSymCount = aNSymbols;
- aSymInfo.iSymbolTblOffset = aSize;
- aSize += aNSymbols * sizeof(uint32); // Symbol addresses
- TUint aNameTabSz = iSymbolNames.size();
- TInt aSizeofNames;
-
- if( iSymNameOffset < 0xffff) {
- aSizeofNames = sizeof(uint16);
- aSymInfo.iFlags &= ~1;//reset the 0th bit
- }
- else {
- aSizeofNames = sizeof(uint32);
- aSymInfo.iFlags |= 1;//set the 0th bit
- }
- aSize += Align((aNSymbols * aSizeofNames), sizeof(uint32)); // Symbol name offsets
- aSymInfo.iStringTableOffset = aSize;
- aSize += aNameTabSz; // Symbol names in string tab
- aSymInfo.iStringTableSz = aNameTabSz;
- aSymInfo.iDepDllZeroOrdTableOffset = aSize;
- aSymInfo.iDllCount = iNumDlls ;
- aSize += iNumDlls * sizeof(uint32); // Dependency list - ordinal zero placeholder
- aSymInfo.iSize = aSize;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/e32imagefile.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Class for E32 Image implementation and dump of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef E32IMAGEFILE_H
-#define E32IMAGEFILE_H
-
-#include "pl_elfrelocation.h"
-#include "pl_elfrelocations.h"
-#include "e32imagedefs.h"
-#include <tools/elfdefs.h>
-
-#include <fstream>
-#include <vector>
-using std::vector;
-#include <iostream>
-using std::ifstream;
-
-#include <e32std.h>
-
-enum TFileSource
- {
- EE32Image=0,
- EPeFile=1,
- EElfFile=2,
- };
-
-class ELFExecutable;
-class ElfFileSupplied;
-
-/**
-Class E32ImageChunkDesc for different sections in the E32 image.
-@internalComponent
-@released
-*/
-class E32ImageChunkDesc
-{
-public:
- E32ImageChunkDesc(char * aData, size_t aSize, size_t aOffset, char * aDoc);
- virtual ~E32ImageChunkDesc();
- virtual void Write(char * aPlace);
-
-public:
- char * iData;
- size_t iSize;
- size_t iOffset;
- char * iDoc;
-};
-
-/**
-Class E32ImageChunks for a list of sections in the E32 image.
-@internalComponent
-@released
-*/
-class E32ImageChunks
-{
-public:
-
- typedef vector<E32ImageChunkDesc *> ChunkList;
-
-public:
- E32ImageChunks();
- virtual ~E32ImageChunks();
-
- void AddChunk(char * aData, size_t aSize, size_t aOffset, char * aDoc);
- size_t GetOffset();
- void SetOffset(size_t aOffset);
- ChunkList & GetChunks();
-
-public:
- ChunkList iChunks;
-
- size_t iOffset;
-
-};
-
-class ElfFileSupplied;
-
-/**
-Class E32ImageFile for fields of an E32 image.
-@internalComponent
-@released
-*/
-class E32ImageFile
-{
-public:
-
- typedef unsigned char uint8;
- typedef unsigned short uint16;
- typedef unsigned long uint32;
- struct E32RelocPageDesc
- {
- uint32 aOffset;
- uint32 aSize;
- };
-
-//public:
- E32ImageFile(const char * aFileName, ElfExecutable * aExecutable, ElfFileSupplied * aUseCase);
- virtual ~E32ImageFile();
-
- void GenerateE32Image();
-
- void ReadInputELFFile(const char * aName, size_t & aFileSize, Elf32_Ehdr * & aELFFile );
-
- void ProcessImports();
- const char * FindDSO(const char * aName);
-
- void ProcessRelocations();
- void ProcessCodeRelocations();
- void ProcessDataRelocations();
- void CreateRelocations(ElfRelocations::RelocationList & aRelocList, char * & aRelocs, size_t & aRelocSize);
- size_t RelocationsSize(ElfRelocations::RelocationList & aRelocList);
-
- uint16 GetE32RelocType(ElfRelocation * aReloc);
-
- void ConstructImage();
-
- virtual void InitE32ImageHeader();
- virtual size_t GetE32ImageHeaderSize();
- virtual size_t GetExtendedE32ImageHeaderSize();
- virtual void SetExtendedE32ImageHeaderSize(size_t aSize);
-
- virtual void ComputeE32ImageLayout();
- virtual size_t GetE32ImageSize();
- virtual size_t GetExportOffset();
- virtual void CreateExportBitMap();
- virtual void AddExportDescription();
-
- virtual void AllocateE32Image();
- virtual void FinalizeE32Image();
- virtual uint16 GetCpuIdentifier();
- virtual uint32 EntryPointOffset();
-
- enum EEntryPointStatus
- {
- EEntryPointOK,
- EEntryPointCorrupt,
- EEntryPointNotSupported
- };
-
- EEntryPointStatus ValidateEntryPoint();
-
- virtual void SetUpExceptions();
- virtual void SetUids();
- virtual void SetSecureId();
- virtual void SetVendorId();
- virtual void SetCallEntryPoints();
- virtual void SetCapability();
- virtual void SetPriority(bool isDllp);
- virtual void SetFixedAddress(bool isDllp);
- virtual void SetVersion();
- virtual void SetCompressionType();
- virtual void SetFPU();
- virtual void SetPaged();
- virtual void SetSymbolLookup();
- virtual void SetDebuggable();
- virtual void SetSmpSafe();
-
- void UpdateHeaderCrc();
-
- bool WriteImage(const char * aName);
-
-public:
- const char * iFileName;
-
- char * iE32Image;
- uint8 * iExportBitMap;
- ElfExecutable * iElfExecutable;
- std::vector<char*> cleanupStack;
- char* iData;
- ElfFileSupplied * iUseCase;
- E32ImageHeaderV * iHdr;
- size_t iHdrSize;
-
- E32ImageChunks iChunks;
-
- uint32 iNumDlls;
- uint32 iNumImports;
-
- uint32 * iImportSection;
- size_t iImportSectionSize;
-
- char * iCodeRelocs;
- size_t iCodeRelocsSize;
-
- char * iDataRelocs;
- size_t iDataRelocsSize;
-
- size_t iExportOffset;
- bool iLayoutDone;
-
- int iMissingExports;
-
- // This table carries the byte offsets in the import table entries corresponding
- // to the 0th ordinal entry of static dependencies.
- std::vector<int> iImportTabLocations;
- std::vector<uint32> iSymAddrTab;
- std::vector<uint32> iSymNameOffTab;
- std::string iSymbolNames;
- uint32 iSymNameOffset;
-
-public:
- E32ImageFile();
- TInt ReadHeader(ifstream& is);
- TInt Open(const char* aFileName);
- void Adjust(TInt aSize, TBool aAllowShrink=ETrue);
-
- TUint TextOffset();
- TUint DataOffset();
- TUint BssOffset();
- TUint32 Capability();
- TUint32 Format();
-
- void Dump(TText *aFileName,TInt aDumpFlags);
- void DumpHeader(TInt aDumpFlags);
- void DumpData(TInt aDumpFlags);
- void DumpSymbolInfo(E32EpocExpSymInfoHdr *aSymInfoHdr);
- void E32ImageExportBitMap();
- TInt CheckExportDescription();
- void ProcessSymbolInfo();
- char* CreateSymbolInfo(size_t aBaseOffset);
- void SetSymInfo(E32EpocExpSymInfoHdr& aSymInfo);
-public:
- inline TUint OrigCodeOffset() const {return OffsetUnadjust(iOrigHdr->iCodeOffset);}
- inline TUint OrigDataOffset() const {return OffsetUnadjust(iOrigHdr->iDataOffset);}
- inline TUint OrigCodeRelocOffset() const {return OffsetUnadjust(iOrigHdr->iCodeRelocOffset);}
- inline TUint OrigDataRelocOffset() const {return OffsetUnadjust(iOrigHdr->iDataRelocOffset);}
- inline TUint OrigImportOffset() const {return OffsetUnadjust(iOrigHdr->iImportOffset);}
- inline TUint OrigExportDirOffset() const {return OffsetUnadjust(iOrigHdr->iExportDirOffset);}
- inline TUint OffsetUnadjust(TUint a) const {return a ? a-iOrigHdrOffsetAdj : 0;}
- inline void OffsetAdjust(TUint& a) { if (a) a+=iOrigHdrOffsetAdj; }
-
-public:
-
- TInt iSize;
- E32ImageHeader* iOrigHdr;
- TInt iError;
- TFileSource iSource;
- TUint iOrigHdrOffsetAdj;
- TInt iFileSize;
-
-};
-
-ifstream &operator>>(ifstream &is, E32ImageFile &aImage);
-void InflateUnCompress(unsigned char* source, int sourcesize, unsigned char* dest, int destsize);
-
-
-#endif // E32IMAGEFILE_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/elf2e32.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class Elf2E32 for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "elf2e32.h"
-#include "errorhandler.h"
-#include "librarytarget.h"
-#include "dll_fb_target.h"
-#include "dll_rebuild_target.h"
-#include "exetarget.h"
-#include "polydll_fb_target.h"
-#include "exexp_fb_target.h"
-#include "exexp_rebuild_target.h"
-#include "polydll_rebuild_target.h"
-#include "stdexe_target.h"
-#include "filedump.h"
-
-#include <iostream>
-
-using std::cout;
-using std::endl;
-
-ParameterListInterface * Elf2E32::iInstance=0;
-
-/**
-Constructor for Elf2E32
-
-@internalComponent
-@released
-
-@param aArgc
- The number of command line arguments passed into the program
-@param aArgv
- The listing of all the arguments
-*/
-Elf2E32::Elf2E32(int aArgc, char **aArgv)
-{
- iParameterListInterface = GetInstance(aArgc, aArgv);
-}
-
-
-Elf2E32::~Elf2E32()
-{
- delete iInstance;
-}
-
-/**
-This function creates a single instance of the ParameterManager which is derived from
-ParameterListInterface which is the abstract base class.
-
-@internalComponent
-@released
-
-@param aArgc
- The number of command line arguments passed into the program
-@param aArgv
- The listing of all the arguments
-
-@return A pointer to the newly created ParameterListInterface object which is the
- abstract interface
-*/
-ParameterListInterface * Elf2E32::GetInstance(int aArgc, char ** aArgv)
-{
- if (iInstance == 0)
- iInstance = new ParameterManager(aArgc, aArgv);
-
- return iInstance;
-}
-
-/**
-This function is to select the appropriate use case based on the input values.
-1. If the input is only DEF file, then the usecase is the Create Library Target.
- For Library Creation, alongwith the DEF file input, the DSO file option and
- the link as option SHOULD be passed. Otherwise, appropriate error message will
- be generated.
-@internalComponent
-@released
-
-@return A pointer to the newly created UseCaseBase object
-
-*/
-UseCaseBase * Elf2E32::SelectUseCase()
-{
- bool definputoption = iParameterListInterface->DefFileInOption();
- bool elfinputoption = iParameterListInterface->ElfFileInOption();
- char * deffilein = iParameterListInterface->DefInput();
- char * elfin = iParameterListInterface->ElfInput();
- bool filedumpoption = iParameterListInterface->FileDumpOption();
- int dumpOptions = iParameterListInterface->DumpOptions();
- char *filedumpsuboptions = iParameterListInterface->FileDumpSubOptions();
-
- bool e32inputoption = iParameterListInterface->E32ImageInOption();
- char * e32in = iParameterListInterface->E32Input();
-
- bool dumpMessageFileOption = iParameterListInterface->DumpMessageFileOption();
-
- if (definputoption && !deffilein)
- throw ParameterParserError(NOARGUMENTERROR, "--definput");
-
- if (elfinputoption && !elfin)
- throw ParameterParserError(NOARGUMENTERROR, "--elfinput");
-
- if(filedumpoption && !dumpOptions)
- {
- //throw for wrong options
- throw InvalidArgumentError(INVALIDARGUMENTERROR,filedumpsuboptions,"--dump");
- }
-
- if(e32inputoption && !e32in)
- {
- throw ParameterParserError(NOARGUMENTERROR, "--e32input");
- }
-
- iTargetType = iParameterListInterface->TargetTypeName();
-
-// if (iTargetType == ETargetTypeNotSet) // Will get this warning in build
-// cout << "Warning: Target Type is not specified explicitly" << endl;
-
- if (iTargetType == EInvalidTargetType || iTargetType == ETargetTypeNotSet)
- {
- if (elfin)
- {
- if (deffilein)
- return iUseCase = new ExportTypeRebuildTarget(iParameterListInterface);
- else
- return iUseCase = new ElfFileSupplied(iParameterListInterface);
- }
- else if (filedumpoption || e32in)
- {
- return iUseCase = new FileDump(iParameterListInterface);
- }
- else if (deffilein)
- {
- iTargetType = ELib;
- }
- else if (dumpMessageFileOption)
- return NULL;
- else
- throw InvalidInvocationError(INVALIDINVOCATIONERROR); //REVISIT
- }
-
- switch (iTargetType)
- {
- case EDll:
- if (!deffilein && elfin)
- iUseCase = new DLLFBTarget(iParameterListInterface);
- else if (deffilein && elfin)
- iUseCase = new DLLRebuildTarget(iParameterListInterface);
- else if (!elfin)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--elfinput");
-
- ValidateDSOGeneration(iParameterListInterface, iTargetType);
- ValidateE32ImageGeneration(iParameterListInterface, iTargetType);
- return iUseCase;
- case ELib:
- if (deffilein)
- {
- ValidateDSOGeneration(iParameterListInterface, iTargetType);
- return iUseCase = new LibraryTarget(iParameterListInterface);
- }
- else
- {
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--definput");
- }
- break;
- case EExe:
- if (elfin)
- {
- iUseCase = new ExeTarget(iParameterListInterface);
- ValidateE32ImageGeneration(iParameterListInterface, iTargetType);
- }
- else
- {
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--elfinput");
- }
- return iUseCase;
- case EPolyDll:
- if (!deffilein && elfin)
- iUseCase = new POLYDLLFBTarget(iParameterListInterface);
- else if (deffilein && elfin)
- iUseCase = new POLYDLLRebuildTarget(iParameterListInterface);
- else if (!elfin)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--elfinput");
-
- ValidateE32ImageGeneration(iParameterListInterface, iTargetType);
- return iUseCase;
- case EExexp:
- if (!deffilein && elfin)
- iUseCase = new ExexpFBTarget(iParameterListInterface);
- else if (deffilein && elfin)
- iUseCase = new ExExpRebuildTarget(iParameterListInterface);
- else if (!elfin)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--elfinput");
-
- ValidateDSOGeneration(iParameterListInterface,iTargetType);
- ValidateE32ImageGeneration(iParameterListInterface, iTargetType);
- return iUseCase;
- case EStdExe:
- iUseCase = new StdExeTarget(iParameterListInterface);
- return iUseCase;
- default:
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-
- return (iUseCase=0x0);
-}
-
-void Elf2E32::ValidateDSOGeneration(ParameterListInterface *aParameterListInterface, ETargetType aTargetType)
-{
- bool dsofileoutoption = aParameterListInterface->DSOFileOutOption();
- bool linkasoption = aParameterListInterface->LinkAsOption();
- char * dsofileout = aParameterListInterface->DSOOutput();
- char * linkas = aParameterListInterface->LinkAsDLLName();
-
- if (aTargetType != ELib)
- {
- bool deffileoutoption = aParameterListInterface->DefFileOutOption();
-
- if (!deffileoutoption)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--defoutput");
-
- char * deffileout = aParameterListInterface->DefOutput();
- //Incase if the DEF file name is not passed as an input
- if (!deffileout)
- throw ParameterParserError(NOARGUMENTERROR,"--defoutput");
- }
-
- if (dsofileoutoption && !dsofileout)
- throw ParameterParserError(NOARGUMENTERROR, "--dso");
- else if (linkasoption && !linkas)
- throw ParameterParserError(NOFILENAMEERROR,"--linkas");
- else if (!dsofileoutoption && !linkasoption)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--dso, --linkas");
- else if (!dsofileoutoption)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--dso");
- else if (!linkasoption)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--linkas");
-
-}
-
-void Elf2E32::ValidateE32ImageGeneration(ParameterListInterface *aParameterListInterface, ETargetType aTargetType)
-{
- bool e32fileoutoption = aParameterListInterface->E32OutOption();
- char * e32fileout = aParameterListInterface->E32ImageOutput();
-
- if (!e32fileoutoption)
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--output");
- else if (!e32fileout)
- throw ParameterParserError(NOARGUMENTERROR,"--output");
-
- UINT uid1option = aParameterListInterface->Uid1Option();
- UINT uid1val = aParameterListInterface->Uid1();
-
- if (!uid1option) // REVISIT
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--uid1");
- else if (uid1option && !uid1val)
- throw ParameterParserError(NOARGUMENTERROR,"--uid1");
- else if (aTargetType == EDll && uid1val != 0x10000079)
- cout << "UID1 should be set to 0x10000079 for DLL Generation" << endl;
- else if (aTargetType == EExe && uid1val != 0x1000007A)
- cout << "UID1 should be set to 0x1000007A for EXE Generation" << endl;
-
-}
-
-/**
-This function:
- 1. Calls the ParameterAnalyser() which parses the command line options and extracts the inputs.
- 2. Calls the SelectUseCase() to select the appropriate use case based on the input values.
- 3. Calls the Execute() of the selected use case.
-@internalComponent
-@released
-
-@return EXIT_SUCCESS if the generation of the target is successful, else EXIT_FAILURE
-
-*/
-int Elf2E32::Execute()
-{
- int result = EXIT_SUCCESS;
- UseCaseBase * usecase=0;
- bool dumpMessageFileOption;
- char * dumpMessageFile;
-
- try
- {
- iParameterListInterface->ParameterAnalyser();
-
- dumpMessageFileOption = iParameterListInterface->DumpMessageFileOption();
- dumpMessageFile = iParameterListInterface->DumpMessageFile();
-
- if(dumpMessageFileOption)
- {
- if (dumpMessageFile)
- {
- //create message file
- MessageHandler::GetInstance()->CreateMessageFile(dumpMessageFile);
- //return result;
- }
- else
- //dumpmessage file name is not provided as input
- throw ParameterParserError(NOARGUMENTERROR, "--dumpmessagefile");
- }
-
- usecase = SelectUseCase();
- if (usecase)
- {
- result = usecase->Execute();
- }
- else if (dumpMessageFileOption)
- {
- return result;
- }
- else
- {
- result = EXIT_FAILURE;
- }
- }
- catch(ErrorHandler& error)
- {
- result = EXIT_FAILURE;
- error.Report();
- }
- catch(...) // If there are any other unhandled exception,they are handled here.
- {
- result = EXIT_FAILURE;
- MessageHandler::GetInstance()->ReportMessage(ERROR, POSTLINKERERROR);
- }
- delete usecase;
- return result;
-}
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/elf2e32.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class Elf2E32
-// @internalComponent
-// @released
-//
-//
-
-#ifndef ELF2E32_H
-#define ELF2E32_H
-
-#include "pl_common.h"
-#include "parametermanager.h"
-
-class UseCaseBase;
-class ParameterListInterface;
-/**
-This class gets the single instance of the ParameterManager.
-
-@internalComponent
-@released
-*/
-class Elf2E32
-{
-
-public:
- Elf2E32();
- Elf2E32(int argc, char** argv);
- virtual ~Elf2E32();
- UseCaseBase * SelectUseCase();
- int Execute();
- static void ValidateDSOGeneration(ParameterListInterface *aParameterListInterface, ETargetType aTargetType);
- static void ValidateE32ImageGeneration(ParameterListInterface *aParameterListInterface, ETargetType aTargetType);
- static ParameterListInterface * GetInstance(int aArgc, char ** aArgv);
-
-private:
-
- ETargetType iTargetType;
-
- /** Pointer to the ParameterListInterface which is the abstract base class */
- ParameterListInterface * iParameterListInterface;
-
- /** Pointer to the UseCaseBase and says whether the usecase is CreateLibrary or CreateDLL or CreateEXE*/
- UseCaseBase * iUseCase;
-
- /** Static Pointer to the ParameterListInterface */
- static ParameterListInterface * iInstance;
-};
-
-
-#endif // ELF2E32_H
--- a/toolsandutils/e32tools/elf2e32/source/elffilesupplied.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,655 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "elffilesupplied.h"
-#include "pl_elfexecutable.h"
-#include "errorhandler.h"
-#include "pl_dso_handler.h"
-#include "deffile.h"
-#include "pl_elfexports.h"
-#include "pl_dllsymbol.h"
-#include "elf2e32.h"
-#include "staticlibsymbols.h"
-
-#include <algorithm>
-#include <iostream>
-#include<hash_set>
-
-using namespace std;
-
-/**
-Constructor for class ElfFileSupplied to initialize members and create instance of class DSOHandler
-@param aParameterListInterface - Instance of class ParameterListInterface
-@internalComponent
-@released
-*/
-ElfFileSupplied::ElfFileSupplied(ParameterListInterface* aParameterListInterface) : UseCaseBase(aParameterListInterface) ,
- iNumAbsentExports(-1),iExportBitMap(NULL),iE32ImageFile(NULL), iElfExecutable(NULL), \
- iExportDescSize(0), iExportDescType(0)
-{
- iElfIfc = new DSOHandler(aParameterListInterface);
-}
-
-/**
-Destructor for class ElfFileSupplied to release allocated memory
-@internalComponent
-@released
-*/
-ElfFileSupplied::~ElfFileSupplied()
-{
- iSymList.clear();
- delete iElfIfc;
- delete [] iExportBitMap;
-}
-
-/**
-Execute Function for the Elf File Supplied use case
-@return 0 on success
-@internalComponent
-@released
-*/
-int ElfFileSupplied::Execute()
-{
- ReadElfFile();
- iElfIfc->ProcessElfFile();
- try
- {
- ProcessExports();
- }
- catch(SymbolMissingFromElfError& aSme)
- {
- /* Only DEF file would be generated if symbols found in
- * DEF file are missing from the ELF file.
- */
- WriteDefFile();
- throw aSme;
- }
- GenerateOutput();
- return 0;
-}
-
-/**
-Function to read ELF File
-@internalComponent
-@released
-*/
-void ElfFileSupplied::ReadElfFile()
-{
- char * aElfFileName = UseCaseBase::InputElfFileName();
-
- iElfIfc->ReadElfFile(aElfFileName);
- iElfExecutable = iElfIfc->ElfExecutableP();
-}
-
-/**
-Function to process exports
-@internalComponent
-@released
-*/
-void ElfFileSupplied::ProcessExports()
-{
- ValidateExports(NULL);
- CreateExports();
-}
-
-/**
-Function to write DEF File
-@internalComponent
-@released
-*/
-void ElfFileSupplied::WriteDefFile()
-{
- char * aDEFFileName = UseCaseBase::DefOutput();
- DefFile deffile;
-
- deffile.WriteDefFile(aDEFFileName, &iSymList);
-}
-
-/**
-Function to create exports
-@internalComponent
-@released
-*/
-void ElfFileSupplied::CreateExports()
-{
- if (iElfExecutable->iExports || GetNamedSymLookup())
- {
- CreateExportTable();
- CreateExportBitMap();
- }
-}
-
-/**
-Function to validate exports
-@param aDefExports - List of export symbols from Def file and/or sysdef.
-@internalComponent
-@released
-*/
-void ElfFileSupplied::ValidateExports(SymbolList *aDefExports)
-{
- /**
- * Symbols from DEF file (DEF_Symbols) => Valid_DEF + Absent
- * Symbols from ELF file (ELF_Symbols) => Existing + NEW
- * 1. if the set {Valid_DEF - ELF_Symbols} is non-empty then, symbols are missing
- * from Elf and it is an error if the mode is UNFROZEN
- * 2. if the intersection set {Absent,ELF_Symbols} is non-empty, absent symbols
- * are exported from Elf..warn for this
- * 3. if the set {ELF_Symbols - Valid_DEF} is non-empty, these are the NEW symbols
- * 4. if there are symbols marked absent in DEF file but exported in ELF,
- * add them into the new list retaining the ordinal number as of the
- * absent symbol(using PtrELFExportNameCompareUpdateOrdinal).
- **/
-
- PLUINT32 aMaxOrdinal = 0;
- int len = strlen("_ZTI");
-
- typedef SymbolList::iterator Iterator;
-
- Iterator aPos, aEnd;
-
- //SymbolList *aDefExports, aDefValidExports, aDefAbsentExports, aElfExports;
- SymbolList aDefValidExports, aDefAbsentExports, aElfExports;
-
- //aDefExports = iDefIfc->GetSymbolEntryList();
- if (aDefExports)
- {
- aPos = aDefExports->begin();
- aEnd = aDefExports->end();
-
- while(aPos != aEnd)
- {
- if( (*aPos)->Absent() ){
- aDefAbsentExports.insert(aDefAbsentExports.end(), *aPos);
- }
- else {
- aDefValidExports.insert(aDefValidExports.end(), *aPos);
- }
-
- if( aMaxOrdinal < (*aPos)->OrdNum() ){
- aMaxOrdinal = (*aPos)->OrdNum();
- }
- aPos++;
- }
- }
-
- iSymList = aDefValidExports;
-
- if (iElfIfc->ElfExecutableP()->iExports)
- iElfIfc->GetElfExportSymbolList( aElfExports );
- else if (!aDefExports)
- return;
-
- // REVISIT - return back if elfexports and defexports is NULL
-
- aDefValidExports.sort(ElfExports::PtrELFExportNameCompare());
- aElfExports.sort(ElfExports::PtrELFExportNameCompare());
-
- aDefAbsentExports.sort(ElfExports::PtrELFExportNameCompare());
-
- //Check for Case 1... {Valid_DEF - ELF_Symbols}
- {
- SymbolList aResult(aDefValidExports.size());
- Iterator aResultPos = aResult.begin();
-
- Iterator aMissingListEnd = set_difference(aDefValidExports.begin(), aDefValidExports.end(), \
- aElfExports.begin(), aElfExports.end(), aResultPos, ElfExports::PtrELFExportNameCompareUpdateAttributes());
-
- std::list<String> aMissingSymNameList;
- while (aResultPos != aMissingListEnd) {
- // {Valid_DEF - ELF_Symbols} is non empty
- (*aResultPos)->SetSymbolStatus(Missing); // Set the symbol Status as Missing
- aMissingSymNameList.push_back((*aResultPos)->SymbolName());
- aResultPos++;
- //throw error
- }
- if( aMissingSymNameList.size() ) {
- if (!Unfrozen())
- throw SymbolMissingFromElfError(SYMBOLMISSINGFROMELFERROR, aMissingSymNameList, UseCaseBase::InputElfFileName());
- else
- cout << "Elf2e32: Warning: " << aMissingSymNameList.size() << " Frozen Export(s) missing from the ELF file" << endl;
- }
- }
-
- //Check for Case 2... intersection set {Absent,ELF_Symbols}
- {
- if(aDefAbsentExports.size())
- {
- SymbolList aResult(aDefAbsentExports.size());
- Iterator aResultPos = aResult.begin();
-
- Iterator aAbsentListEnd = set_intersection(aDefAbsentExports.begin(), aDefAbsentExports.end(), \
- aElfExports.begin(), aElfExports.end(), aResultPos, ElfExports::PtrELFExportNameCompareUpdateAttributes());
-
- while( aResultPos != aAbsentListEnd )
- {
- // intersection set {Absent,ELF_Symbols} is non-empty
-
- iSymList.insert(iSymList.end(), *aResultPos);
- cout << "Elf2e32: Warning: Symbol " << (*aResultPos)->SymbolName() << " absent in the DEF file, but present in the ELF file" << endl;
- aResultPos++;
- }
- }
- }
-
- //Do 3
- {
- SymbolList aResult(aElfExports.size());
- Iterator aResultPos = aResult.begin();
-
- Iterator aNewListEnd = set_difference(aElfExports.begin(), aElfExports.end(), \
- aDefValidExports.begin(), aDefValidExports.end(), aResultPos, ElfExports::PtrELFExportNameCompare());
-
- bool aIgnoreNonCallable = GetIgnoreNonCallable();
- bool aIsCustomDll = IsCustomDllTarget();
- bool aExcludeUnwantedExports = ExcludeUnwantedExports();
-
- while( aResultPos != aNewListEnd )
- {
-
- if( !(*aResultPos)->Absent() )
- {
- /* For a custom dll and for option "--excludeunwantedexports", the new exports should be filtered,
- * so that only the exports from the frozen DEF file are considered.
- */
- if ((aIsCustomDll || aExcludeUnwantedExports) && UnWantedSymbolp((*aResultPos)->SymbolName()))
- {
- iElfExecutable->iExports->ExportsFilteredP(true);
- iElfExecutable->iExports->iFilteredExports.insert(iElfExecutable->iExports->iFilteredExports.end(),(DllSymbol *)(*aResultPos));
- aResultPos++;
- continue;
- }
- if (aIgnoreNonCallable)
- {
- // Ignore the non callable exports
- if ((!strncmp("_ZTI", (*aResultPos)->SymbolName(), len)) ||
- (!strncmp("_ZTV", (*aResultPos)->SymbolName(), len)))
- {
- iElfExecutable->iExports->ExportsFilteredP(true);
- iElfExecutable->iExports->iFilteredExports.insert(iElfExecutable->iExports->iFilteredExports.end(),(DllSymbol *)(*aResultPos));
- aResultPos++;
- continue;
- }
- }
- (*aResultPos)->SetOrdinal( ++aMaxOrdinal );
- (*aResultPos)->SetSymbolStatus(New); // Set the symbol Status as NEW
- iSymList.insert(iSymList.end(), *aResultPos);
- if(WarnForNewExports())
- cout << "Elf2e32: Warning: New Symbol " << (*aResultPos)->SymbolName() << " found, export(s) not yet Frozen" << endl;
- }
- aResultPos++;
- }
- }
-
- //Do 4
- {
- if(aDefAbsentExports.size())
- {
- SymbolList aResult(aDefAbsentExports.size());
- Iterator aResultPos = aResult.begin();
-
- Iterator aAbsentListEnd = set_difference(aDefAbsentExports.begin(), aDefAbsentExports.end(), \
- aElfExports.begin(), aElfExports.end(), aResultPos, ElfExports::PtrELFExportNameCompareUpdateAttributes());
-
- DllSymbol *aSymbol;
- bool aAbsent = true;
- while( aResultPos != aAbsentListEnd ) {
- //aElfExports.insert(aElfExports.end(), *aResultPos);
- aSymbol = new DllSymbol( *aResultPos, SymbolTypeCode, aAbsent);
- iElfExecutable->iExports->Add(iElfExecutable->iSOName, aSymbol);
- //aElfExports.insert(aElfExports.end(), (Symbol*)aSymbol);
- iSymList.insert(iSymList.end(), (Symbol*)aSymbol);
- aResultPos++;
- }
- aElfExports.sort(ElfExports::PtrELFExportOrdinalCompare());
- iSymList.sort(ElfExports::PtrELFExportOrdinalCompare());
- }
- }
-
- if(iElfExecutable->iExports && iElfExecutable->iExports->ExportsFilteredP() ) {
- iElfExecutable->iExports->FilterExports();
- }
-
- aElfExports.clear();
- aDefAbsentExports.clear();
- aDefValidExports.clear();
-
-}
-
-/**
-Function to generate output which is E32 Image file, DEF File and DSO file, if
-exports are available.
-@internalComponent
-@released
-*/
-void ElfFileSupplied::GenerateOutput()
-{
- if (iElfExecutable->iExports)
- {
- Elf2E32::ValidateDSOGeneration(iParameterListInterface, ETargetTypeNotSet);
- WriteDefFile();
- WriteDSOFile();
- }
- Elf2E32::ValidateE32ImageGeneration(iParameterListInterface, ETargetTypeNotSet);
- WriteE32();
-}
-
-/**
-Function to write DSO file.
-@internalComponent
-@released
-*/
-void ElfFileSupplied::WriteDSOFile()
-{
- char * aLinkAs = UseCaseBase::LinkAsDLLName();
- char * aDSOName = UseCaseBase::DSOOutput();
- char * aDSOFileName = UseCaseBase::FileName(aDSOName);
-
- iElfIfc->WriteElfFile( aDSOName, aDSOFileName, aLinkAs, iSymList );
-}
-
-/**
-Function to write E32 Image file.
-@internalComponent
-@released
-*/
-void ElfFileSupplied::WriteE32()
-{
-
- const char * aE32FileName = OutputE32FileName();
-
- iE32ImageFile = new E32ImageFile(aE32FileName, iElfExecutable, this);
-
- try
- {
- iE32ImageFile->GenerateE32Image();
-
- if (iE32ImageFile->WriteImage(aE32FileName))
- {
- //GetELF2E32()->AddFileCleanup(aE32FileName);
- delete iE32ImageFile;
- }
- }
- catch (...)
- {
- delete iE32ImageFile;
- throw;
- }
-}
-
-/**
-Function to check image is Dll or not.
-@return True if image is Dll, otherwise false.
-@internalComponent
-@released
-*/
-bool ElfFileSupplied::ImageIsDll()
-{
- return (iElfExecutable->LookupStaticSymbol("_E32Dll") != NULL);
-}
-
-/**
-Function to allocate E32 Image header.
-@return pointer to E32ImageHeaderV
-@internalComponent
-@released
-*/
-E32ImageHeaderV * ElfFileSupplied::AllocateE32ImageHeader()
-{
- if (iNumAbsentExports == 0)
- {
- return new E32ImageHeaderV;
- }
-
- int nexp = GetNumExports();
- size_t memsz = (nexp + 7) >> 3; // size of complete bitmap
- size_t mbs = (memsz + 7) >> 3; // size of meta-bitmap
- size_t nbytes = 0;
- PLUINT32 i;
- for (i=0; i<memsz; ++i)
- if (iExportBitMap[i] != 0xff)
- ++nbytes; // number of groups of 8
- PLUINT8 edt = KImageHdr_ExpD_FullBitmap;
- PLUINT32 extra_space = memsz - 1;
- if (mbs + nbytes < memsz)
- {
- edt = KImageHdr_ExpD_SparseBitmap8;
- extra_space = mbs + nbytes - 1;
- }
- extra_space = (extra_space + sizeof(PLUINT32) - 1) &~ (sizeof(PLUINT32) - 1);
- size_t aExtendedHeaderSize = sizeof(E32ImageHeaderV) + extra_space;
- iE32ImageFile->SetExtendedE32ImageHeaderSize(aExtendedHeaderSize);
- E32ImageHeaderV * aHdr = (E32ImageHeaderV *)new PLUINT8[aExtendedHeaderSize];
-
- iExportDescType = edt;
- if (edt == KImageHdr_ExpD_FullBitmap)
- {
- iExportDescSize = (PLUINT16)memsz;
- memcpy(aHdr->iExportDesc, iExportBitMap, memsz);
- }
- else
- {
- iExportDescSize = (PLUINT16) (mbs + nbytes);
- memset(aHdr->iExportDesc, 0, extra_space + 1);
- PLUINT8* mptr = aHdr->iExportDesc;
- PLUINT8* gptr = mptr + mbs;
- for (i=0; i<memsz; ++i)
- {
- if (iExportBitMap[i] != 0xff)
- {
- mptr[i>>3] |= (1u << (i&7));
- *gptr++ = iExportBitMap[i];
- }
- }
- }
- return aHdr;
-}
-
-/**
-Function to create export table
-@internalComponent
-@released
-*/
-void ElfFileSupplied::CreateExportTable()
-{
- ElfExports::ExportList aList;
-
- if(iElfExecutable->iExports)
- aList = iElfExecutable->GetExportsInOrdinalOrder();
-
- iExportTable.CreateExportTable(iElfExecutable, aList);
-}
-
-/**
-Function to create export bitmap
-@internalComponent
-@released
-*/
-void ElfFileSupplied::CreateExportBitMap()
-{
- int nexp = GetNumExports();
- size_t memsz = (nexp + 7) >> 3;
- iExportBitMap = new PLUINT8[memsz];
- memset(iExportBitMap, 0xff, memsz);
- // skip header
- PLUINT32 * exports = ((PLUINT32 *)GetExportTable()) + 1;
- PLUINT32 absentVal = iElfExecutable->EntryPointOffset() + iElfExecutable->GetROBase();
- iNumAbsentExports = 0;
- for (int i=0; i<nexp; ++i)
- {
- if (exports[i] == absentVal)
- {
- iExportBitMap[i>>3] &= ~(1u << (i & 7));
- ++iNumAbsentExports;
- }
- }
-}
-
-/**
-Function to get number of exports
-@return Number of exports in export table
-@internalComponent
-@released
-*/
-size_t ElfFileSupplied::GetNumExports()
-{
- return iExportTable.GetNumExports();
-}
-
-/**
-Function to check export table is required.
-@return True for E32 image if allocation requires space for export table.
-@internalComponent
-@released
-*/
-bool ElfFileSupplied::AllocateExportTableP()
-{
- return iExportTable.AllocateP();
-}
-
-/**
-Function to get export table
-@return Pointer to export table
-@internalComponent
-@released
-*/
-char * ElfFileSupplied::GetExportTable()
-{
- return (char *)iExportTable.GetExportTable();
-}
-
-/**
-Function to get export table size
-@return size of export table
-@internalComponent
-@released
-*/
-size_t ElfFileSupplied::GetExportTableSize()
-{
- return iExportTable.GetExportTableSize();
-}
-
-/**
-Function to get export table Virtual address
-@return the export table VA
-@internalComponent
-@released
-*/
-size_t ElfFileSupplied::GetExportTableAddress()
-{
- return iExportTable.iExportTableAddress;
-}
-
-/**
-Function to get export offset
-@return size of export offset
-@internalComponent
-@released
-*/
-size_t ElfFileSupplied::GetExportOffset()
-{
- return iE32ImageFile->GetExportOffset();
-}
-
-/**
-Function to get symbol type based on the encoded names.
-@return CODE or DATA
-@internalComponent
-@released
-*/
-SymbolType ElfFileSupplied::SymbolTypeF(char * aName)
-{
- size_t prefixLength = strlen("_ZTV");
- bool classImpedimenta = false;
- classImpedimenta = !strncmp(aName, "_ZTV", prefixLength) ||
- !strncmp(aName, "_ZTI", prefixLength) ||
- !strncmp(aName, "_ZTS", prefixLength) ;
-
- return classImpedimenta? SymbolTypeData : SymbolTypeCode;
-}
-
-/**
-Function to get export description size
-@return export description size
-@internalComponent
-@released
-*/
-PLUINT16 ElfFileSupplied::GetExportDescSize()
-{
- return iExportDescSize;
-}
-
-/**
-Function to get export description type
-@return export description type
-@internalComponent
-@released
-*/
-PLUINT8 ElfFileSupplied::GetExportDescType()
-{
- return iExportDescType;
-}
-
-/**
-Function to indicate if the new exports are to be reported as warnings.
-@return export description type
-@internalComponent
-@released
-*/
-bool ElfFileSupplied::WarnForNewExports()
-{
- return true;
-}
-
-/**
-To check if the two strings are equal
-@internalComponent
-@released
-*/
-struct eqstr
-{
- bool operator()(const char* s1, const char* s2) const
- {
- return strcmp(s1, s2) == 0;
- }
-};
-
-/**
-Function to provide a predicate which checks whether a symbol name is unwanted:
-@return 1 if new symbols are present in the static library list else return 0
-@param aSymbol symbols to be checked if part of static lib
-@internalComponent
-@released
-*/
-int ElfFileSupplied::UnWantedSymbolp(const char * aSymbol)
-{
- static hash_set<const char*, hash<const char*>, eqstr> aSymbolSet;
- int symbollistsize=sizeof(Unwantedruntimesymbols)/sizeof(Unwantedruntimesymbols[0]);
- static bool FLAG=false;
- while(!FLAG)
- {
- for(int i=0;i<symbollistsize;i++)
- {
- aSymbolSet.insert(Unwantedruntimesymbols[i]);
- }
- FLAG=true;
- }
- hash_set<const char*, hash<const char*>, eqstr>::const_iterator it
- = aSymbolSet.find(aSymbol);
- if(it != aSymbolSet.end())
- return 1;
- else
- return 0;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/elffilesupplied.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// ElfFileSupplied class for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef __ELFFILESUPPLIED_H_
-#define __ELFFILESUPPLIED_H_
-
-#include "usecasebase.h"
-#include "e32exporttable.h"
-#include <list>
-
-class Symbol;
-class DllSymbol;
-class DSOHandler;
-class ParameterManager;
-
-typedef std::list<Symbol*> SymbolList;
-
-/**
-This class is derived from the base class UseCaseBase and handles case for elf file supplied.
-
-@internalComponent
-@released
-*/
-class ElfFileSupplied : public UseCaseBase
-{
-
-public:
- ElfFileSupplied(ParameterListInterface* aParameterListInterface);
- ~ElfFileSupplied();
- int Execute();
-
- void ReadElfFile();
- virtual void ProcessExports();
- virtual void GenerateOutput();
- void ValidateExports(SymbolList* aDefExports);
- void CreateExports();
- void WriteDefFile();
- void WriteDSOFile();
- void WriteE32();
- virtual bool ImageIsDll();
- virtual bool WarnForNewExports();
- SymbolType SymbolTypeF(char * aName);
- E32ImageHeaderV * AllocateE32ImageHeader();
-
- virtual void CreateExportTable();
- void CreateExportBitMap();
- virtual size_t GetNumExports();
- virtual size_t GetExportOffset();
- virtual bool AllocateExportTableP();
- virtual char * GetExportTable();
- virtual size_t GetExportTableSize();
-
- PLUINT16 GetExportDescSize();
- PLUINT8 GetExportDescType();
- size_t GetExportTableAddress();
- //Method to check whether a symbol name is unwanted
- int UnWantedSymbolp(const char * aSymbol);
-
-protected:
- SymbolList iSymList;
- DSOHandler *iElfIfc;
-
- E32ExportTable iExportTable;
- int iNumAbsentExports;
- PLUINT8 * iExportBitMap;
-
- E32ImageFile * iE32ImageFile;
- ElfExecutable *iElfExecutable;
- PLUINT16 iExportDescSize;
- PLUINT8 iExportDescType;
-};
-
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/errorhandler.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,936 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Error Handler Operations for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifdef _MSC_VER
- #pragma warning(disable: 4514) // unreferenced inline function has been removed
- #pragma warning(disable: 4702) // unreachable code
- #pragma warning(disable: 4710) // function not inlined
-#endif
-
-#include "errorhandler.h"
-#include "messagehandler.h"
-#include <iostream>
-#include <stdio.h>
-using std::cerr;
-using std::endl;
-
-char *errMssgPrefix="elf2e32 : Error: E";
-char *colonSpace=": ";
-
-/**
-ErrorHandler constructor for doing common thing required for derived class functions.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-ErrorHandler::ErrorHandler(int aMessageIndex)
-{
- char mssgNo[MAXMSSGNOLENGTH];
- int mssgIndex;
-
- iMessageIndex=aMessageIndex;
- iMessage=errMssgPrefix;
- mssgIndex=BASEMSSGNO+iMessageIndex;
- sprintf(mssgNo,"%d",mssgIndex);
- iMessage+=mssgNo;
- iMessage+=colonSpace;
-};
-
-/**
-ErrorHandler destructor.
-@internalComponent
-@released
-*/
-ErrorHandler::~ErrorHandler()
-{
- MessageHandler::CleanUp();
-}
-
-/**
-FileError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - File name
-@internalComponent
-@released
-*/
-FileError:: FileError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-}
-
-/**
-FileError destructor.
-@internalComponent
-@released
-*/
-FileError:: ~FileError()
-{
-}
-
-/**
-Function to report File Errors.
-@internalComponent
-@released
-*/
-void FileError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete[] tempMssg;
- }
-}
-
-/**
-ELFFormatError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - ELF File name
-@internalComponent
-@released
-*/
-ELFFormatError::ELFFormatError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-
-}
-
-/**
-ELFFormatError destructor.
-@internalComponent
-@released
-*/
-ELFFormatError::~ELFFormatError()
-{
-
-}
-
-/**
-Function to report ELF Format Errors.
-@internalComponent
-@released
-*/
-void ELFFormatError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-DEFFileError constructor for initializing message index, argument name and line number and token.
-@param aMessageIndex - Message Index
-@param aName - DEF File name
-@param aLineNo - DEF File line number
-@param aToken - Token in export entry
-@internalComponent
-@released
-*/
-DEFFileError::DEFFileError(int aMessageIndex, char * aName, int aLineNo,char * aToken) : ErrorHandler(aMessageIndex), iName(aName), iLineNo(aLineNo)
-{
- iToken=aToken;
- if(iToken[iToken.size()-1]=='\r')
- iToken[iToken.size()-1]='\0';
-}
-
-/**
-DEFFileError destructor.
-@internalComponent
-@released
-*/
-DEFFileError::~DEFFileError()
-{
-}
-
-/**
-Function to report DEF File Errors.
-@internalComponent
-@released
-*/
-void DEFFileError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+5+strlen(iName.c_str())+strlen(iToken.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str(),iLineNo,iToken.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-ParameterParserError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@Param aName - Argument name
-@internalComponent
-@released
-*/
-ParameterParserError::ParameterParserError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-}
-
-/**
-ParameterParserError destructor.
-@internalComponent
-@released
-*/
-ParameterParserError::~ParameterParserError()
-{
-}
-
-/**
-Function to report Parameter Parser Error.
-@internalComponent
-@released
-*/
-void ParameterParserError::Report()
-{
- char *tempMssg;
- char *errMessage;
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
-
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-InvalidArgumentError constructor for initializing message index, argument value and option.
-@param aMessageIndex - Message Index
-@param aValue - Argument value
-@param aOption - Argument option
-@internalComponent
-@released
-*/
-InvalidArgumentError::InvalidArgumentError(int aMessageIndex, const char * aValue, char * aOption) : ErrorHandler(aMessageIndex), iValue(aValue), iOption(aOption)
-{
-}
-
-/**
-InvalidArgumentError destructor.
-@internalComponent
-@released
-*/
-InvalidArgumentError::~InvalidArgumentError()
-{
-}
-
-/**
-Function to report Invalid Argument Error.
-@internalComponent
-@released
-*/
-void InvalidArgumentError::Report()
-{
- char *tempMssg;
- char *errMessage;
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
-
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iValue.c_str())+strlen(iOption.c_str())];
- sprintf(tempMssg,errMessage,iValue.c_str(),iOption.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-E32ImageCompressionError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-E32ImageCompressionError::E32ImageCompressionError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-E32ImageCompressionError destructor.
-@internalComponent
-@released
-*/
-E32ImageCompressionError::~E32ImageCompressionError()
-{
-}
-
-/**
-Function to report E32 Image Compression Error.
-@internalComponent
-@released
-*/
-void E32ImageCompressionError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-CapabilityError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-CapabilityError::CapabilityError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-CapabilityError destructor.
-@internalComponent
-@released
-*/
-CapabilityError::~CapabilityError()
-{
-}
-
-/**
-Function to report Capability Error.
-@internalComponent
-@released
-*/
-void CapabilityError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-UnrecognisedCapabilityError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - Capability
-@internalComponent
-@released
-*/
-UnrecognisedCapabilityError::UnrecognisedCapabilityError(int aMessageIndex, char * aName) : CapabilityError(aMessageIndex), iName(aName)
-{
-}
-
-/**
-UnrecognisedCapabilityError destructor.
-@internalComponent
-@released
-*/
-UnrecognisedCapabilityError::~UnrecognisedCapabilityError()
-{
-}
-
-/**
-Function to report Unrecognised Capability Error.
-@internalComponent
-@released
-*/
-void UnrecognisedCapabilityError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-ELFFileError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - ELF File name
-@internalComponent
-@released
-*/
-ELFFileError::ELFFileError(int aMessageIndex, const char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-}
-
-/**
-ELFFileError destructor.
-@internalComponent
-@released
-*/
-ELFFileError::~ELFFileError()
-{
-}
-
-/**
-Function to report ELF File Error.
-@internalComponent
-@released
-*/
-void ELFFileError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-UndefinedSymbolError constructor for initializing message index, argument name and symbol name.
-@param aMessageIndex - Message Index
-@param aName - File Name
-@param aSymbolName - Symbol Name
-@internalComponent
-@released
-*/
-UndefinedSymbolError::UndefinedSymbolError(int aMessageIndex, char * aName, char *aSymbolName) : ELFFileError(aMessageIndex,aName), iSymbolName(aSymbolName)
-{
-}
-
-/**
-UndefinedSymbolError destructor.
-@internalComponent
-@released
-*/
-UndefinedSymbolError::~UndefinedSymbolError()
-{
-}
-
-/**
-Function to report Undefined Symbol Error.
-@internalComponent
-@released
-*/
-void UndefinedSymbolError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iSymbolName.c_str())+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iSymbolName.c_str(),iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-SymbolMissingFromElfError constructor for initializing message index, symbol name list and argument name.
-@param aMessageIndex - Message Index
-@param aSymbolList - List of symbols
-@param aName - File Name
-@internalComponent
-@released
-*/
-SymbolMissingFromElfError::SymbolMissingFromElfError(int aMessageIndex, list<String> &aSymbolList, const char * aName) : ELFFileError(aMessageIndex,aName)
-{
-
- std::list<String>::iterator aItr = aSymbolList.begin();
- std::list<String>::iterator last = aSymbolList.end();
-
- while(aItr != last)
- {
- iSymbolNames+=*aItr;
- aItr++;
- if(aItr != last)
- {
- iSymbolNames+=",";
- }
- }
-
-}
-
-/**
-SymbolMissingFromElfError destructor.
-@internalComponent
-@released
-*/
-SymbolMissingFromElfError::~SymbolMissingFromElfError()
-{
-}
-
-/**
-Function to report Symbol Missing From Elf Error.
-@internalComponent
-@released
-*/
-void SymbolMissingFromElfError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iSymbolNames.c_str())+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iSymbolNames.c_str(),iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-MemoryAllocationError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - File Name
-@internalComponent
-@released
-*/
-MemoryAllocationError::MemoryAllocationError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-}
-
-/**
-MemoryAllocationError destructor.
-@internalComponent
-@released
-*/
-MemoryAllocationError::~MemoryAllocationError()
-{
-}
-
-/**
-Function to report Memory Allocation Error.
-@internalComponent
-@released
-*/
-void MemoryAllocationError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-E32ImageError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-E32ImageError::E32ImageError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-E32ImageError destructor.
-@internalComponent
-@released
-*/
-E32ImageError::~E32ImageError()
-{
-}
-
-/**
-Function to report E32 Image Error.
-@internalComponent
-@released
-*/
-void E32ImageError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-InvalidInvocationError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-InvalidInvocationError::InvalidInvocationError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-InvalidInvocationError destructor.
-@internalComponent
-@released
-*/
-InvalidInvocationError::~InvalidInvocationError()
-{
-}
-
-/**
-Function to report Invalid Invocation Error.
-@internalComponent
-@released
-*/
-void InvalidInvocationError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-TargetTypeError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-TargetTypeError::TargetTypeError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-TargetTypeError destructor.
-@internalComponent
-@released
-*/
-TargetTypeError::~TargetTypeError()
-{
-}
-
-/**
-Function to report Target Type Error.
-@internalComponent
-@released
-*/
-void TargetTypeError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-UnsupportedTargetTypeError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - Target type name
-@internalComponent
-@released
-*/
-UnsupportedTargetTypeError::UnsupportedTargetTypeError(int aMessageIndex, char * aName) : TargetTypeError(aMessageIndex), iName(aName)
-{
-}
-
-/**
-UnsupportedTargetTypeError destructor.
-@internalComponent
-@released
-*/
-UnsupportedTargetTypeError::~UnsupportedTargetTypeError()
-{
-}
-
-/**
-Function to report Unsupported Target Type Error.
-@internalComponent
-@released
-*/
-void UnsupportedTargetTypeError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-MessageError constructor for initializing message index and index value.
-@param aMessageIndex - Message Index
-@param aIndexValue - Value of Index
-@internalComponent
-@released
-*/
-MessageError::MessageError(int aMessageIndex, int aIndexValue) : ErrorHandler(aMessageIndex), iIndexValue(aIndexValue)
-{
-}
-
-/**
-MessageError destructor.
-@internalComponent
-@released
-*/
-MessageError::~MessageError()
-{
-}
-
-/**
-Function to report Message Errors.
-@internalComponent
-@released
-*/
-void MessageError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+5];
- sprintf(tempMssg,errMessage,iIndexValue);
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-NoMessageFileError constructor for initializing message index.
-@param aMessageIndex - Message Index
-@internalComponent
-@released
-*/
-NoMessageFileError::NoMessageFileError(int aMessageIndex) : ErrorHandler(aMessageIndex)
-{
-}
-
-/**
-NoMessageFileError destructor.
-@internalComponent
-@released
-*/
-NoMessageFileError::~NoMessageFileError()
-{
-}
-
-/**
-Function to report No Message File Error.
-@internalComponent
-@released
-*/
-void NoMessageFileError::Report()
-{
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- iMessage+=errMessage;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- }
-}
-
-/**
-SysDefMismatchError constructor for initializing message index, symbol name list and argument name.
-@param aMessageIndex - Message Index
-@param aSymbolList - list of symbols
-@param aName - sysdef
-@internalComponent
-@released
-*/
-SysDefMismatchError::SysDefMismatchError(int aMessageIndex, list<String> &aSymbolList, const char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-
- std::list<String>::iterator aItr = aSymbolList.begin();
- std::list<String>::iterator last = aSymbolList.end();
-
- while(aItr != last)
- {
- iSymbolNames+=*aItr;
- aItr++;
- if(aItr != last)
- {
- iSymbolNames+=",";
- }
- }
-
-}
-
-/**
-SysDefMismatchError destructor.
-@internalComponent
-@released
-*/
-SysDefMismatchError::~SysDefMismatchError()
-{
-}
-
-/**
-Function to report SysDef Mismatch Error.
-@internalComponent
-@released
-*/
-void SysDefMismatchError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iSymbolNames.c_str())+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iSymbolNames.c_str(),iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-InvalidE32ImageError constructor for initializing message index and argument name.
-@param aMessageIndex - Message Index
-@param aName - E32Image File name
-@internalComponent
-@released
-*/
-InvalidE32ImageError::InvalidE32ImageError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
-{
-}
-
-/**
-InvalidE32ImageError destructor.
-@internalComponent
-@released
-*/
-InvalidE32ImageError::~InvalidE32ImageError()
-{
-}
-
-/**
-Function to report Invalid E32 Image Error.
-@internalComponent
-@released
-*/
-void InvalidE32ImageError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-/**
-ImportRelocationError constructor for initializing message index, argument name and symbol name.
-@param aMessageIndex - Message Index
-@param aName - File Name
-@param aSymbolName - Symbol Name
-@internalComponent
-@released
-*/
-ImportRelocationError::ImportRelocationError(int aMessageIndex, char * aName, char *aSymbolName) : ELFFileError(aMessageIndex,aName), iSymbolName(aSymbolName)
-{
-}
-
-/**
-ImportRelocationError destructor.
-@internalComponent
-@released
-*/
-ImportRelocationError::~ImportRelocationError()
-{
-}
-
-/**
-Function to report Import Relocations references to Data Segment Error
-@internalComponent
-@released
-*/
-void ImportRelocationError::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage)+strlen(iSymbolName.c_str())+strlen(iName.c_str())];
- sprintf(tempMssg,errMessage,iSymbolName.c_str(),iName.c_str());
- iMessage+=tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete tempMssg;
- }
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/errorhandler.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Error Handler Classes for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef _ERROR_HANDLER_
-#define _ERROR_HANDLER_
-
-#include "messagehandler.h"
-#include <list>
-#include <string>
-
-using std::list;
-typedef std::string String;
-
-/**
-Base class from which all other error handler classes are derived from.
-@internalComponent
-@released
-*/
-class ErrorHandler
-{
- public:
- ErrorHandler(int aMessageIndex);
- virtual ~ErrorHandler();
- virtual void Report() =0;
-
- String iMessage;
- int iMessageIndex;
-};
-
-/**
-Base class for File Errors.
-@internalComponent
-@released
-*/
-class FileError : public ErrorHandler
-{
- public:
- FileError(int aMessageIndex, char * aName);
- virtual ~FileError();
- void Report();
-
- String iName;
-};
-
-/**
-Base class for ELFFormat Errors.
-@internalComponent
-@released
-*/
-class ELFFormatError : public ErrorHandler
-{
- public:
- ELFFormatError(int aMessageIndex, char * aName);
- virtual ~ELFFormatError();
- void Report();
-
- String iName;
-};
-
-/**
-Base class for DEF File Errors.
-@internalComponent
-@released
-*/
-class DEFFileError : public ErrorHandler
-{
- public:
- DEFFileError(int aMessageIndex, char * aName, int aLineNo,char * aToken);
- virtual ~DEFFileError();
- void Report();
-
- String iName;
- int iLineNo;
- String iToken;
-};
-
-/**
-Base class for Parameter Parser Errors.
-@internalComponent
-@released
-*/
-class ParameterParserError : public ErrorHandler
-{
- public:
- ParameterParserError(int aMessageIndex, char * aName);
- virtual ~ParameterParserError();
- void Report();
-
- String iName;
-};
-
-/**
-Class for Invalid Argument Errors.
-@internalComponent
-@released
-*/
-class InvalidArgumentError : public ErrorHandler
-{
- public:
- InvalidArgumentError(int aMessageIndex, const char * aValue, char * aOption);
- virtual ~InvalidArgumentError();
- void Report();
-
- String iValue;
- String iOption;
-};
-
-/**
-Base class for E32Image Compression Errors.
-@internalComponent
-@released
-*/
-class E32ImageCompressionError : public ErrorHandler
-{
- public:
- E32ImageCompressionError(int aMessageIndex);
- virtual ~E32ImageCompressionError();
- void Report();
-};
-
-/**
-Base class for Capability Errors.
-@internalComponent
-@released
-*/
-class CapabilityError : public ErrorHandler
-{
- public:
- CapabilityError(int aMessageIndex);
- virtual ~CapabilityError();
- void Report();
-};
-
-/**
-Class for handling Unrecognised Capability Errors.
-@internalComponent
-@released
-*/
-class UnrecognisedCapabilityError : public CapabilityError
-{
- public:
- UnrecognisedCapabilityError(int aMessageIndex, char * aName);
- ~UnrecognisedCapabilityError();
- void Report();
-
- String iName;
-};
-
-/**
-Base class for ELF File Errors.
-@internalComponent
-@released
-*/
-class ELFFileError : public ErrorHandler
-{
- public:
- ELFFileError(int aMessageIndex, const char * aName);
- virtual ~ELFFileError();
- void Report();
-
- String iName;
-};
-
-/**
-Class for handling Undefined Symbol Errors.
-@internalComponent
-@released
-*/
-class UndefinedSymbolError : public ELFFileError
-{
-public:
- UndefinedSymbolError(int aMessageIndex, char * aName, char *aSymbolName);
- ~UndefinedSymbolError();
- void Report();
-
- String iSymbolName;
-};
-
-/**
-Class for handling Import relocation to Data segment
-@internalComponent
-@released
-*/
-class ImportRelocationError : public ELFFileError
-{
-public:
- ImportRelocationError(int aMessageIndex, char * aName, char *aSymbolName);
- ~ImportRelocationError();
- void Report();
-
- String iSymbolName;
-};
-
-/**
-Class for handling Symbol Missing From Elf Errors.
-@internalComponent
-@released
-*/
-class SymbolMissingFromElfError : public ELFFileError
-{
- public:
- SymbolMissingFromElfError(int aMessageIndex, list<String> &aSymbolList, const char * aName);
- virtual ~SymbolMissingFromElfError();
- void Report();
-
- String iSymbolNames;
-};
-
-/**
-Class for handling Memory Allocation Errors.
-@internalComponent
-@released
-*/
-class MemoryAllocationError : public ErrorHandler
-{
- public:
- MemoryAllocationError(int aMessageIndex, char * aName);
- virtual ~MemoryAllocationError();
- void Report();
-
- String iName;
-};
-
-/**
-Class for handling E32 Image Errors.
-@internalComponent
-@released
-*/
-class E32ImageError : public ErrorHandler
-{
-public:
- E32ImageError(int aMessageIndex);
- ~E32ImageError();
- void Report();
-};
-
-/**
-Class for handling Invalid Invocation Errors.
-@internalComponent
-@released
-*/
-class InvalidInvocationError : public ErrorHandler
-{
-public:
- InvalidInvocationError(int aMessageIndex);
- ~InvalidInvocationError();
- void Report();
-};
-
-/**
-Base class for handling Target Type Errors.
-@internalComponent
-@released
-*/
-class TargetTypeError : public ErrorHandler
-{
-public:
- TargetTypeError(int aMessageIndex);
- ~TargetTypeError();
- void Report();
-};
-
-/**
-Class for handling Unsupported Target Type Errors.
-@internalComponent
-@released
-*/
-class UnsupportedTargetTypeError : public TargetTypeError
-{
-public:
- UnsupportedTargetTypeError(int aMessageIndex, char * aName);
- ~UnsupportedTargetTypeError();
- void Report();
-
- String iName;
-};
-
-/**
-Class for handling Message Errors.
-@internalComponent
-@released
-*/
-class MessageError : public ErrorHandler
-{
-public:
- MessageError(int aMessageIndex, int aIndexValue);
- ~MessageError();
- void Report();
-
- int iIndexValue;
-};
-
-/**
-Class for handling No Message File Errors.
-@internalComponent
-@released
-*/
-class NoMessageFileError : public ErrorHandler
-{
-public:
- NoMessageFileError(int aMessageIndex);
- ~NoMessageFileError();
- void Report();
-};
-
-/**
-Class for handling Symbol that are passed through --sysdef
-not matching with the ones in the DEF file.
-@internalComponent
-@released
-*/
-class SysDefMismatchError : public ErrorHandler
-{
- public:
- SysDefMismatchError(int aMessageIndex, list<String> &aSymbolList, const char * aName);
- virtual ~SysDefMismatchError();
- void Report();
-
- String iName;
- String iSymbolNames;
-};
-
-/**
-Class for handling Invalid E32 Image Error
-@internalComponent
-@released
-*/
-class InvalidE32ImageError : public ErrorHandler
-{
- public:
- InvalidE32ImageError(int aMessageIndex, char * aName);
- virtual ~InvalidE32ImageError();
- void Report();
-
- String iName;
-};
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/exetarget.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExeTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "exetarget.h"
-
-/**
-Constructor for the ExeTarget Class
-
-@internalComponent
-@released
-*/
-ExeTarget::ExeTarget(ParameterListInterface* aParameterListInterface):
-ElfFileSupplied(aParameterListInterface)
-{
-}
-
-/**
-Destructor for the ExeTarget Class
-
-@internalComponent
-@released
-*/
-ExeTarget::~ExeTarget()
-{
-}
-
-/**
-Function to process the symbols to be exported. This function is empty since there are no
-exports in case of EXE Target. However, this dummy implementation is included since
-this is a virtual function in ElfFileSuplied Class.
-
-@internalComponent
-@released
-*/
-void ExeTarget::ProcessExports()
-{
-}
-
-/**
-Function to generate the output E32 image.
-
-@internalComponent
-@released
-*/
-void ExeTarget::GenerateOutput()
-{
- WriteE32();
-}
-
-/**
-Function to check if the provided input is a DLL.
-
-@internalComponent
-@released
-
-@result False since EXE Target is not a DLL.
-*/
-bool ExeTarget::ImageIsDll()
-{
- return false;
-}
--- a/toolsandutils/e32tools/elf2e32/source/exetarget.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class ExeTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef EXETARGET_H
-#define EXETARGET_H
-
-#include "elffilesupplied.h"
-
-/**
-This class is derived from the base class ElfFileSupplied and is responsible for creation of
-EXE Target.
-
-@internalComponent
-@released
-*/
-class ExeTarget : public ElfFileSupplied
-{
-
-public:
- ExeTarget(ParameterListInterface* aParameterListInterface);
- virtual ~ExeTarget();
- void ProcessExports();
- void GenerateOutput();
-
- bool ImageIsDll();
-
-};
-
-
-#endif // EXETARGET_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/exexp_fb_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExexpTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "exexp_fb_target.h"
-
-/**
-Constructor for the ExexpFBTarget Class
-
-@internalComponent
-@released
-*/
-ExexpFBTarget::ExexpFBTarget(ParameterListInterface* aParameterListInterface):
-ExportTypeFBTarget(aParameterListInterface)
-{
-}
-
-/**
-Destructor for the ExexpFBTarget Class
-
-@internalComponent
-@released
-*/
-ExexpFBTarget::~ExexpFBTarget(){
-
-}
-
-/**
-Function to check if the provided input is a DLL.
-
-@internalComponent
-@released
-
-@result False since EXEXP Target is not a DLL.
-*/
-bool ExexpFBTarget::ImageIsDll()
-{
- return false;
-}
-
-/**
-Function to check if writable data is allowed.
-
-@internalComponent
-@released
-
-@result True, since EXEXP targets can have writable data
-*/
-bool ExexpFBTarget::AllowDllData()
-{
- return true;
-}
--- a/toolsandutils/e32tools/elf2e32/source/exexp_fb_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class Exexp_FB_Target of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef EXEXP_FB_TARGET_H
-#define EXEXP_FB_TARGET_H
-
-#include "export_type_fb_target.h"
-
-/**
-This class is derived from the base class ExportTypeFBTarget and is responsible for
-creation of EXEXP Target.
-
-@internalComponent
-@released
-*/
-class ExexpFBTarget : public ExportTypeFBTarget
-{
-
-public:
- ExexpFBTarget(ParameterListInterface* aParameterListInterface);
- virtual ~ExexpFBTarget();
- bool ImageIsDll();
- bool AllowDllData();
-
-};
-
-
-
-#endif // EXEXP_FB_TARGET_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/exexp_rebuild_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExexpTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "exexp_rebuild_target.h"
-
-/**
-Constructor for the ExexpRebuildTarget Class
-
-@internalComponent
-@released
-*/
-ExExpRebuildTarget::ExExpRebuildTarget(ParameterListInterface* aParameterListInterface) : ExportTypeRebuildTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the ExexpRebuildTarget Class
-
-@internalComponent
-@released
-*/
-ExExpRebuildTarget::~ExExpRebuildTarget() {
-}
-
-/**
-Function to check if the provided input is a DLL.
-
-@internalComponent
-@released
-
-@result False since EXEXP Target is not a DLL.
-*/
-bool ExExpRebuildTarget::ImageIsDll()
-{
- return false;
-}
-
-/**
-Function to check if writable data is allowed.
-
-@internalComponent
-@released
-
-@result True, since EXEXP targets can have writable data
-*/
-bool ExExpRebuildTarget::AllowDllData()
-{
- return true;
-}
--- a/toolsandutils/e32tools/elf2e32/source/exexp_rebuild_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Declaration of Class ExExpRebuildTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef EXEXP_REBUILD_TARGET_H
-#define EXEXP_REBUILD_TARGET_H
-
-#include "export_type_rebuild_target.h"
-
-/**
-This class is derived from the class ExportTypeRebuildTarget and handles exexp target rebuild
-
-@internalComponent
-@released
-*/
-class ExExpRebuildTarget : public ExportTypeRebuildTarget
-{
-
-public:
- ExExpRebuildTarget(ParameterListInterface* aParameterListInterface);
- ~ExExpRebuildTarget();
- bool ImageIsDll();
- bool AllowDllData();
-};
-
-
-#endif // EXEXP_REBUILD_TARGET_H
-
--- a/toolsandutils/e32tools/elf2e32/source/export_type_fb_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExexpTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "export_type_fb_target.h"
-
-/**
-Constructor for the ExportTypeFBTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeFBTarget::ExportTypeFBTarget(ParameterListInterface* aParameterListInterface) : ExportTypeTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the ExportTypeFBTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeFBTarget::~ExportTypeFBTarget() {
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/export_type_fb_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Declaration of Class ExportTypeFBTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef EXPORT_TYPE_FB_TARGET_H
-#define EXPORT_TYPE_FB_TARGET_H
-
-#include "export_type_target.h"
-
-/**
-class ExportTypeFBTarget is dervied from ExportTypeTarget and handles export type target
-first build
-
-@internalComponent
-@released
-*/
-class ExportTypeFBTarget : public ExportTypeTarget
-{
-
-public:
- ExportTypeFBTarget(ParameterListInterface* aParameterListInterface);
- ~ExportTypeFBTarget();
-
-};
-
-
-#endif // EXPORT_TYPE_FB_TARGET_H
-
--- a/toolsandutils/e32tools/elf2e32/source/export_type_rebuild_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExexpTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "export_type_rebuild_target.h"
-#include "deffile.h"
-
-/**
-Constructor for the ExportTypeRebuildTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeRebuildTarget::ExportTypeRebuildTarget(ParameterListInterface* aParameterListInterface) : ExportTypeTarget(aParameterListInterface) {
- iDefFile = new DefFile();
-}
-
-/**
-Destructor for the ExportTypeRebuildTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeRebuildTarget::~ExportTypeRebuildTarget()
-{
- delete iDefFile;
-}
-
-/**
-Function to process the symbols to be exported. The symbols from the DEF File are read
-and passed to ValidateExports() to validate against the symbols present in the ELF file.
-The final list of exports symbols is created.
-
-@internalComponent
-@released
-*/
-void ExportTypeRebuildTarget::ProcessExports()
-{
- iDefExports = iDefFile->ReadDefFile( iParameterListInterface->DefInput() );
-
- ValidateExports(iDefExports);
- CreateExports();
-}
--- a/toolsandutils/e32tools/elf2e32/source/export_type_rebuild_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Declaration of Class ExportTypeRebuildTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef EXPORT_TYPE_REBUILD_TARGET_H
-#define EXPORT_TYPE_REBUILD_TARGET_H
-
-#include "export_type_target.h"
-
-class DefFile;
-
-/**
-class ExportTypeRebuildTarget is dervied from ExportTypeTarget and handles export type target rebuilding
-
-@internalComponent
-@released
-*/
-class ExportTypeRebuildTarget : public ExportTypeTarget
-{
-
-public:
- ExportTypeRebuildTarget(ParameterListInterface* aParameterListInterface);
- ~ExportTypeRebuildTarget();
-
- void ProcessExports();
-
-protected:
- DefFile *iDefFile;
-
-};
-
-
-#endif // EXPORT_TYPE_REBUILD_TARGET_H
-
--- a/toolsandutils/e32tools/elf2e32/source/export_type_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ExexpTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "export_type_target.h"
-
-/**
-Constructor for the ExportTypeTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeTarget::ExportTypeTarget(ParameterListInterface* aParameterListInterface) : ElfFileSupplied(aParameterListInterface), iDefExports(NULL) {
-}
-
-/**
-Destructor for the ExportTypeTarget Class
-
-@internalComponent
-@released
-*/
-ExportTypeTarget::~ExportTypeTarget() {
-}
-
-/**
-Function to generate the output E32 image. Since this is a targettype which can have
-export symbols, the output generated can also include DEF File (if any), DSO file and
-and E32 image.
-
-@internalComponent
-@released
-*/
-void ExportTypeTarget::GenerateOutput()
-{
- WriteDefFile();
- WriteDSOFile();
- WriteE32();
-}
-
-/**
-Function to check if the provided input is a DLL.
-
-@internalComponent
-@released
-
-@result True since Export Type Target is a DLL.
-*/
-bool ExportTypeTarget::ImageIsDll()
-{
- return true;
-}
--- a/toolsandutils/e32tools/elf2e32/source/export_type_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Declaration of Class ExportTypeTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef EXPORT_TYPE_TARGET_H
-#define EXPORT_TYPE_TARGET_H
-
-#include "elffilesupplied.h"
-
-/**
-class ExportTypeTarget is dervied from ElfSupplied and handles export type target
-
-@internalComponent
-@released
-*/
-class ExportTypeTarget : public ElfFileSupplied
-{
-
-public:
- ExportTypeTarget(ParameterListInterface* aParameterListInterface);
- ~ExportTypeTarget();
-
- bool ImageIsDll();
- void GenerateOutput();
-
-protected:
- SymbolList *iDefExports;
-
-};
-
-
-#endif // EXPORT_TYPE_TARGET_H
-
--- a/toolsandutils/e32tools/elf2e32/source/farray.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef __FARRAY_H__
-#define __FARRAY_H__
-#include <cassert>
-
-template <class T,TInt S>
-class TFixedArray
-// Range checking wrapper+ class for C++ arrays
-// Can be embedded in C-objects, or used on the stack: use Reset() to zero it
- {
- typedef TFixedArray<T,S> ThisClass;
-public:
- inline TFixedArray();
- inline TFixedArray(const T* aList, TInt aLength);
- //
- inline void Copy(const T* aList, TInt aLength);
- inline void Reset(); // zero fill
- inline void DeleteAll();
- //
- inline TInt Count() const;
- inline TInt Length() const;
- // Accessors - debug range checking
- inline T& operator[](TInt aIndex);
- inline const T& operator[] (TInt aIndex) const;
- // Accessors - always range checking
- inline T& At(TInt aIndex);
- inline const T& At(TInt aIndex) const;
- // Provides pointers to the beginning and end of the array
- inline T* Begin();
- inline T* End();
- inline const T* Begin() const;
- inline const T* End() const;
- //
-protected:
- inline static TBool InRange(TInt aIndex);
-protected:
- T iRep[S];
- };
-
-
-template <class T,TInt S>
-inline TFixedArray<T,S>::TFixedArray()
- {}
-template <class T,TInt S>
-inline void TFixedArray<T,S>::Copy(const T* aList,TInt aLength)
- {
- // Never used.
- assert(TUint(aLength)<=TUint(S));
- // HMdem::Copy(iRep,aList,aLength*sizeof(T));
- }
-template <class T,TInt S>
-inline TFixedArray<T,S>::TFixedArray(const T* aList,TInt aLength)
- {Copy(aList,aLength);}
-template <class T,TInt S>
-inline void TFixedArray<T,S>::Reset()
- {memset(iRep,0,sizeof(iRep));}
-template <class T,TInt S>
-inline TInt TFixedArray<T,S>::Count() const
- {return S;}
-template <class T,TInt S>
-inline TInt TFixedArray<T,S>::Length() const
- {return sizeof(T);}
-template <class T,TInt S>
-inline TBool TFixedArray<T,S>::InRange(TInt aIndex)
- {return TUint(aIndex)<S;}
-template <class T,TInt S>
-inline T& TFixedArray<T,S>::operator[](TInt aIndex)
- {assert(InRange(aIndex));return iRep[aIndex];}
-template <class T,TInt S>
-inline const T& TFixedArray<T,S>::operator[](TInt aIndex) const
- {return const_cast<ThisClass&>(*this)[aIndex];}
-template <class T,TInt S>
-inline T& TFixedArray<T,S>::At(TInt aIndex)
- {verify(InRange(aIndex));return iRep[aIndex];}
-template <class T,TInt S>
-inline const T& TFixedArray<T,S>::At(TInt aIndex) const
- {return const_cast<ThisClass&>(*this).At(aIndex);}
-template <class T,TInt S>
-inline T* TFixedArray<T,S>::Begin()
- {return &iRep[0];}
-template <class T,TInt S>
-inline T* TFixedArray<T,S>::End()
- {return &iRep[S];}
-template <class T,TInt S>
-inline const T* TFixedArray<T,S>::Begin() const
- {return &iRep[0];}
-template <class T,TInt S>
-inline const T* TFixedArray<T,S>::End() const
- {return &iRep[S];}
-
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/filedump.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// FileDump Operations of elf2e32 tool to dump E32Image and generate ASM File.
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_common.h"
-#include "filedump.h"
-#include "e32imagefile.h"
-#include "h_utl.h"
-#include "deffile.h"
-#include "errorhandler.h"
-#include <stdio.h>
-/**
-Constructor for class FileDump
-@param aParameterListInterface - Instance of class ParameterListInterface
-@internalComponent
-@released
-*/
-FileDump::FileDump(ParameterListInterface* aParameterListInterface) : UseCaseBase(aParameterListInterface)
-{
-}
-
-/**
-Destructor for class FileDump
-@internalComponent
-@released
-*/
-FileDump::~FileDump()
-{
-}
-
-/**
-Execute Function for the File Dump. It dumps E32 image or generate ASM file based on the
-file dump options
-@return 0 on success, otherwise throw error
-@internalComponent
-@released
-*/
-int FileDump::Execute()
-{
- if(iParameterListInterface->FileDumpOption() && iParameterListInterface->E32OutOption() && iParameterListInterface->DefFileInOption()) //DumpAsm
- {
- if(!(iParameterListInterface->DumpOptions() & EDumpAsm))
- throw InvalidArgumentError(INVALIDARGUMENTERROR,(!iParameterListInterface->FileDumpSubOptions()?"":iParameterListInterface->FileDumpSubOptions()) ,"--dump");
- if(iParameterListInterface->DumpOptions() & 31)
- throw InvalidArgumentError(INVALIDARGUMENTERROR,(!iParameterListInterface->FileDumpSubOptions()?"":iParameterListInterface->FileDumpSubOptions()),"--dump");
- if(!iParameterListInterface->E32ImageOutput())
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--output");
- if(!iParameterListInterface->DefInput())
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--definput");
-
- GenerateAsmFile(iParameterListInterface->E32ImageOutput());
- }
- else
- {
- if(!iParameterListInterface->E32Input())
- throw ParameterParserError(NOREQUIREDOPTIONERROR,"--e32input");
- if(iParameterListInterface->DumpOptions() & EDumpAsm )
- throw InvalidArgumentError(INVALIDARGUMENTERROR,iParameterListInterface->FileDumpSubOptions() ,"--dump");
- DumpE32Image(iParameterListInterface->E32Input());
- }
- return 0;
-}
-
-/**
-Function to generate ASM File.
-@param afileName - ASM File name
-@return 0 on success, otherwise throw error
-@internalComponent
-@released
-*/
-int FileDump::GenerateAsmFile(const char* afileName)//DumpAsm
-{
- DefFile *iDefFile = new DefFile();
- SymbolList *aSymList;
- aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput());
-
- FILE *fptr;
-
- if((fptr=fopen(afileName,"w"))==NULL)
- {
- throw FileError(FILEOPENERROR,(char*)afileName);
- }
- else
- {
- SymbolList::iterator aItr = aSymList->begin();
- SymbolList::iterator last = aSymList->end();
- Symbol *aSym;
-
- while( aItr != last)
- {
- aSym = *aItr;
-
- if(aSym->Absent())
- {
- aItr++;
- continue;
- }
-
- fputs("\tIMPORT ",fptr);
- fputs(aSym->SymbolName(),fptr);
- //Set the visibility of the symbols as default."DYNAMIC" option is
- //added to remove STV_HIDDEN visibility warnings generated by every
- //export during kernel build
- fputs(" [DYNAMIC]", fptr);
- fputs("\n",fptr);
- aItr++;
- }
-
- // Create a directive section that instructs the linker to make all listed
- // symbols visible.
-
- fputs("\n AREA |.directive|, READONLY, NOALLOC\n\n",fptr);
-
- fputs("\tDCB \"#<SYMEDIT>#\\n\"\n", fptr);
-
- aItr = aSymList->begin();
- while (aItr != last)
- {
- aSym = *aItr;
-
- if ( aSym->Absent() )
- {
- aItr++;
- continue;
- }
-
- // Example:
- // DCB "EXPORT __ARM_ll_mlass\n"
- fputs("\tDCB \"EXPORT ",fptr);
- fputs(aSym->SymbolName(),fptr);
- fputs("\\n\"\n", fptr);
-
- aItr++;
- }
-
- fputs("\n END\n",fptr);
- fclose(fptr);
- }
- return 0;
-}
-
-/**
-Function to Dump E32 Image.
-@param afileName - E32 Image File name
-@return 1 on success, otherwise throw error
-@internalComponent
-@released
-*/
-int FileDump::DumpE32Image(const char* afileName)
-{
- E32ImageFile *aE32Imagefile=new E32ImageFile();
- TInt result = aE32Imagefile->Open(afileName);
-
- if (result > 0)
- return 1;
- else if (result == KErrCorrupt || result == KErrNotSupported)
- {
- throw InvalidE32ImageError(INVALIDE32IMAGEERROR, (char *)afileName);
- }
- else if (result != 0)
- {
- throw FileError(FILEREADERROR, (char *)afileName);
- }
-
- int dumpOptions=iParameterListInterface->DumpOptions();
-
- aE32Imagefile->Dump((TText*)afileName, dumpOptions);
- delete aE32Imagefile;
- return KErrNone;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/filedump.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// FileDump Class for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef __FILEDUMP_H__
-#define __FILEDUMP_H__
-
-#include "usecasebase.h"
-
-/**
-class for dumping e32image file or dumping asm file
-@internalComponent
-@released
-*/
-class FileDump : public UseCaseBase
-{
-
- public:
- FileDump(ParameterListInterface* aParameterListInterface);
- ~FileDump();
- int Execute();
- private:
- int DumpE32Image(const char * fileName);
- int GenerateAsmFile(const char* afileName);//DumpAsm
-};
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/h_utl.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the e32 image version for e32 image dump for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "h_utl.h"
-
-/**
-Function to check bracketed hex i.e '{', '}'
-
-@internalComponent
-@released
-
-@param aTemp
-@param aBrackets
-@param aDigits
-@param aValue
-
-@return True if the value passed in is a bracketed hex.
-*/
-TBool IsBracketedHex(const char* aTemp, const char* aBrackets, TInt aDigits, TUint32& aValue)
-{
- if (aTemp[0]!=aBrackets[0] || aTemp[1+aDigits]!=aBrackets[1])
- return 0;
- TInt i;
- TUint32 x = 0;
- for (i=1; i<=aDigits; ++i)
- {
- TInt c = aTemp[i];
- if (c>='a' && c<='z') c-=32;
- if (c<'0' || (c>'9' && c<'A') || c>'F')
- return 0;
- c-='0';
- if (c>9)
- c-=7;
- x = (x<<4) | (TUint32)c;
- }
- aValue = x;
-
- return 1;
-}
-
-/**
-Function to check the decimal version
-
-@internalComponent
-@released
-
-@param aBegin
-Beginning of the version information
-@param aTemp
-@param aValue
-Holds the hexadecimal value
-@return the checked value.
-*/
-TInt CheckForDecimalVersion(const char* aBegin, const char* aTemp, TUint32& aValue)
-{
- aValue = 0;
- if (aTemp <= aBegin || *aTemp != '}')
- return 0;
- TUint32 v[2] = {0,0};
- TUint32 m = 1;
- TInt pos = 0;
- const char* s0 = aTemp + 1;
- for (--aTemp; aTemp >= aBegin; --aTemp)
- {
- int c = *aTemp;
- if (c >= '0' && c <= '9')
- {
- v[pos] += m * (c - '0');
- if (v[pos] >= 65536u)
- return 0;
- m *= 10;
- }
- else if (c == '.')
- {
- m = 1;
- if (++pos >= 2)
- return 0;
- }
- else if (c == '{')
- break;
- else
- return 0;
- }
- if (aTemp < aBegin)
- return 0;
-
- aValue = (v[1] << 16) | v[0];
-
- return s0 - aTemp;
-}
-
-/**
-Function to Parse a filename and convert decimal version number to hex
-
-@internalComponent
-@released
-
-@param aName
-Filename to be parsed
-
-@return the converted name wherein the decimal number is converted to hex.
-*/
-char* NormaliseFileName(const char* aName)
-{
- TFileNameInfo f(aName, 0);
- TInt nl = f.iBaseLength;
- TInt el = f.iTotalLength - f.iExtPos;
- TInt tl = nl + el;
- if (f.iFlags & EVerPresent)
- tl += 10;
- char* t = new char[tl + 1];
- if (t)
- {
- memcpy(t, aName, nl);
- if (f.iFlags & EVerPresent)
- sprintf(t + nl, "{%08x}%s", (TInt)f.iModuleVersion, aName + f.iExtPos);
- else if (el)
- memcpy(t + nl, aName + f.iExtPos, el);
- t[tl] = 0;
- }
-
- return t;
-}
-
-/**
-Constructor for Class TFileNameInfo
-
-@internalComponent
-@released
-
-@param aFileName
-Filename to be parsed
-@param aLookForUid
-*/
-TFileNameInfo::TFileNameInfo(const char* aFileName, TBool aLookForUid)
-{
- iFileName = aFileName;
- TInt l = strlen(aFileName);
- iTotalLength = l;
- TInt remain = l;
- iFlags = 0;
- iUid3 = 0;
- iModuleVersion = 0;
- iBaseLength = l;
- iExtPos = l;
- const char* s = iFileName + l;
- for (; s>=iFileName && *s!='.' && *s!='}' && (!aLookForUid || *s!=']'); --s)
- {
- }
-
- if (s<iFileName)
- return;
- if (*s == '.')
- {
- iExtPos = s - iFileName;
- if (iExtPos == 0)
- {
- iBaseLength = 0;
- return;
- }
- remain = iExtPos;
- --s;
- }
- else if (s != iFileName + l)
- return;
-
- if (aLookForUid && remain>=10 && IsBracketedHex(s-9, "[]", 8, iUid3))
- {
- iFlags |= EUidPresent;
- remain -= 10;
- s -= 10;
- }
-
- if (remain>=10 && IsBracketedHex(s-9, "{}", 8, iModuleVersion))
- {
- iFlags |= EVerPresent;
- remain -= 10;
- s -= 10;
- }
- else
- {
- TInt n = CheckForDecimalVersion(iFileName, s, iModuleVersion);
- if (n>0)
- {
- iFlags |= EVerPresent;
- remain -= n;
- s -= n;
- }
- }
- iBaseLength = remain;
-}
-
-/*-------------------------------------------------------------------------
-String comparison on Linux seems to be a little half-baked.
--------------------------------------------------------------------------*/
-#ifdef __LINUX__
-
-int stricmp(const char *a, const char *b)
- {
- unsigned char ca,cb;
-
- do {
- ca = *a++;
- cb = *b++;
- ca = tolower(ca);
- cb = tolower(cb);
- }
- while((ca == cb) && (ca));
- return (int) ca-cb;
- }
-
-int strnicmp(const char *a, const char *b, int n)
- {
- unsigned char ca,cb;
- int i = 0;
-
- do {
- if (++i > n) return 0;
- ca = *a++;
- cb = *b++;
- ca = tolower(ca);
- cb = tolower(cb);
- }
- while((ca == cb) && (ca));
- return (int) ca-cb;
- }
-
-char* strupr(char *a)
- {
- char *ret = a;
-
- while (*a)
- {
- *a = toupper(*a);
- a++;
- }
-
- return ret;
- }
-
-
-#endif
--- a/toolsandutils/e32tools/elf2e32/source/h_utl.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-
- #ifndef __H_UTL_H__
- #define __H_UTL_H__
-
-#include "e32defwrap.h"
-#include <e32err.h>
-#include <iostream>
-
-#ifdef __TOOLS2__
-#include <sstream>
-#include <fstream>
-using namespace std;
-#else
-#include <strstream.h>
-#endif
-
- /**
- Convert string to number.
- @internalComponent
- @released
- */
- template <class T>
- TInt Val(T& aVal, char* aStr)
- {
-
-
- T x;
- #ifdef __TOOLS2__
- istringstream val(aStr);
- #else
- istrstream val(aStr,strlen(aStr));
- #endif
- val >> x;
- if (!val.eof() || val.fail())
- return KErrGeneral;
- aVal=x;
- return KErrNone;
-
- /*T x;
- istrstream val(aStr,strlen(aStr));
- val >> x;
- if (!val.eof() || val.fail())
- return KErrGeneral;
- aVal=x;
- return KErrNone;*/
- }
-
-
- //enum for decompose flag
- enum TDecomposeFlag
- {
- EUidPresent=1,
- EVerPresent=2
- };
-
- /**
- class for FileNameInfo
- @internalComponent
- @released
- */
- class TFileNameInfo
- {
- public:
- TFileNameInfo(const char* aFileName, TBool aLookForUid);
- public:
- const char* iFileName;
- TInt iTotalLength;
- TInt iBaseLength;
- TInt iExtPos;
- TUint32 iUid3;
- TUint32 iModuleVersion;
- TUint32 iFlags;
- };
-
- extern char* NormaliseFileName(const char* aName);
-
-
-
- #ifdef __LINUX__
- // Case insensitive comparison functions are named differently on Linux
- #define stricmp strcasecmp
- #define strnicmp strncasecmp
-
- // Convert the provided string to Uppercase
- char* strupr(char *a);
- #endif // __LINUX__
-
- #endif // __H_UTL_H__
-
-
-
-
-
-
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/huffman.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,917 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Huffman technique for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifdef _MSC_VER
- #pragma warning(disable: 4710) // function not inlined
-#endif
-
-#include <cassert>
-#include "huffman.h"
-#include "errorhandler.h"
-#include "farray.h"
-
-/**
-Function for overflow
-@internalComponent
-@released
-*/
-void TBitOutput::OverflowL()
-{
-}
-
-/**
-Construct a bit stream output object
-
-Following construction the bit stream is ready for writing bits, but will first call
-OverflowL() as the output buffer is 'full'. A derived class can detect this state as
-Ptr() will return null.
-*/
-TBitOutput::TBitOutput():iCode(0),iBits(-8),iPtr(0),iEnd(0)
-{
-}
-
-/**
-Construct a bit stream output object over a buffer
-
-Data will be written to the buffer until it is full, at which point OverflowL() will
-be called. This should handle the data and then can Set() again to reset the buffer
-for further output.
-
-@param "TUint8* aBuf" The buffer for output
-@param "TInt aSize" The size of the buffer in bytes
-*/
-TBitOutput::TBitOutput(TUint8* aBuf,TInt aSize):iCode(0),iBits(-8),iPtr(aBuf),iEnd(aBuf+aSize)
-{
-}
-
-/**
-Write a huffman code
-
-This expects a huffman code value as generated by Huffman::Encoding()
-
-@param "TUint aHuffCode" The huffman code write to the stream
-@leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
-void TBitOutput::HuffmanL(TUint aHuffCode)
-{
- DoWriteL(aHuffCode<<(32-Huffman::KMaxCodeLength),aHuffCode>>Huffman::KMaxCodeLength);
-}
-
-/**
-Write an arbitrary integer value
-
-Write an unsigned integer using the number of bits specified. Only the low order bits of the
-value are written to the output, most significant bit first.
-
-@param "TUint aValue" The value to write to the stream
-@param "TUint aLength" The number of bits to output
-@leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
-void TBitOutput::WriteL(TUint aValue,TInt aLength)
-{
- if (aLength)
- DoWriteL(aValue<<=32-aLength,aLength);
-}
-
-/**
-Pad the bitstream to the next byte boundary
-
-Terminate the bitstream by padding the last byte with the requested value.
-Following this operation the bitstream can continue to be used, the data will start at the
-next byte.
-
-@param "TUint aPadding" The bit value to pad the final byte with
-@leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
-void TBitOutput::PadL(TUint aPadding)
-{
- if (iBits>-8)
- WriteL(aPadding?0xffffffffu:0,-iBits);
-}
-
-/**
-Write the higher order bits to the stream
-@internalComponent
-@released
-*/
-void TBitOutput::DoWriteL(TUint aBits,TInt aSize)
-{
- if (aSize>25)
- {
- // cannot process >25 bits in a single pass so do the top 8 bits first
- assert(aSize<=32);
- DoWriteL(aBits&0xff000000u,8);
- aBits<<=8;
- aSize-=8;
- }
-
- TInt bits=iBits;
- TUint code=iCode|(aBits>>(bits+8));
- bits+=aSize;
- if (bits>=0)
- {
- TUint8* p=iPtr;
- do
- {
- if (p==iEnd)
- {
- // run out of buffer space so invoke the overflow handler
- iPtr=p;
- OverflowL();
- p=iPtr;
- assert(p!=iEnd);
- }
- *p++=TUint8(code>>24);
- code<<=8;
- bits-=8;
- } while (bits>=0);
- iPtr=p;
- }
- iCode=code;
- iBits=bits;
-}
-
-/**
-Constructor for class TFileOutput
-@internalComponent
-@released
-*/
-TFileOutput::TFileOutput(std::ofstream & os):iOutStream(os)
-{
- Set(iBuf,KBufSize);
-}
-
-/**
-Function to empty the buffer and reset the pointers
-@internalComponent
-@released
-*/
-void TFileOutput::OverflowL()
-{
- FlushL();
- Set(iBuf,KBufSize);
-}
-
-/**
-Function to write out the contents of the buffer
-@internalComponent
-@released
-*/
-void TFileOutput::FlushL()
-{
- TInt len=Ptr()-iBuf;
- if (len)
- {
- iOutStream.write(reinterpret_cast<char *>(iBuf), len); // write extended header
- iDataCount += len;
- }
-}
-
-/**
-Recursive function to calculate the code lengths from the node tree
-@internalComponent
-@released
-*/
-void HuffmanLengthsL(TUint32* aLengths,const TNode* aNodes,TInt aNode,TInt aLen)
-{
- if (++aLen>Huffman::KMaxCodeLength)
- throw E32ImageCompressionError(HUFFMANBUFFEROVERFLOWERROR);
-
- const TNode& node=aNodes[aNode];
- TUint x=node.iLeft;
- if (x&KLeaf)
- aLengths[x&~KLeaf]=aLen;
- else
- HuffmanLengthsL(aLengths,aNodes,x,aLen);
- x=node.iRight;
- if (x&KLeaf)
- aLengths[x&~KLeaf]=aLen;
- else
- HuffmanLengthsL(aLengths,aNodes,x,aLen);
-}
-
-/**
-Function to Insert the {aCount,aValue} pair into the already sorted array of nodes
-@internalComponent
-@released
-*/
-void InsertInOrder(TNode* aNodes, TInt aSize, TUint aCount, TInt aVal)
-{
- // Uses Insertion sort following a binary search...
- TInt l=0, r=aSize;
- while (l < r)
- {
- TInt m = (l+r) >> 1;
- if (aNodes[m].iCount<aCount)
- r=m;
- else
- l=m+1;
- }
- memmove(aNodes+l+1,aNodes+l,sizeof(TNode)*(aSize-l));
- aNodes[l].iCount=aCount;
- aNodes[l].iRight=TUint16(aVal);
-}
-
-/**
-Generate a Huffman code.
-
-This generates a Huffman code for a given set of code frequencies. The output is a table of
-code lengths which can be used to build canonincal encoding tables or decoding trees for use
-with the TBitInput and TBitOutput classes.
-
-Entries in the table with a frequency of zero will have a zero code length and thus no
-associated huffman encoding. If each such symbol should have a maximum length encoding, they
-must be given at least a frequency of 1.
-
-For an alphabet of n symbols, this algorithm has a transient memory overhead of 8n, and a
-time complexity of O(n*log(n)).
-
-@param "const TUint32 aFrequency[]" The table of code frequencies
-@param "TInt aNumCodes" The number of codes in the table
-@param "TUint32 aHuffman[]" The table for the output code-length table. This must be the same
-size as the frequency table, and can safely be the same table
-
-@leave "KErrNoMemory" If memory used for code generation cannot be allocated
-@panic "USER ???" If the number of codes exceeds Huffman::KMaxCodes
-*/
-void Huffman::HuffmanL(const TUint32 aFrequency[],TInt aNumCodes,TUint32 aHuffman[])
-{
- if(TUint(aNumCodes)>TUint(KMaxCodes))
- throw E32ImageCompressionError(HUFFMANTOOMANYCODESERROR);
-
- // Sort the values into decreasing order of frequency
- TNode* nodes = new TNode[aNumCodes];
-
- TInt lCount=0;
-
- for (TInt ii=0;ii<aNumCodes;++ii)
- {
- TInt c=aFrequency[ii];
- if (c!=0)
- InsertInOrder(nodes,lCount++,c,ii|KLeaf);
- }
-
- // default code length is zero
- memset(aHuffman,0,aNumCodes*sizeof(TUint32));
-
- if (lCount==0)
- {
- // no codes with frequency>0. No code has a length
- }
- else if (lCount==1)
- {
- // special case for a single value (always encode as "0")
- aHuffman[nodes[0].iRight&~KLeaf]=1;
- }
- else
- {
- // Huffman algorithm: pair off least frequent nodes and reorder
- do
- {
- --lCount;
- TUint c=nodes[lCount].iCount + nodes[lCount-1].iCount;
- nodes[lCount].iLeft=nodes[lCount-1].iRight;
- // re-order the leaves now to reflect new combined frequency 'c'
- InsertInOrder(nodes,lCount-1,c,lCount);
- } while (lCount>1);
- // generate code lengths in aHuffman[]
- HuffmanLengthsL(aHuffman,nodes,1,0);
- }
-
- delete [] nodes;
-
- if(!IsValid(aHuffman,aNumCodes))
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
-}
-
-/**
-Validate a Huffman encoding
-
-This verifies that a Huffman coding described by the code lengths is valid. In particular,
-it ensures that no code exceeds the maximum length and that it is possible to generate a
-canonical coding for the specified lengths.
-
-@param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
-@param "TInt aNumCodes" The number of codes in the table
-
-@return True if the code is valid, otherwise false
-*/
-TBool Huffman::IsValid(const TUint32 aHuffman[],TInt aNumCodes)
-{
- // The code is valid if one of the following holds:
- // (a) the code exactly fills the 'code space'
- // (b) there is only a single symbol with code length 1
- // (c) there are no encoded symbols
- //
- TUint remain=1<<KMaxCodeLength;
- TInt totlen=0;
- for (const TUint32* p=aHuffman+aNumCodes; p>aHuffman;)
- {
- TInt len=*--p;
- if (len>0)
- {
- totlen+=len;
- if (len>KMaxCodeLength)
- return 0;
-
- TUint c=1<<(KMaxCodeLength-len);
- if (c>remain)
- return 0;
-
- remain-=c;
- }
- }
-
- return remain==0 || totlen<=1;
-}
-
-/**
-Create a canonical Huffman encoding table
-
-This generates the huffman codes used by TBitOutput::HuffmanL() to write huffman encoded data.
-The input is table of code lengths, as generated by Huffman::HuffmanL() and must represent a
-valid huffman code.
-
-@param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
-@param "TInt aNumCodes" The number of codes in the table
-@param "TUint32 aEncodeTable[]" The table for the output huffman codes. This must be the same
-size as the code-length table, and can safely be the same table.
-
-@panic "USER ???" If the provided code is not a valid Huffman coding
-
-@see IsValid()
-@see HuffmanL()
-*/
-void Huffman::Encoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aEncodeTable[])
-{
- if (!IsValid(aHuffman,aNumCodes))
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
-
- TFixedArray<TInt,KMaxCodeLength> lenCount;
- lenCount.Reset();
-
- TInt ii;
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii]-1;
- if (len>=0)
- ++lenCount[len];
- }
-
- TFixedArray<TUint,KMaxCodeLength> nextCode;
- TUint code=0;
- for (ii=0;ii<KMaxCodeLength;++ii)
- {
- code<<=1;
- nextCode[ii]=code;
- code+=lenCount[ii];
- }
-
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii];
- if (len==0)
- aEncodeTable[ii]=0;
- else
- {
- aEncodeTable[ii] = (nextCode[len-1]<<(KMaxCodeLength-len))|(len<<KMaxCodeLength);
- ++nextCode[len-1];
- }
- }
-}
-
-/**
-The encoding table for the externalised code
-@internalComponent
-@released
-*/
-const TUint32 HuffmanEncoding[]=
-{
- 0x10000000,
- 0x1c000000,
- 0x12000000,
- 0x1d000000,
- 0x26000000,
- 0x26800000,
- 0x2f000000,
- 0x37400000,
- 0x37600000,
- 0x37800000,
- 0x3fa00000,
- 0x3fb00000,
- 0x3fc00000,
- 0x3fd00000,
- 0x47e00000,
- 0x47e80000,
- 0x47f00000,
- 0x4ff80000,
- 0x57fc0000,
- 0x5ffe0000,
- 0x67ff0000,
- 0x77ff8000,
- 0x7fffa000,
- 0x7fffb000,
- 0x7fffc000,
- 0x7fffd000,
- 0x7fffe000,
- 0x87fff000,
- 0x87fff800
-};
-
-/**
-Function to encode 0a as '0' and 0b as '1', return number of symbols created
-@internalComponent
-@released
-*/
-void EncodeRunLengthL(TBitOutput& aOutput, TInt aLength)
-{
- if (aLength>0)
- {
- EncodeRunLengthL(aOutput,(aLength-1)>>1);
- aOutput.HuffmanL(HuffmanEncoding[1-(aLength&1)]);
- }
-}
-
-/**
-Store a canonical huffman encoding in compact form
-
-As the encoding is canonical, only the code lengths of each code needs to be saved.
-
-Due to the nature of code length tables, these can usually be stored very compactly by
-encoding the encoding itself, hence the use of the bit output stream.
-
-@param "TBitOutput& aOutput" The output stream for the encoding
-@param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
-@param "TInt aNumCodes" The number of huffman codes in the table
-
-@leave "TBitOutput::HuffmanL()"
-*/
-void Huffman::ExternalizeL(TBitOutput& aOutput,const TUint32 aHuffman[],TInt aNumCodes)
-{
- // We assume that the code length table is generated by the huffman generator,
- // in which case the maxmimum code length is 27 bits.
- //
- // We apply three transformations to the data:
- // 1. the data goes through a move-to-front coder
- // 2. apply a rle-0 coder which replace runs of '0' with streams of '0a' and '0b'
- // 3. encode the result using a predefined (average) huffman coding
- //
- // This can be done in a single pass over the data, avoiding the need for additional
- // memory.
- //
- // initialise the list for the MTF coder
- TFixedArray<TUint8,Huffman::KMetaCodes> list;
- TInt i;
- for (i=0;i<list.Count();++i)
- list[i]=TUint8(i);
- TInt last=0;
-
- TInt rl=0;
- const TUint32* p32=aHuffman;
- const TUint32* e32=p32+aNumCodes;
- while (p32<e32)
- {
- TInt c=*p32++;
- if (c==last)
- ++rl; // repeat of last symbol
- else
- {
- // encode run-length
- EncodeRunLengthL(aOutput,rl);
- rl=0;
- // find code in MTF list
- TInt j;
- for (j=1;list[j]!=c;++j)
- ;
- // store this code
- aOutput.HuffmanL(HuffmanEncoding[j+1]);
- // adjust list for MTF algorithm
- while (--j>0)
- list[j+1]=list[j];
- list[1]=TUint8(last);
- last=c;
- }
- }
- // encod any remaining run-length
- EncodeRunLengthL(aOutput,rl);
-}
-
-const TInt KHuffTerminate=0x0001;
-const TUint32 KBranch1=sizeof(TUint32)<<16;
-
-/**
-Function to write the subtree below aPtr and return the head
-*/
-TUint32* HuffmanSubTree(TUint32* aPtr,const TUint32* aValue,TUint32** aLevel)
-{
- TUint32* l=*aLevel++;
- if (l>aValue)
- {
- TUint32* sub0=HuffmanSubTree(aPtr,aValue,aLevel); // 0-tree first
- aPtr=HuffmanSubTree(sub0,aValue-(aPtr-sub0)-1,aLevel); // 1-tree
- TInt branch0=(TUint8*)sub0-(TUint8*)(aPtr-1);
- *--aPtr=KBranch1|branch0;
- }
- else if (l==aValue)
- {
- TUint term0=*aValue--; // 0-term
- aPtr=HuffmanSubTree(aPtr,aValue,aLevel); // 1-tree
- *--aPtr=KBranch1|(term0>>16);
- }
- else // l<iNext
- {
- TUint term0=*aValue--; // 0-term
- TUint term1=*aValue--;
- *--aPtr=(term1>>16<<16)|(term0>>16);
- }
- return aPtr;
-}
-
-/**
-Create a canonical Huffman decoding tree
-
-This generates the huffman decoding tree used by TBitInput::HuffmanL() to read huffman
-encoded data. The input is table of code lengths, as generated by Huffman::HuffmanL()
-and must represent a valid huffman code.
-
-@param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
-@param "TInt aNumCodes" The number of codes in the table
-@param "TUint32 aDecodeTree[]" The space for the decoding tree. This must be the same
-size as the code-length table, and can safely be the same memory
-@param "TInt aSymbolBase" the base value for the output 'symbols' from the decoding tree, by default
-this is zero.
-
-@panic "USER ???" If the provided code is not a valid Huffman coding
-
-@see IsValid()
-@see HuffmanL()
-*/
-void Huffman::Decoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aDecodeTree[],TInt aSymbolBase)
-{
- if(!IsValid(aHuffman,aNumCodes))
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
-
- TFixedArray<TInt,KMaxCodeLength> counts;
- counts.Reset();
- TInt codes=0;
- TInt ii;
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii];
- aDecodeTree[ii]=len;
- if (--len>=0)
- {
- ++counts[len];
- ++codes;
- }
- }
-
- TFixedArray<TUint32*,KMaxCodeLength> level;
- TUint32* lit=aDecodeTree+codes;
- for (ii=0;ii<KMaxCodeLength;++ii)
- {
- level[ii]=lit;
- lit-=counts[ii];
- }
-
- aSymbolBase=(aSymbolBase<<17)+(KHuffTerminate<<16);
- for (ii=0;ii<aNumCodes;++ii)
- {
- TUint len=TUint8(aDecodeTree[ii]);
- if (len)
- *--level[len-1]|=(ii<<17)+aSymbolBase;
- }
-
- if (codes==1) // codes==1 special case: tree isn't complete
- {
- TUint term=aDecodeTree[0]>>16;
- aDecodeTree[0]=term|(term<<16); // 0- and 1-terminate at root
- }
- else if (codes>1)
- HuffmanSubTree(aDecodeTree+codes-1,aDecodeTree+codes-1,&level[0]);
-}
-
-/**
-The decoding tree for the externalised code
-*/
-const TUint32 HuffmanDecoding[]=
-{
- 0x0004006c,
- 0x00040064,
- 0x0004005c,
- 0x00040050,
- 0x00040044,
- 0x0004003c,
- 0x00040034,
- 0x00040021,
- 0x00040023,
- 0x00040025,
- 0x00040027,
- 0x00040029,
- 0x00040014,
- 0x0004000c,
- 0x00040035,
- 0x00390037,
- 0x00330031,
- 0x0004002b,
- 0x002f002d,
- 0x001f001d,
- 0x001b0019,
- 0x00040013,
- 0x00170015,
- 0x0004000d,
- 0x0011000f,
- 0x000b0009,
- 0x00070003,
- 0x00050001
-};
-
-
-/**
-Restore a canonical huffman encoding from a bit stream
-
-The encoding must have been stored using Huffman::ExternalizeL(). The resulting
-code-length table can be used to create an encoding table using Huffman::Encoding()
-or a decoding tree using Huffman::Decoding().
-
-@param "TBitInput& aInput" The input stream with the encoding
-@param "TUint32 aHuffman[]" The internalized code-length table is placed here
-@param "TInt aNumCodes" The number of huffman codes in the table
-
-@leave "TBitInput::HuffmanL()"
-
-@see ExternalizeL()
-See ExternalizeL for a description of the format
-*/
-void Huffman::InternalizeL(TBitInput& aInput,TUint32 aHuffman[],TInt aNumCodes)
-{
- // initialise move-to-front list
- TFixedArray<TUint8,Huffman::KMetaCodes> list;
- for (TInt i=0;i<list.Count();++i)
- list[i]=TUint8(i);
-
- TInt last=0;
- // extract codes, reverse rle-0 and mtf encoding in one pass
- TUint32* p=aHuffman;
- const TUint32* end=aHuffman+aNumCodes;
- TInt rl=0;
- while (p+rl<end)
- {
- TInt c=aInput.HuffmanL(HuffmanDecoding);
- if (c<2)
- {
- // one of the zero codes used by RLE-0
- // update he run-length
- rl+=rl+c+1;
- }
- else
- {
- while (rl>0)
- {
- if (p>end)
- {
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
- }
- *p++=last;
- --rl;
- }
- --c;
- list[0]=TUint8(last);
- last=list[c];
-
- memmove((void * const)&list[1],(const void * const)&list[0],(size_t)c);
- if (p>end)
- {
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
- }
- *p++=last;
- }
- }
- while (rl>0)
- {
- if (p>end)
- {
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
- }
- *p++=last;
- --rl;
- }
-}
-
-/**
-bit-stream input class
-Reverse the byte-order of a 32 bit value
-This generates optimal ARM code (4 instructions)
-*/
-inline TUint reverse(TUint aVal)
-{
- TUint v=(aVal<<16)|(aVal>>16);
- v^=aVal;
- v&=0xff00ffff;
- aVal=(aVal>>8)|(aVal<<24);
- return aVal^(v>>8);
-}
-
-/**
-Construct a bit stream input object
-
-Following construction the bit stream is ready for reading bits, but will
-immediately call UnderflowL() as the input buffer is empty.
-*/
-TBitInput::TBitInput():iCount(0),iRemain(0)
-{
-
-}
-
-/**
-Construct a bit stream input object over a buffer
-
-Following construction the bit stream is ready for reading bits from the specified buffer.
-
-@param "const TUint8* aPtr" The address of the buffer containing the bit stream
-@param "TInt aLength" The length of the bitstream in bits
-@param "TInt aOffset" The bit offset from the start of the buffer to the bit stream (defaults to zero)
-*/
-TBitInput::TBitInput(const TUint8* aPtr, TInt aLength, TInt aOffset)
-{
- Set(aPtr,aLength,aOffset);
-}
-
-/**
-Set the memory buffer to use for input.
-
-Bits will be read from this buffer until it is empty, at which point UnderflowL() will be called.
-
-@param "const TUint8* aPtr" The address of the buffer containing the bit stream
-@param "TInt aLength" The length of the bitstream in bits
-@param "TInt aOffset" The bit offset from the start of the buffer to the bit stream (defaults to zero)
-*/
-void TBitInput::Set(const TUint8* aPtr, TInt aLength, TInt aOffset)
-{
- TUint p=(TUint)aPtr;
- p+=aOffset>>3; // nearest byte to the specified bit offset
- aOffset&=7; // bit offset within the byte
- const TUint32* ptr=(const TUint32*)(p&~3); // word containing this byte
- aOffset+=(p&3)<<3; // bit offset within the word
- if (aLength==0)
- iCount=0;
- else
- {
- // read the first few bits of the stream
- iBits=reverse(*ptr++)<<aOffset;
- aOffset=32-aOffset;
- aLength-=aOffset;
- if (aLength<0)
- aOffset+=aLength;
- iCount=aOffset;
- }
- iRemain=aLength;
- iPtr=ptr;
-}
-
-#ifndef __HUFFMAN_MACHINE_CODED__
-
-/**
-Read a single bit from the input
-
-Return the next bit in the input stream. This will call UnderflowL() if there are no more
-bits available.
-
-@return The next bit in the stream
-
-@leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called to get more
-data
-*/
-TUint TBitInput::ReadL()
-{
- TInt c=iCount;
- TUint bits=iBits;
- if (--c<0)
- return ReadL(1);
- iCount=c;
- iBits=bits<<1;
- return bits>>31;
-}
-
-/**
-Read a multi-bit value from the input
-
-Return the next few bits as an unsigned integer. The last bit read is the least significant
-bit of the returned value, and the value is zero extended to return a 32-bit result.
-
-A read of zero bits will always reaturn zero.
-
-This will call UnderflowL() if there are not enough bits available.
-
-@param "TInt aSize" The number of bits to read
-
-@return The bits read from the stream
-
-@leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called to get more
-data
-*/
-TUint TBitInput::ReadL(TInt aSize)
-{
- if (!aSize)
- return 0;
- TUint val=0;
- TUint bits=iBits;
- iCount-=aSize;
- while (iCount<0)
- {
- // need more bits
-#ifdef __CPU_X86
- // X86 does not allow shift-by-32
- if (iCount+aSize!=0)
- val|=bits>>(32-(iCount+aSize))<<(-iCount); // scrub low order bits
-#else
- val|=bits>>(32-(iCount+aSize))<<(-iCount); // scrub low order bits
-#endif
- aSize=-iCount; // bits still required
- if (iRemain>0)
- {
- bits=reverse(*iPtr++);
- iCount+=32;
- iRemain-=32;
- if (iRemain<0)
- iCount+=iRemain;
- }
- else
- {
- UnderflowL();
- bits=iBits;
- iCount-=aSize;
- }
- }
-
-#ifdef __CPU_X86
- // X86 does not allow shift-by-32
- iBits=aSize==32?0:bits<<aSize;
-#else
- iBits=bits<<aSize;
-#endif
-
- return val|(bits>>(32-aSize));
-}
-
-/**
-Read and decode a Huffman Code
-
-Interpret the next bits in the input as a Huffman code in the specified decoding.
-The decoding tree should be the output from Huffman::Decoding().
-
-@param "const TUint32* aTree" The huffman decoding tree
-
-@return The symbol that was decoded
-
-@leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called to get more
-data
-*/
-TUint TBitInput::HuffmanL(const TUint32* aTree)
-{
- TUint huff=0;
- do
- {
- aTree=(const TUint32*)(((TUint8*)aTree)+(huff>>16));
- huff=*aTree;
- if (ReadL()==0)
- huff<<=16;
- } while ((huff&0x10000u)==0);
-
- return huff>>17;
-}
-
-#endif
-
-/**
-Handle an empty input buffer
-
-This virtual function is called when the input buffer is empty and more bits are required.
-It should reset the input buffer with more data using Set().
-
-A derived class can replace this to read the data from a file (for example) before reseting
-the input buffer.
-
-@leave "KErrUnderflow" The default implementation leaves
-*/
-void TBitInput::UnderflowL()
-{
- throw E32ImageCompressionError(HUFFMANBUFFEROVERFLOWERROR);
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/huffman.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Huffman Class for deflate and inflate
-// @internalComponent
-// @released
-//
-//
-
-#ifndef __HUFFMAN_H__
-#define __HUFFMAN_H__
-
-#include "e32defwrap.h"
-#include <fstream>
-
-/**
-class Bit Output stream
-@internalComponent
-@released
-*/
-class TBitOutput
-{
- public:
- TBitOutput();
- TBitOutput(TUint8* aBuf,TInt aSize);
- inline void Set(TUint8* aBuf,TInt aSize);
- inline const TUint8* Ptr() const;
- inline TInt BufferedBits() const;
- void WriteL(TUint aValue, TInt aLength);
- void HuffmanL(TUint aHuffCode);
- void PadL(TUint aPadding);
- private:
- void DoWriteL(TUint aBits, TInt aSize);
- virtual void OverflowL();
- private:
- TUint iCode; // code in production
- TInt iBits;
- TUint8* iPtr;
- TUint8* iEnd;
-};
-
-/*
-Set the memory buffer to use for output
-
-Data will be written to this buffer until it is full, at which point OverflowL() will be
-called. This should handle the data and then can Set() again to reset the buffer for further
-output.
-
-@param "TUint8* aBuf" The buffer for output
-@param "TInt aSize" The size of the buffer in bytes
-@internalComponent
-@released
-*/
-inline void TBitOutput::Set(TUint8* aBuf,TInt aSize)
-{
- iPtr=aBuf;
- iEnd=aBuf+aSize;
-}
-
-/*
-Get the current write position in the output buffer
-
-In conjunction with the address of the buffer, which should be known to the caller, this
-describes the data in the bitstream.
-@internalComponent
-@released
-*/
-inline const TUint8* TBitOutput::Ptr() const
-{
- return iPtr;
-}
-
-/*
-Get the number of bits that are buffered
-
-This reports the number of bits that have not yet been written into the output buffer.It will
-always lie in the range 0..7. Use PadL() to pad the data out to the next byte and write it to
-the buffer.
-@internalComponent
-@released
-*/
-inline TInt TBitOutput::BufferedBits() const
-{
- return iBits+8;
-}
-
-/**
-This class is derived from TBitOutput
-@internalComponent
-@released
-*/
-class TFileOutput : public TBitOutput
-{
- enum {KBufSize=0x1000};
- public:
- TFileOutput(std::ofstream & os);
- void FlushL();
- TUint32 iDataCount;
- private:
- void OverflowL();
- private:
- std::ofstream & iOutStream;
- TUint8 iBuf[KBufSize];
-};
-
-/**
-Class for Bit input stream.
-Good for reading bit streams for packed, compressed or huffman data algorithms.
-@since 8.0
-@library euser.lib
-@internalComponent
-@released
-*/
-class TBitInput
-{
- public:
- TBitInput();
- TBitInput(const TUint8* aPtr, TInt aLength, TInt aOffset=0);
- void Set(const TUint8* aPtr, TInt aLength, TInt aOffset=0);
- TUint ReadL();
- TUint ReadL(TInt aSize);
- TUint HuffmanL(const TUint32* aTree);
- private:
- virtual void UnderflowL();
- private:
- TInt iCount;
- TUint iBits;
- TInt iRemain;
- const TUint32* iPtr;
-};
-
-/**
-Class derived from TBitInput
-@internalComponent
-@released
-*/
-class TFileInput : public TBitInput
-{
- public:
- TFileInput(unsigned char* source,int size);
- ~TFileInput();
- private:
- void UnderflowL();
- private:
- TUint8* iReadBuf;
- TInt iSize;
-};
-
-/*
-Class for Huffman code toolkit.
-
-This class builds a huffman encoding from a frequency table and builds a decoding tree from a
-code-lengths table.
-
-The encoding generated is based on the rule that given two symbols s1 and s2, with code
-length l1 and l2, and huffman codes h1 and h2:
- if l1<l2 then h1<h2 when compared lexicographically
- if l1==l2 and s1<s2 then h1<h2 ditto
-
-This allows the encoding to be stored compactly as a table of code lengths
-
-@since 8.0
-@library euser.lib
-@internalComponent
-@released
-*/
-class Huffman
-{
- public:
- enum {KMaxCodeLength=27};
- enum {KMetaCodes=KMaxCodeLength+1};
- enum {KMaxCodes=0x8000};
- public:
- static void HuffmanL(const TUint32 aFrequency[],TInt aNumCodes,TUint32 aHuffman[]);
- static void Encoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aEncodeTable[]);
- static TBool IsValid(const TUint32 aHuffman[],TInt aNumCodes);
- static void ExternalizeL(TBitOutput& aOutput,const TUint32 aHuffman[],TInt aNumCodes);
- static void Decoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aDecodeTree[],TInt aSymbolBase=0);
- static void InternalizeL(TBitInput& aInput,TUint32 aHuffman[],TInt aNumCodes);
-};
-
-// local definitions used for Huffman code generation
-typedef TUint16 THuff; /** @internal */
-const THuff KLeaf=0x8000; /** @internal */
-struct TNode
-/** @internal */
-{
- TUint iCount;
- THuff iLeft;
- THuff iRight;
-};
-
-const TInt KDeflateLengthMag=8;
-const TInt KDeflateDistanceMag=12;
-
-/**
-class for TEncoding
-@internalComponent
-@released
-*/
-class TEncoding
-{
- public:
- enum {ELiterals=256,ELengths=(KDeflateLengthMag-1)*4,ESpecials=1,EDistances=(KDeflateDistanceMag-1)*4};
- enum {ELitLens=ELiterals+ELengths+ESpecials};
- enum {EEos=ELiterals+ELengths};
- public:
- TUint32 iLitLen[ELitLens];
- TUint32 iDistance[EDistances];
-};
-
-const TInt KDeflationCodes=TEncoding::ELitLens+TEncoding::EDistances;
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/imgdump.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,735 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the e32 image dump for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#define __REFERENCE_CAPABILITY_NAMES__
-
-#include "e32imagefile.h"
-#include "pl_common.h"
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#ifdef __LINUX__
- #define VSNPRINTF vsnprintf
-#else
- #define VSNPRINTF _vsnprintf
-#endif
-
-using std::cout;
-
-const TInt KMaxStringLength=0x400;
-
-/**
-Variadic Function to print string.
-
-@internalComponent
-@released
-
-@param aFmt
-Formatted string.
-*/
-void PrintString(const char *aFmt,...)
-{
- TText imageText[KMaxStringLength];
- va_list list;
- va_start(list,aFmt);
- VSNPRINTF((char *)imageText,KMaxStringLength,aFmt,list);
- va_end(list);
- cout << imageText;
-
- cout.flush();
-}
-
-/**
-Function to set priority.
-
-@internalComponent
-@released
-
-@param aPri
-Priority Type passed in
-@param aStr
-The priority value corresponding to the appropriate priority type
-*/
-void PriorityToStr(TProcessPriority aPri, char *aStr)
-{
- if (aPri==EPrioritySupervisor)
- strcpy(aStr,"Supervisor");
-
- else if (aPri>EPriorityRealTimeServer)
- sprintf(aStr, "RealTime+%d", aPri-EPriorityRealTimeServer);
- else if (aPri==EPriorityRealTimeServer)
- strcpy(aStr,"RealTime");
-
- else if (aPri>EPriorityFileServer)
- sprintf(aStr, "FileServer+%d", aPri-EPriorityFileServer);
- else if (aPri==EPriorityFileServer)
- strcpy(aStr,"FileServer");
-
- else if (aPri>EPriorityWindowServer)
- sprintf(aStr, "WindowServer+%d", aPri-EPriorityWindowServer);
- else if (aPri==EPriorityWindowServer)
- strcpy(aStr,"WindowServer");
-
- else if (aPri>EPriorityHigh)
- sprintf(aStr, "High+%d", aPri-EPriorityHigh);
- else if (aPri==EPriorityHigh)
- strcpy(aStr,"High");
-
- else if (aPri>EPriorityForeground)
- sprintf(aStr, "Foreground+%d", aPri-EPriorityForeground);
- else if (aPri==EPriorityForeground)
- strcpy(aStr,"Foreground");
-
- else if (aPri>EPriorityBackground)
- sprintf(aStr, "Background+%d", aPri-EPriorityBackground);
- else if (aPri==EPriorityBackground)
- strcpy(aStr,"Background");
-
- else if (aPri>EPriorityLow)
- sprintf(aStr, "Low+%d", aPri-EPriorityLow);
- else if (aPri==EPriorityLow)
- strcpy(aStr,"Low");
-
- else
- sprintf(aStr, "Illegal (%d)", aPri);
-}
-
-/**
-Function to dump e32 image.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the E32image to be dumped.
-@param aDumpFlags
-sub options passed to the 'dump' option
-*/
-void E32ImageFile::Dump(TText *aFileName,TInt aDumpFlags)
-{
- PrintString("E32ImageFile '%s'\n", aFileName);
- DumpHeader(aDumpFlags);
- DumpData(aDumpFlags);
-}
-
-/**
-Function to dump e32 image header.
-
-@internalComponent
-@released
-
-@param aDumpFlags
-The flags set based on the sub options provided to the program.
-*/
-void E32ImageFile::DumpHeader(TInt aDumpFlags)
-{
- TUint flags = iOrigHdr->iFlags;
- TUint abi = E32ImageHeader::ABIFromFlags(flags);
- TUint hdrfmt = E32ImageHeader::HdrFmtFromFlags(flags);
- TUint impfmt = E32ImageHeader::ImpFmtFromFlags(flags);
- TUint ept = E32ImageHeader::EptFromFlags(flags);
- TBool isARM = EFalse;
-
- if(aDumpFlags&EDumpHeader)
- {
- PrintString("V%d.%02d(%03d)", iOrigHdr->iToolsVersion.iMajor,iOrigHdr->iToolsVersion.iMinor,iOrigHdr->iToolsVersion.iBuild);
- PrintString("\tTime Stamp: %08x,%08x\n", iOrigHdr->iTimeHi, iOrigHdr->iTimeLo);
- char sig[5];
- memcpy(sig, (const char*)&iOrigHdr->iSignature, 4);
- sig[4]=0;
- PrintString(sig);
- if (iOrigHdr->iFlags&KImageDll)
- PrintString(" Dll for ");
- else
- PrintString(" Exe for ");
- switch (iOrigHdr->CpuIdentifier())
- {
- case ECpuX86:
- PrintString("X86 CPU\n");
- break;
- case ECpuArmV4:
- isARM = ETrue;
- PrintString("ARMV4 CPU\n");
- break;
- case ECpuArmV5:
- isARM = ETrue;
- PrintString("ARMV5 CPU\n");
- break;
- case ECpuMCore:
- PrintString("M*Core CPU\n");
- break;
- case ECpuUnknown:
- PrintString("Unknown CPU\n");
- break;
- default:
- PrintString("something or other\n");
- break;
- }
-
- PrintString("Flags:\t%08x\n", flags);
-
- if (!(flags & KImageDll))
- {
- char str[80];
- PriorityToStr(iOrigHdr->ProcessPriority(), str);
- PrintString("Priority %s\n", str);
- if (flags & KImageFixedAddressExe)
- PrintString("Fixed process\n");
- }
-
- if (flags & KImageNoCallEntryPoint)
- PrintString("Entry points are not called\n");
-
- PrintString("Image header is format %d\n", hdrfmt>>24);
- TUint compression = iOrigHdr->CompressionType();
-
- switch (compression)
- {
- case KFormatNotCompressed:
- PrintString("Image is not compressed\n");
- break;
- case KUidCompressionDeflate:
- PrintString("Image is compressed using the DEFLATE algorithm\n");
- break;
- case KUidCompressionBytePair:
- PrintString("Image is compressed using the BYTEPAIR algorithm\n");
- break;
- default:
- PrintString("Image compression type UNKNOWN (%08x)\n", compression);
- }
-
- if (compression)
- {
- PrintString("Uncompressed size %08x\n", iOrigHdr->UncompressedFileSize());
- }
-
- TUint FPU = flags & KImageHWFloatMask;
-
- if (FPU == KImageHWFloat_None)
- PrintString("Image FPU support : Soft VFP\n");
- else if (FPU == KImageHWFloat_VFPv2)
- PrintString("Image FPU support : VFPv2\n");
- else
- PrintString("Image FPU support : Unknown\n");
-
- // Code paging.
-
- if (flags & KImageCodeUnpaged)
- {
- PrintString("Code Paging : Unpaged\n");
- }
- else if (flags & KImageCodePaged)
- {
- PrintString("Code Paging : Paged\n");
- }
- else
- {
- PrintString("Code Paging : Default\n");
- }
-
- // Data paging.
-
- if (flags & KImageDataUnpaged)
- {
- PrintString("Data Paging : Unpaged\n");
- }
- else if (flags & KImageDataPaged)
- {
- PrintString("Data Paging : Paged\n");
- }
- else
- {
- PrintString("Data Paging : Default\n");
- }
-
- if (iOrigHdr->iFlags & KImageDebuggable)
- {
- PrintString("Debuggable : True\n");
- }
- else
- {
- PrintString("Debuggable : False\n");
- }
- if (iOrigHdr->iFlags & KImageSMPSafe)
- {
- PrintString("SMP Safe : True\n");
- }
- else
- {
- PrintString("SMP Safe : False\n");
- }
- }
-
- if (hdrfmt >= KImageHdrFmt_V && (aDumpFlags&(EDumpHeader|EDumpSecurityInfo)))
- {
- //
- // Important. Don't change output format of following security info
- // because this is relied on by used by "Symbian Signed".
- //
- E32ImageHeaderV* v = iHdr;
- PrintString("Secure ID: %08x\n", v->iS.iSecureId);
- PrintString("Vendor ID: %08x\n", v->iS.iVendorId);
- PrintString("Capabilities: %08x %08x\n", v->iS.iCaps[1], v->iS.iCaps[0]);
- if(aDumpFlags&EDumpSecurityInfo)
- {
- TInt i;
- for(i=0; i<ECapability_Limit; i++)
- if(v->iS.iCaps[i>>5]&(1<<(i&31)))
- PrintString(" %s\n", CapabilityNames[i]);
- PrintString("\n");
- }
- }
-
- if(aDumpFlags&EDumpHeader)
- {
- if (hdrfmt >= KImageHdrFmt_V)
- {
- E32ImageHeaderV* v = iHdr;
- TUint32 xd = v->iExceptionDescriptor;
- if ((xd & 1) && (xd != 0xffffffffu))
- {
- xd &= ~1;
- PrintString("Exception Descriptor Offset: %08x\n", v->iExceptionDescriptor);
- TExceptionDescriptor * aED = (TExceptionDescriptor * )(iData + v->iCodeOffset + xd);
- PrintString("Exception Index Table Base: %08x\n", aED->iExIdxBase);
- PrintString("Exception Index Table Limit: %08x\n", aED->iExIdxLimit);
- PrintString("RO Segment Base: %08x\n", aED->iROSegmentBase);
- PrintString("RO Segment Limit: %08x\n", aED->iROSegmentLimit);
- }
- else
- PrintString("No Exception Descriptor\n");
-
- PrintString("Export Description: Size=%03x, Type=%02x\n", v->iExportDescSize, v->iExportDescType);
-
- if (v->iExportDescType != KImageHdr_ExpD_NoHoles)
- {
- TInt nb = v->iExportDescSize;
- TInt i;
- TInt j = 0;
- for (i=0; i<nb; ++i)
- {
- if (++j == 8)
- {
- j = 0;
- PrintString("\n");
- }
- PrintString(" %02x", v->iExportDesc[i]);
- }
- PrintString("\n");
- }
-
- TInt r = CheckExportDescription();
-
- if (r == KErrNone)
- PrintString("Export description consistent\n");
- else if (r == KErrNotSupported)
- PrintString("Export description type not recognised\n");
- else
- PrintString("!! Export description inconsistent !!\n");
- }
-
- TUint32 mv = iOrigHdr->ModuleVersion();
- PrintString("Module Version: %d.%d\n", mv>>16, mv&0xffff);
-
- if (impfmt == KImageImpFmt_PE)
- {
- PrintString("Imports are PE-style\n");
- }
- else if (impfmt == KImageImpFmt_ELF)
- {
- PrintString("Imports are ELF-style\n");
- }
- else if (impfmt == KImageImpFmt_PE2)
- {
- PrintString("Imports are PE-style without redundant ordinal lists\n");
- }
-
- if (isARM)
- {
- if (abi == KImageABI_GCC98r2)
- {
- PrintString("GCC98r2 ABI\n");
- }
- else if (abi == KImageABI_EABI)
- {
- PrintString("ARM EABI\n");
- }
- if (ept == KImageEpt_Eka1)
- {
- PrintString("Built against EKA1\n");
- }
- else if (ept == KImageEpt_Eka2)
- {
- PrintString("Built against EKA2\n");
- }
- }
-
- PrintString("Uids:\t\t%08x %08x %08x (%08x)\n", iOrigHdr->iUid1, iOrigHdr->iUid2, iOrigHdr->iUid3, iOrigHdr->iUidChecksum);
-
- if (hdrfmt >= KImageHdrFmt_V)
- PrintString("Header CRC:\t%08x\n", iHdr->iHeaderCrc);
-
- PrintString("File Size:\t%08x\n", iSize);
- PrintString("Code Size:\t%08x\n", iOrigHdr->iCodeSize);
- PrintString("Data Size:\t%08x\n", iOrigHdr->iDataSize);
- PrintString("Compression:\t%08x\n", iOrigHdr->iCompressionType);
- PrintString("Min Heap Size:\t%08x\n", iOrigHdr->iHeapSizeMin);
- PrintString("Max Heap Size:\t%08x\n", iOrigHdr->iHeapSizeMax);
- PrintString("Stack Size:\t%08x\n", iOrigHdr->iStackSize);
- PrintString("Code link addr:\t%08x\n", iOrigHdr->iCodeBase);
- PrintString("Data link addr:\t%08x\n", iOrigHdr->iDataBase);
- PrintString("Code reloc offset:\t%08x\n", OrigCodeRelocOffset());
- PrintString("Data reloc offset:\t%08x\n", OrigDataRelocOffset());
- PrintString("Dll ref table count: %d\n", iOrigHdr->iDllRefTableCount);
-
- if (iOrigHdr->iCodeSize || iOrigHdr->iDataSize || iOrigHdr->iBssSize || iOrigHdr->iImportOffset)
- PrintString(" Offset Size Relocs #Relocs\n");
-
- PrintString("Code %06x %06x", OrigCodeOffset(), iOrigHdr->iCodeSize);
-
- if (iOrigHdr->iCodeRelocOffset)
- {
- E32RelocSection *r=(E32RelocSection *)(iData + iOrigHdr->iCodeRelocOffset);
- PrintString(" %06x %06x", OrigCodeRelocOffset(), r->iNumberOfRelocs);
- }
- else
- PrintString(" ");
-
- PrintString(" +%06x (entry pnt)", iOrigHdr->iEntryPoint);
- PrintString("\n");
-
- PrintString("Data %06x %06x", OrigDataOffset(), iOrigHdr->iDataSize);
-
- if (iOrigHdr->iDataRelocOffset)
- {
- E32RelocSection *r=(E32RelocSection *)(iData + iOrigHdr->iDataRelocOffset);
- PrintString(" %06x %06x", OrigDataRelocOffset(), r->iNumberOfRelocs);
- }
- PrintString("\n");
-
- PrintString("Bss %06x\n", iOrigHdr->iBssSize);
-
- if (iOrigHdr->iExportDirOffset)
- PrintString("Export %06x %06x (%d entries)\n", OrigExportDirOffset(), iOrigHdr->iExportDirCount*4, iOrigHdr->iExportDirCount);
-
- if (iOrigHdr->iImportOffset)
- PrintString("Import %06x\n", OrigImportOffset());
- }
-}
-
-/**
-Function to dump e32 image.
-
-@internalComponent
-@released
-
-@param aData
-Data to be dumped
-@param aLength
-Length of the file
-*/
-void dump(TUint *aData, TInt aLength)
-{
- TUint *p=aData;
- TInt i=0;
- char line[256];
- char *cp=(char*)aData;
- TInt j=0;
- memset(line,' ',sizeof(line));
- while (i<aLength)
- {
- TInt ccount=0;
- char* linep=&line[8*9+2];
- PrintString("%06x:", i);
- while (i<aLength && ccount<8)
- {
- PrintString(" %08x", *p++);
- i+=4;
- ccount++;
- for (j=0; j<4; j++)
- {
- char c=*cp++;
- if (c<32 || c>127)
- {
- c = '.';
- }
- *linep++ = c;
- }
- }
- *linep='\0';
- PrintString("%s", line+(ccount*9));
- PrintString("\n");
- }
-}
-
-/**
-Function to dump relocations.
-
-@internalComponent
-@released
-
-@param aRelocs
-Character pointer to relocations.
-*/
-void dumprelocs(char *aRelocs)
-{
-
- TInt num=((E32RelocSection *)aRelocs)->iNumberOfRelocs;
- PrintString("%d relocs\n", num);
- aRelocs+=sizeof(E32RelocSection);
- TInt printed=0;
- while (num>0)
- {
- TInt page=*(TUint *)aRelocs;
- TInt size=*(TUint *)(aRelocs+4);
- TInt pagesize=size;
- size-=8;
- TUint16 *p=(TUint16 *)(aRelocs+8);
- while (size>0)
- {
- TUint a=*p++;
- TUint relocType = (a & 0x3000) >> 12;
- if ((relocType == 1) || (relocType == 3)) //only relocation type1 and type3
- {
- PrintString("%08x(%d) ", page + (a&0x0fff), relocType);
- printed++;
- if (printed>3)
- {
- PrintString("\n");
- printed=0;
- }
- }
- size-=2;
- num--;
- }
- aRelocs+=pagesize;
- }
- PrintString("\n");
-}
-
-/**
-Function to dump e32 image data.
-
-@internalComponent
-@released
-
-@param aDumpFlags
-The flags set based on the sub options provided to the program.
-*/
-void E32ImageFile::DumpData(TInt aDumpFlags)
-{
- if(aDumpFlags&EDumpCode)
- {
- PrintString("\nCode (text size=%08x)\n", iOrigHdr->iTextSize);
- dump((TUint *)(iData + iOrigHdr->iCodeOffset), iOrigHdr->iCodeSize);
-
- if (iOrigHdr->iCodeRelocOffset)
- dumprelocs(iData + iOrigHdr->iCodeRelocOffset);
- }
-
- if((aDumpFlags&EDumpData) && iOrigHdr->iDataOffset)
- {
- PrintString("\nData\n");
- dump((TUint *)(iData + iOrigHdr->iDataOffset), iOrigHdr->iDataSize);
-
- if (iOrigHdr->iDataRelocOffset)
- dumprelocs(iData + iOrigHdr->iDataRelocOffset);
- }
-
- if(aDumpFlags&EDumpExports)
- {
- PrintString("\nNumber of exports = %d\n", iOrigHdr->iExportDirCount);
- TInt i;
- TUint* exports = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- TUint absoluteEntryPoint = iOrigHdr->iEntryPoint + iOrigHdr->iCodeBase;
- TUint impfmt = iOrigHdr->ImportFormat();
- TUint absentVal = (impfmt == KImageImpFmt_ELF) ? absoluteEntryPoint : iOrigHdr->iEntryPoint;
- for (i=0; i<iOrigHdr->iExportDirCount; ++i)
- {
- TUint exp = exports[i];
- if (exp == absentVal)
- PrintString("\tOrdinal %5d:\tABSENT\n", i+1);
- else
- PrintString("\tOrdinal %5d:\t%08x\n", i+1, exp);
- }
- }
-
- // Important. Don't change output format of following inport info
- // because this is relied on by tools used by "Symbian Signed".
- if((aDumpFlags&EDumpImports) && iOrigHdr->iImportOffset)
- {
- const E32ImportSection* isection = (const E32ImportSection*)(iData + iOrigHdr->iImportOffset);
- TUint* iat = (TUint*)((TUint8*)iData + iOrigHdr->iCodeOffset + iOrigHdr->iTextSize);
- PrintString("\nIdata\tSize=%08x\n", isection->iSize);
- PrintString("Offset of import address table (relative to code section): %08x\n", iOrigHdr->iTextSize);
- TInt d;
- const E32ImportBlock* b = (const E32ImportBlock*)(isection + 1);
- for (d=0; d<iOrigHdr->iDllRefTableCount; d++)
- {
- char* dllname = iData + iOrigHdr->iImportOffset + b->iOffsetOfDllName;
- TInt n = b->iNumberOfImports;
- PrintString("%d imports from %s\n", b->iNumberOfImports, dllname);
- const TUint* p = b->Imports();
- TUint impfmt = iOrigHdr->ImportFormat();
- if (impfmt == KImageImpFmt_ELF)
- {
- while (n--)
- {
- TUint impd_offset = *p++;
- TUint impd = *(TUint*)(iData + iOrigHdr->iCodeOffset + impd_offset);
- TUint ordinal = impd & 0xffff;
- TUint offset = impd >> 16;
-
- if (offset)
- PrintString("%10d offset by %d\n", ordinal, offset);
- else
- PrintString("%10d\n", ordinal);
- }
- }
- else
- {
- while (n--)
- PrintString("\t%d\n", *iat++);
- }
- b = b->NextBlock(impfmt);
- }
- }
- if((aDumpFlags & EDumpSymbols) && (iOrigHdr->iFlags & KImageNmdExpData))
- {
- TUint* aExpTbl = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- TUint* aZeroethOrd = aExpTbl - 1;
-
- E32EpocExpSymInfoHdr *aSymInfoHdr = (E32EpocExpSymInfoHdr*)(iData + \
- iOrigHdr->iCodeOffset + \
- *aZeroethOrd - iOrigHdr->iCodeBase ) ;
- DumpSymbolInfo(aSymInfoHdr);
- }
-}
-
-void E32ImageFile::DumpSymbolInfo(E32EpocExpSymInfoHdr *aSymInfoHdr)
-{
- if(!aSymInfoHdr)
- return;
- char *aSymTblBase = (char*)aSymInfoHdr;
- TUint *aSymAddrTbl;
- char *aSymNameTbl;
-
- char *aStrTable = aSymTblBase + aSymInfoHdr->iStringTableOffset;
- aSymAddrTbl = (TUint*)(aSymTblBase + aSymInfoHdr->iSymbolTblOffset);
- aSymNameTbl = (char*)(aSymAddrTbl + aSymInfoHdr->iSymCount);
-
- int aIdx;
- char *aSymName;
-
- PrintString("\n\n\t\tSymbol Info\n");
- if(aSymInfoHdr->iSymCount)
- {
- PrintString("0x%x Symbols exported\n",aSymInfoHdr->iSymCount);
- PrintString(" Addr\t\tName\n");
- PrintString("----------------------------------------\n");
- TUint aNameOffset = 0;
- for(aIdx=0;aIdx<aSymInfoHdr->iSymCount ; aIdx++)
- {
- if(aSymInfoHdr->iFlags & 1)
- {
- TUint32* aOff = ((TUint32*)aSymNameTbl+aIdx);
- aNameOffset = (*aOff) << 2;
- aSymName = aStrTable + aNameOffset;
- }
- else
- {
- TUint16* aOff = ((TUint16*)aSymNameTbl+aIdx);
- aNameOffset = (*aOff) << 2;
- aSymName = aStrTable + aNameOffset;
- }
- PrintString("0x%08x \t%s\t\n",aSymAddrTbl[aIdx], aSymName);
- }
- }
- else
- {
- PrintString("No Symbol exported\n");
- }
- PrintString("\n\n");
-
- if(aSymInfoHdr->iDllCount)
- {
- // The import table orders the dependencies alphabetically...
- // We need to list out in the link order...
- PrintString("%d Static dependencies found\n", aSymInfoHdr->iDllCount);
- TUint* aDepTbl = (TUint*)((char*)aSymInfoHdr + aSymInfoHdr->iDepDllZeroOrdTableOffset);
- TUint* aDepOffset = (TUint*)((char*)aDepTbl - iData);
-
- const E32ImportSection* isection = (const E32ImportSection*)(iData + iOrigHdr->iImportOffset);
-
- TInt d;
-
- /* The import table has offsets to the location (in code section) where the
- * import is required. For dependencies pointed by 0th ordinal, this offset
- * must be same as the offset of the dependency table entry (relative to
- * the code section).
- */
- bool aZerothFound;
- for(int aDep = 0; aDep < aSymInfoHdr->iDllCount; aDep++)
- {
- const E32ImportBlock* b = (const E32ImportBlock*)(isection + 1);
- aZerothFound = false;
- for (d=0; d<iOrigHdr->iDllRefTableCount; d++)
- {
- char* dllname = iData + iOrigHdr->iImportOffset + b->iOffsetOfDllName;
- TInt n = b->iNumberOfImports;
-
- const TUint* p = b->Imports()+ (n - 1);//start from the end of the import table
- TUint impfmt = iOrigHdr->ImportFormat();
- if (impfmt == KImageImpFmt_ELF)
- {
- while (n--)
- {
- TUint impd_offset = *p--;
- TUint impd = *(TUint*)(iData + iOrigHdr->iCodeOffset + impd_offset);
- TUint ordinal = impd & 0xffff;
-
- if (ordinal == 0 )
- {
- if( impd_offset == ((TUint)aDepOffset - iOrigHdr->iCodeOffset))
- {
- /* The offset in import table is same as the offset of this
- * dependency entry
- */
- PrintString("\t%s\n", dllname);
- aZerothFound = true;
- }
- break;
- }
- }
- }
- if(aZerothFound)
- break;
-
- b = b->NextBlock(impfmt);
- }
- if(!aZerothFound)
- {
- PrintString("!!Invalid dependency listed at %d\n",aDep );
- }
-
- aDepOffset++;
- }
- }
-}
--- a/toolsandutils/e32tools/elf2e32/source/inflate.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Inflater for e32 image dump for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "huffman.h"
-#include "inflate.h"
-#include <cpudefs.h>
-#include "farray.h"
-#include "errorhandler.h"
-#include<iostream>
-using std::cout;
-
-/*
-Inline constructor for CInflater
-@param aInput
-@internalComponent
-@released
-*/
-inline CInflater::CInflater(TBitInput& aInput):iBits(&aInput),iEncoding(0),iOut(0)
-{
-}
-
-/*
-Function for the 2nd phase construction.
-@param
-@internalComponent
-@released
-*/
-void CInflater::ConstructL()
-{
- iEncoding=new TEncoding;
- InitL();
- iLen=0;
- iOut=new TUint8[KDeflateMaxDistance];
- iAvail=iLimit=iOut;
-}
-
-/*
-Function NewLC
-@Leave OutOfMemory
-@param aInput
-@return pointer to self
-@internalComponent
-@released
-*/
-CInflater* CInflater::NewLC(TBitInput& aInput)
-{
- CInflater* self=new CInflater(aInput);
- self->ConstructL();
-
- return self;
-}
-
-/*
-Destructor for CInflater
-@internalComponent
-@released
-*/
-CInflater::~CInflater()
-{
- delete iEncoding;
- delete [] iOut;
-}
-
-/*
-Function ReadL
-@Leave
-@param aBuffer
-@param aLength
-@internalComponent
-@released
-*/
-TInt CInflater::ReadL(TUint8* aBuffer,TInt aLength)
-{
- TInt tfr=0;
- for (;;)
- {
- TInt len;
- if(aLength > (iLimit-iAvail))
- len=iLimit-iAvail;
- else
- len=aLength;
-
- if (len && aBuffer)
- {
- memcpy((void * const)aBuffer,(const void * const)iAvail,(size_t)len);
- aBuffer+=len;
- }
- aLength-=len;
- iAvail+=len;
- tfr+=len;
- if (aLength==0)
- return tfr;
- len=InflateL();
- if (len==0)
- return tfr;
- iAvail=iOut;
- iLimit=iAvail+len;
- }
-}
-
-/*
-Function InitL
-@Leave
-@internalComponent
-@released
-*/
-void CInflater::InitL()
-{
- // read the encoding
- Huffman::InternalizeL(*iBits,iEncoding->iLitLen,KDeflationCodes);
- // validate the encoding
- if (!Huffman::IsValid(iEncoding->iLitLen,TEncoding::ELitLens) ||
- !Huffman::IsValid(iEncoding->iDistance,TEncoding::EDistances))
- {
- throw E32ImageCompressionError(HUFFMANINVALIDCODINGERROR);
- }
-
- // convert the length tables into huffman decoding trees
- Huffman::Decoding(iEncoding->iLitLen,TEncoding::ELitLens,iEncoding->iLitLen);
- Huffman::Decoding(iEncoding->iDistance,TEncoding::EDistances,iEncoding->iDistance,KDeflateDistCodeBase);
-}
-
-/*
-Consume all data lag in the history buffer, then decode to fill up the output buffer
-Return the number of available bytes in the output buffer. This is only ever less than the
-buffer size if the end of stream marker has been read.
-@internalComponent
-@released
-*/
-TInt CInflater::InflateL()
-{
- // empty the history buffer into the output
- TUint8* out=iOut;
- TUint8* const end=out+KDeflateMaxDistance;
- const TUint32* tree=iEncoding->iLitLen;
- if (iLen<0) // EOF
- return 0;
- if (iLen>0)
- goto useHistory;
-
- while (out<end)
- {
- // get a huffman code
- {
- TInt val=iBits->HuffmanL(tree)-TEncoding::ELiterals;
- if (val<0)
- {
- *out++=TUint8(val);
- continue; // another literal/length combo
- }
- if (val==TEncoding::EEos-TEncoding::ELiterals)
- { // eos marker. we're done
- iLen=-1;
- break;
- }
-
- // get the extra bits for the code
- TInt code=val&0xff;
- if (code>=8)
- { // xtra bits
- TInt xtra=(code>>2)-1;
- code-=xtra<<2;
- code<<=xtra;
- code|=iBits->ReadL(xtra);
- }
- if (val<KDeflateDistCodeBase-TEncoding::ELiterals)
- { // length code... get the code
- iLen=code+KDeflateMinLength;
- tree=iEncoding->iDistance;
- continue; // read the huffman code
- }
- // distance code
- iRptr=out-(code+1);
- if (iRptr+KDeflateMaxDistance<end)
- iRptr+=KDeflateMaxDistance;
- }
- useHistory:
- TInt tfr;
- if(iLen > (end-out))
- tfr=end-out;
- else
- tfr=iLen;
-
- iLen-=tfr;
- const TUint8* from=iRptr;
- do
- {
- *out++=*from++;
- if (from==end)
- from-=KDeflateMaxDistance;
- }while (--tfr!=0);
- iRptr=from;
- tree=iEncoding->iLitLen;
- };
-
- return out-iOut;
-}
-
-/*
-TFileInput Constructor
-@param source
-@param size
-@internalComponent
-@released
-*/
-TFileInput::TFileInput(unsigned char* source,int size):iReadBuf(source),iSize(size)
-{
- Set(source,iSize*8);
-}
-
-/*
-TFileInput Destructor
-@internalComponent
-@released
-*/
-TFileInput::~TFileInput()
-{
-
-}
-
-/*
-Function UnderFlowL
-@Leave E32ImageCompressionError
-@internalComponent
-@released
-*/
-void TFileInput::UnderflowL()
-{
- throw E32ImageCompressionError(HUFFMANBUFFERUNDERFLOWERROR);
-}
-
-/*
-Function InflateUncompress
-@param source
-@param sourcesize
-@param dest
-@param destsize
-@internalComponent
-@released
-*/
-void InflateUnCompress(unsigned char* source, int sourcesize,unsigned char* dest, int destsize)
-{
- TFileInput* input = new TFileInput(source, sourcesize);
- CInflater* inflater=CInflater::NewLC(*input);
- inflater->ReadL(dest,destsize);
- delete input;
- delete inflater;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/inflate.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Class for inflater
-// @internalComponent
-// @released
-//
-//
-
-#ifndef __INFLATE_H__
-#define __INFLATE_H__
-
-#include "e32defwrap.h"
-#include "huffman.h"
-
-
-const TInt KDeflateMinLength=3;
-const TInt KDeflateMaxDistance=(1<<KDeflateDistanceMag);
-const TInt KDeflateDistCodeBase=0x200;
-
-/**
-Class for inflater
-@internalComponent
-@released
-*/
-class CInflater
-{
- public:
- enum {EBufSize = 0x800, ESafetyZone=8};
- public:
- static CInflater* NewLC(TBitInput& aInput);
- ~CInflater();
- TInt ReadL(TUint8* aBuffer,TInt aLength);
- TInt SkipL(TInt aLength);
- private:
- CInflater(TBitInput& aInput);
- void ConstructL();
- void InitL();
- TInt InflateL();
- private:
- TBitInput* iBits;
- const TUint8* iRptr; // partial segment
- TInt iLen;
- const TUint8* iAvail; // available data
- const TUint8* iLimit;
- TEncoding* iEncoding;
- TUint8* iOut; // circular buffer for distance matches
- TUint8 iHuff[EBufSize+ESafetyZone]; // huffman data
-};
-
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/librarytarget.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class LibraryTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "librarytarget.h"
-#include "pl_dso_handler.h"
-#include "deffile.h"
-#include <iostream>
-
-/**
-Constructor for the Library Class
-
-@internalComponent
-@released
-*/
-LibraryTarget::LibraryTarget(ParameterListInterface* aParameterListInterface):
-UseCaseBase(aParameterListInterface)
-{
- iElfIfc = new DSOHandler(aParameterListInterface);
- iDefFile = new DefFile();
-}
-
-
-/**
-Destructor for the Library Class
-
-@internalComponent
-@released
-*/
-LibraryTarget::~LibraryTarget()
-{
- delete iElfIfc;
- delete iDefFile;
-}
-
-/**
-Execute Function for the library target creation. The symbols are read from the input
-DEF file. The DSO file is generated on passing the symbols.
-
-@internalComponent
-@released
-
-@return EXIT_SUCCESS, on successful creation of library.
-*/
-int LibraryTarget::Execute()
-{
- SymbolList *aSymList;
- aSymList = ReadInputDefFile();
- GenerateOutput(aSymList);
- return EXIT_SUCCESS;
-
-}
-
-/**
-Function to read the symbols from the DEF file.
-
-@internalComponent
-@released
-
-@return the list of symbols read from the DEF file.
-*/
-SymbolList* LibraryTarget::ReadInputDefFile()
-{
- char * aDEFFileName = UseCaseBase::DefInput();
-
- return iDefFile->ReadDefFile(aDEFFileName);
-}
-
-/**
-Function to generate the output DSO File.
-
-@internalComponent
-@released
-*/
-void LibraryTarget::GenerateOutput(SymbolList* aSymList)
-{
- char * aLinkAs = UseCaseBase::LinkAsDLLName();
- char * aDSOName = UseCaseBase::DSOOutput();
- char * aDSOFileName = UseCaseBase::FileName(aDSOName);
-
- iElfIfc->WriteElfFile( aDSOName, aDSOFileName, aLinkAs, *aSymList);
-}
--- a/toolsandutils/e32tools/elf2e32/source/librarytarget.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class LibraryTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#if !defined(SYMBIAN_LIBRARYTARGET_H_)
-#define SYMBIAN_LIBRARYTARGET_H_
-
-#include "usecasebase.h"
-#include <list>
-
-class Symbol;
-class DSOHandler;
-class DefFile;
-typedef std::list<Symbol*> SymbolList;
-
-/**
-This class is derived from the base class UseCaseBase and is responsible for creation of
-Library Target.It passes the input DEF file to the DEFfile parser to get the Symbol list
-and then passes the Symbol List to the DSOHandler to generate the DSO file.
-
-@internalComponent
-@released
-*/
-class LibraryTarget : public UseCaseBase
-{
-
-public:
- LibraryTarget(ParameterListInterface* aParameterListInterface);
- virtual ~LibraryTarget();
- int Execute();
- SymbolList* ReadInputDefFile();
- void GenerateOutput(SymbolList* aSymList);
-
-private:
- DSOHandler *iElfIfc;
- DefFile *iDefFile;
-};
-
-
-
-#endif // !defined(SYMBIAN_LIBRARYTARGET_H_)
-
--- a/toolsandutils/e32tools/elf2e32/source/main.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the main function for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-//
-#include "elf2e32.h"
-
-/**
-This function creates an instance of Elf2E32 and calls Execute() of Elf2E32 to generate
-the appropriate target.
-@internalComponent
-@released
-
-@param aArgc
- The number of command line arguments passed into the program
-@param aArgv
- The listing of all the arguments
-
-
-@return EXIT_SUCCESS if the generation of the target is successful, else EXIT_FAILURE
-
-*/
-int main(int argc, char** argv)
-{
- Elf2E32 aElf2E32(argc, argv);
- return aElf2E32.Execute();
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/messagehandler.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Error Message Interface Operations for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "messagehandler.h"
-#include "messageimplementation.h"
-
-Message* MessageHandler::iInstance=0;
-
-/**
-Function Get Instance of class Message Implementation and initializing messages.
-
-@internalComponent
-@released
-
-@return Instance of MessageImplementation
-*/
-Message * MessageHandler::GetInstance()
-{
- if(iInstance == 0)
- {
- iInstance = new MessageImplementation();
- iInstance->InitializeMessages(NULL);
- }
- return iInstance;
-}
-
-/**
-Function to call StartLogging function of class Message Implementation.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the Log File
-*/
-void MessageHandler::StartLogging(char *aFileName)
-{
- GetInstance()->StartLogging(aFileName);
-}
-
-/**
-Function to call InitializeMessages function of class Message Implementation.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the Message file
-*/
-void MessageHandler::InitializeMessages(char *aFileName)
-{
- GetInstance()->InitializeMessages(aFileName);
-}
-
-/**
-Function to delete instance of class MessageImplementation
-
-@internalComponent
-@released
-*/
-void MessageHandler::CleanUp()
-{
- delete iInstance;
-}
--- a/toolsandutils/e32tools/elf2e32/source/messagehandler.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Message Handler Class for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef _MESSAGE_HANDLER_
-#define _MESSAGE_HANDLER_
-
-#include "messageimplementation.h"
-
-/**
-Class for Message Handler which will be used for getting instance of Message Implementationin
-and start logging, creating message file, initializing messages.
-@internalComponent
-@released
-*/
-class MessageHandler
-{
- public:
- static Message *GetInstance();
- static void CleanUp();
- static void StartLogging(char *filename);
- static void CreateMessageFile(char *fileName);
- static void InitializeMessages(char *fileName);
-
- private:
- static Message* iInstance;
-};
-
-
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/messageimplementation.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,425 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Message Implementation Operations for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#include "messageimplementation.h"
-#include "errorhandler.h"
-#include<iostream>
-#include<stdarg.h>
-#include<string>
-#include <stdio.h>
-
-using std::endl;
-using std::cout;
-typedef std::string String;
-
-char *errorMssgPrefix="elf2e32 : Error: E";
-char *warnMssgPrefix="elf2e32 : Warning: W";
-char *infoMssgPrefix="elf2e32 : Information: I";
-char *colSpace=": ";
-
-enum MessageArraySize{MAX=66};
-
-//Messages stored required for the program
-struct EnglishMessage MessageArray[MAX]=
-{
- {FILEOPENERROR,"Could not open file : %s."},
- {FILEREADERROR,"Could not read file : %s."},
- {FILEWRITEERROR,"Could not write file : %s."},
- {ELFMAGICERROR,"Invalid ELF magic in file : %s."},
- {ELFCLASSERROR,"ELF file %s is not 32 bit."},
- {ELFABIVERSIONERROR,"ELF file %s is not BPABI conformant."},
- {ELFLEERROR,"ELF file %s is not Little Endian."},
- {ELFARMERROR,"ELF file %s does not target ARM."},
- {ELFEXECUTABLEERROR,"ELF file %s is neither executable (ET_EXEC) or shared (ET_DYN)."},
- {ELFSHSTRINDEXERROR,"Error in ELF Section Header String Index : %s."},
- {NAMELIBRARYNOTCORRECT,"Name or Library not supplied correctly : %s[Line No=%d][%s]"},
- {ORDINALSEQUENCEERROR,"Ordinal number is not in sequence : %s[Line No=%d][%s]."},
- {ARGUMENTNAMEERROR,"Argument %s is not correct."},
- {OPTIONNAMEERROR,"Option %s is Unrecognized."},
- {NOARGUMENTERROR,"Missing arguments for option : %s."},
- {OPTIONPREFIXERROR,"Option %s is neither preceedded by '-' nor '--'."},
- {NOREQUIREDOPTIONERROR,"Missing options : %s."},
- {NOFILENAMEERROR,"Missing argument for option : %s."},
- {INVALIDARGUMENTERROR,"Argument '%s' not permitted for option %s."},
- {HUFFMANBUFFEROVERFLOWERROR,"Huffman buffer overflow during E32Image compression."},
- {HUFFMANTOOMANYCODESERROR,"Too many Huffman codes during E32Image compression."},
- {HUFFMANINVALIDCODINGERROR,"Invalid Huffman coding during E32Image compression."},
- {CAPABILITYALLINVERSIONERROR,"-ALL not a valid capability."},
- {CAPABILITYNONEINVERSIONERROR,"+NONE not a valid capability."},
- {UNRECOGNISEDCAPABILITYERROR,"Unrecognized capability : %s."},
- {NOSTATICSYMBOLSERROR,"ELF File %s contains no static symbols."},
- {DLLHASINITIALISEDDATAERROR,"ELF File %s contains initialized writable data."},
- {DLLHASUNINITIALISEDDATAERROR,"ELF File %s contains uninitialized writable data."},
- {ENTRYPOINTCORRUPTERROR,"ELF File %s has corrupt entry point."},
- {ENTRYPOINTNOTSUPPORTEDERROR,"ELF File %s has unsupported entry point type."},
- {EXCEPTIONDESCRIPTOROUTSIDEROERROR,"ELF File %s has invalid exception descriptor."},
- {NOEXCEPTIONDESCRIPTORERROR,"ELF File %s has no exception descriptor."},
- {NEEDSECTIONVIEWERROR,"ELF File %s has no section headers."},
- {DSONOTFOUNDERROR,"DSO %s not found."},
- {UNDEFINEDSYMBOLERROR,"Undefined Symbol %s found in ELF File %s."},
- {SYMBOLMISSINGFROMELFERROR,"Symbol %s Missing from ELF File : %s."},
- {MEMORYALLOCATIONERROR,"Memory allocation failure : %s."},
- {E32IMAGEERROR,"Not able to write E32 Image file."},
- {INVALIDINVOCATIONERROR,"Invalid invocation of elf2e32."},
- {TARGETTYPENOTSPECIFIEDERROR,"Target Type Not Specified."},
- {UNSUPPORTEDTARGETTYPEERROR,"Unsupported Target Type '%s'."},
- {INDEXNOMESSAGEERROR,"There is no message for the message index[%d]."},
- {INDEXNOTREQUIREDERROR,"Message index[%d] not required in message file."},
- {INDEXNOTFOUNDERROR,"Message index [%d] not found in message file"},
- {NOMESSAGEFILEERROR,"There is no message file."},
- {ENTRYPOINTNOTSETERROR,"Entry point is not set for %s."},
- {UNDEFINEDENTRYPOINTERROR,"Entry point and Text segment base both 0, can't tell if entry point set for %s."},
- {ORDINALNOTANUMBER,"Ordinal not a Number : %s[Line No=%d][%s]."},
- {UNRECOGNIZEDTOKEN,"Unrecognized Token : %s[Line No=%d][%s]."},
- {NONAMEMISSING,"NONAME Missing : %s[Line No=%d][%s]."},
- {EXPORTSEXPECTED,"EXPORTS expected before first export entry : %s[Line No=%d][%s]."},
- {ATRATEMISSING,"@ Missing : %s[Line No=%d][%s]."},
- {SYSDEFSMISMATCHERROR,"Symbol %s passed through '--sysdef' option is not at the specified ordinal in the DEF file %s."},
- {SYSDEFERROR,"Ordinal number is not provided as input to the option: %s"},
- {INVALIDE32IMAGEERROR,"%s is not a valid E32Image file."},
- {HUFFMANBUFFERUNDERFLOWERROR,"Huffman buffer underflow on deflate."},
- {HUFFMANINCONSISTENTSIZEERROR,"Inconsistent sizes discovered during uncompression."},
- {MULTIPLESYSDEFERROR, "Multiple system definitions passed to %s should be separated by ';'"},
- {SYSDEFNOSYMBOLERROR, "Symbol Name is not provided as input to the option: %s"},
- {VALUEIGNOREDWARNING, "Value passed to '%s' is ignored"},
- {ELFFILEERROR,"Error while processing the ELF file %s."},
- {SYMBOLCOUNTMISMATCHERROR, "Symbol count provided by DT_ARM_SYMTABSZ is not same as that in the Hash Table in %s"},
- {POSTLINKERERROR,"Fatal Error in Postlinker"},
- {BYTEPAIRINCONSISTENTSIZEERROR, "Inconsistent sizes discovered during Byte pair uncompression." },
- {ILLEGALEXPORTFROMDATASEGMENT,"'%s' : '%s' Import relocation does not refer to code segment."},
- {VALIDATIONERROR,"Image failed validation"}
-};
-
-/**
-Constructor to reset the logging option flag.
-
-@internalComponent
-@released
-*/
-MessageImplementation::MessageImplementation()
-{
- iLogging = false;
-}
-
-/**
-Destructor to close log file if logging is enabled and to clear the messaged.
-@internalComponent
-@released
-*/
-MessageImplementation::~MessageImplementation()
-{
- if(iLogging)
- {
- fclose(iLogPtr);
- }
- iMessage.clear();
-}
-
-/**
-Function to Get Message stored in map.
-
-@internalComponent
-@released
-
-@param aMessageIndex
-Index of the Message to be displayed
-@return Message string to be displayed
-*/
-char * MessageImplementation::GetMessageString(int aMessageIndex)
-{
- Map::iterator p;
-
- if(iMessage.empty())
- {
- if(aMessageIndex <= MAX)
- {
- return MessageArray[aMessageIndex-1].message;
- }
- else
- {
- return NULL;
- }
- }
- else
- {
- p=iMessage.find(aMessageIndex);
- if(p == iMessage.end())
- {
- if(aMessageIndex <= MAX)
- {
- return MessageArray[aMessageIndex-1].message;
- }
- else
- {
- return NULL;
- }
- }
-
- if(aMessageIndex <= MAX)
- {
- return p->second;
- }
- else
- {
- return NULL;
- }
- }
-}
-
-/**
-Function to display output and log message in log file if logging is enable.
-
-@internalComponent
-@released
-
-@param aString
-Message to be displayed
-*/
-void MessageImplementation::Output(const char *aString)
-{
-
- if (iLogging)
- {
- fputs(aString,iLogPtr);
- fputs("\n",iLogPtr);
- }
- cout << aString << endl;
-}
-
-/**
-Function to Get Message stored in map and to display the Message
-
-@internalComponent
-@released
-
-@param
-The type of the message, whether it is Error or Warning or Information.
-@param
-The index of the information and the corresponding arguments.
-*/
-void MessageImplementation::ReportMessage(int aMessageType, int aMsgIndex,...)
-{
- char *reportMessage, *ptr, *tmpMessage;
- char intStr[16];
- char mssgNo[MAXMSSGNOLENGTH];
- int mssgIndex,k;
-
- va_list ap;
- va_start(ap,aMsgIndex);
-
- reportMessage=GetMessageString(aMsgIndex);
-
- if(reportMessage)
- {
- String message;
- switch (aMessageType)
- {
- case ERROR:
- message = errorMssgPrefix;
- break;
- case WARNING:
- message = warnMssgPrefix;
- break;
- case INFORMATION:
- message = infoMssgPrefix;
- break;
- }
- mssgIndex = BASEMSSGNO + aMsgIndex;
- sprintf(mssgNo,"%d",mssgIndex);
- message += mssgNo;
- message += colSpace;
-
- ptr = strchr(reportMessage,'%');
-
- while( ptr != NULL && (ptr[0]) == '%' )
- {
- tmpMessage=new char[ptr - reportMessage + 1];
- strncpy(tmpMessage, reportMessage, ptr - reportMessage+1);
- tmpMessage[ptr - reportMessage]='\0';
- message += tmpMessage;
- delete tmpMessage;
- ptr++;
- switch(ptr[0])
- {
- case 'd':
- k = va_arg(ap, int);
- sprintf(intStr,"%d",k);
- message += intStr;
- ptr++;
- reportMessage = ptr;
- break;
- case 's':
- message += va_arg(ap, char *);
- ptr++;
- reportMessage = ptr;
- break;
- case '%':
- message += ptr[0];
- reportMessage = ptr;
- default:
- break;
- }
- ptr=strchr(reportMessage,'%');
- }
- message += reportMessage;
- Output(message.c_str());
- }
-}
-
-/**
-Function to start logging.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the Log file
-*/
-void MessageImplementation::StartLogging(char *aFileName)
-{
- char logFile[1024];
- FILE *fptr;
-
- strcpy(logFile,aFileName);
-
- // open file for log etc.
- if((fptr=fopen(logFile,"w"))==NULL)
- {
- ReportMessage(WARNING, FILEOPENERROR,aFileName);
- }
- else
- {
- iLogging = true;
- iLogPtr=fptr;
- }
-}
-
-/**
-Function to Create Messages file.
-
-@internalComponent
-@released
-@param aFileName
-Name of the Message file to be dumped
-*/
-void MessageImplementation::CreateMessageFile(char *aFileName)
-{
- int i;
- FILE *fptr;
-
- // open file for writing messages.
- if((fptr=fopen(aFileName,"w"))==NULL)
- {
- ReportMessage(WARNING, FILEOPENERROR,aFileName);
- }
- else
- {
- for(i=0;i<MAX;i++)
- {
- fprintf(fptr,"%d,%s\n",i+1,MessageArray[i].message);
- }
-
- fclose(fptr);
- }
-
-}
-
-/**
-Function to put Message string in map which is stored in message file.
-If file is not available the put message in map from Message Array structure.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the Message file passed in
-*/
-void MessageImplementation::InitializeMessages(char *aFileName)
-{
- char index[16];
- char *message, *errStr;
- int i, lineLength;
- int fileSize;
- char *messageEntries, *lineToken;
-
- FILE *fptr;
-
- if(aFileName && (fptr=fopen(aFileName,"rb"))!=NULL)
- {
-
- iMessage.clear();
- //Getting File size
- fseek(fptr, 0, SEEK_END);
- fileSize=ftell(fptr);
- rewind(fptr);
-
- messageEntries= new char[fileSize+2];
-
- //Getting whole file in memory
- fread(messageEntries, fileSize, 1, fptr);
-
- //Adding ENTER at end
- *(messageEntries+fileSize)='\n';
- //Adding '\0' at end
- *(messageEntries+fileSize+1)='\0';
-
- fclose(fptr);
-
- lineToken=strtok(messageEntries,"\n");
- while(lineToken != NULL)
- {
- if( lineToken[0] == '\n' || lineToken[0] == '\r' )
- {
- lineToken=strtok(NULL,"\n");
- continue;
- }
-
- lineLength=strlen(lineToken);
-
- if( lineToken[strlen(lineToken)-1] == '\r' )
- {
- lineToken[strlen(lineToken)-1]='\0';
- }
-
- message=strchr(lineToken,',');
- strncpy(index,lineToken,message-lineToken);
- index[message-lineToken]='\0';
- errStr = new char[strlen(message+1) + 1];
- strcpy(errStr, (message+1));
- iMessage.insert(std::pair<int,char*>(atoi(index),errStr));
-
- lineToken=strtok(lineToken+lineLength+1,"\n");
- }
-
- delete messageEntries;
-
- }
- else
- {
- for(i=0;i<MAX;i++)
- {
- errStr = new char[strlen(MessageArray[i].message) + 1];
- strcpy(errStr, MessageArray[i].message);
- iMessage.insert(std::pair<int,char*>(MessageArray[i].index,errStr));
- }
- }
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/messageimplementation.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Message Implementation Class for elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef _MESSAGE_IMPLEMENTATION_
-#define _MESSAGE_IMPLEMENTATION_
-
-#ifdef _MSC_VER
- #pragma warning(disable: 4514) // unreferenced inline function has been removed
- #pragma warning(disable: 4702) // unreachable code
- #pragma warning(disable: 4710) // function not inlined
- #pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
-#endif
-
-#include<map>
-#include<string>
-
-typedef std::map<int,char*> Map;
-typedef std::string String;
-
-enum { MAXMSSGNOLENGTH=5, BASEMSSGNO=1000 };
-
-enum { ERROR = 0,
- WARNING,
- INFORMATION
-};
-
-enum { FILEOPENERROR=1,
- FILEREADERROR,
- FILEWRITEERROR,
- ELFMAGICERROR,
- ELFCLASSERROR,
- ELFABIVERSIONERROR,
- ELFLEERROR,
- ELFARMERROR,
- ELFEXECUTABLEERROR,
- ELFSHSTRINDEXERROR,
- NAMELIBRARYNOTCORRECT,
- ORDINALSEQUENCEERROR,
- ARGUMENTNAMEERROR,
- OPTIONNAMEERROR,
- NOARGUMENTERROR,
- OPTIONPREFIXERROR,
- NOREQUIREDOPTIONERROR,
- NOFILENAMEERROR,
- INVALIDARGUMENTERROR,
- HUFFMANBUFFEROVERFLOWERROR,
- HUFFMANTOOMANYCODESERROR,
- HUFFMANINVALIDCODINGERROR,
- CAPABILITYALLINVERSIONERROR,
- CAPABILITYNONEINVERSIONERROR,
- UNRECOGNISEDCAPABILITYERROR,
- NOSTATICSYMBOLSERROR,
- DLLHASINITIALISEDDATAERROR,
- DLLHASUNINITIALISEDDATAERROR,
- ENTRYPOINTCORRUPTERROR,
- ENTRYPOINTNOTSUPPORTEDERROR,
- EXCEPTIONDESCRIPTOROUTSIDEROERROR,
- NOEXCEPTIONDESCRIPTORERROR,
- NEEDSECTIONVIEWERROR,
- DSONOTFOUNDERROR,
- UNDEFINEDSYMBOLERROR,
- SYMBOLMISSINGFROMELFERROR,
- MEMORYALLOCATIONERROR,
- E32IMAGEERROR,
- INVALIDINVOCATIONERROR,
- TARGETTYPENOTSPECIFIEDERROR,
- UNSUPPORTEDTARGETTYPEERROR,
- INDEXNOMESSAGEERROR,
- INDEXNOTREQUIREDERROR,
- INDEXNOTFOUNDERROR,
- NOMESSAGEFILEERROR,
- ENTRYPOINTNOTSETERROR,
- UNDEFINEDENTRYPOINTERROR,
- ORDINALNOTANUMBER,
- UNRECOGNIZEDTOKEN,
- NONAMEMISSING,
- EXPORTSEXPECTED,
- ATRATEMISSING,
- SYSDEFSMISMATCHERROR,
- SYSDEFERROR,
- INVALIDE32IMAGEERROR,
- HUFFMANBUFFERUNDERFLOWERROR,
- HUFFMANINCONSISTENTSIZEERROR,
- MULTIPLESYSDEFERROR,
- SYSDEFNOSYMBOLERROR,
- VALUEIGNOREDWARNING,
- ELFFILEERROR,
- SYMBOLCOUNTMISMATCHERROR,
- POSTLINKERERROR,
- BYTEPAIRINCONSISTENTSIZEERROR,
- ILLEGALEXPORTFROMDATASEGMENT,
- VALIDATIONERROR
-};
-
-
-/**
-Abstract base Class for Message Implementation.
-@internalComponent
-@released
-*/
-class Message
-{
- public:
- virtual ~Message(){};
- // get error string from message file
- virtual char * GetMessageString(int errorIndex)=0;
- // display message to output device
- virtual void Output(const char *aName) =0;
- // start logging to a file
- virtual void StartLogging(char *fileName)=0;
- // virtual void ReportWarning(int warnIndex,...)=0;
- virtual void ReportMessage(int aMsgType, int aMsgIndex,...)=0;
- virtual void CreateMessageFile(char *fileName)=0;
- virtual void InitializeMessages(char *fileName)=0;
-};
-
-/**
-Class for Message Implementation.
-@internalComponent
-@released
-*/
-class MessageImplementation : public Message
-{
- public:
- MessageImplementation();
- ~MessageImplementation();
-
- //override base class methods
- char* GetMessageString(int errorIndex);
- void Output(const char *aName);
- void StartLogging(char *fileName);
- // void ReportWarning(int warnIndex,...);
- void ReportMessage(int aMsgType, int aMsgIndex,...);
- void CreateMessageFile(char *fileName);
- void InitializeMessages(char *fileName);
- private:
-
- bool iLogging;
- char* iLogFileName;
- FILE *iLogPtr;
- Map iMessage;
-};
-
-/**
-Structure for Messages.
-@internalComponent
-@released
-*/
-struct EnglishMessage
-{
- int index;
- char message[1024];
-};
-
-#endif
-
--- a/toolsandutils/e32tools/elf2e32/source/pagedcompress.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// byte_pair.cpp
-//
-//
-
-#include <malloc.h>
-#include <string.h>
-#include <stdlib.h>
-#include "h_utl.h"
-#include "h_ver.h"
-#include <stdio.h>
-
-#include <fstream>
-#ifdef __TOOLS2__
-#include <sstream>
-#else
-#include <strstream.h>
-#endif
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <iostream>
-#ifndef __LINUX__
-#include <io.h>
-#endif
-#include <time.h>
-
-#include "byte_pair.h"
-
-#define PAGE_SIZE 4096
-
-//#define __TEST_ONLY__
-
-
-typedef struct IndexTableItemTag
-{
- TUint16 iSizeOfCompressedPageData; // pointer to an array TUint16[NumberOfPages]
- TUint8 *iCompressedPageData; // pointer to an array TUint8*. Each elemet of
- // this array point a compressed Page data
-}IndexTableItem;
-
-
-typedef struct IndexTableHeaderTag
-{
- TInt iSizeOfData; // Includes the index and compressed pages
- TInt iDecompressedSize;
- TUint16 iNumberOfPages;
-} IndexTableHeader;
-
-
-class CBytePairCompressedImage
-{
- public:
- static CBytePairCompressedImage* NewLC(TUint16 aNumberOfPages, TInt aSize);
-
- ~CBytePairCompressedImage();
-
- void AddPage(TUint16 aPageNum, TUint8 * aPageData, TUint16 aPageSize);
- int GetPage(TUint16 aPageNum, TUint8 * aPageData);
- void WriteOutTable(std::ofstream &os);
- int ReadInTable(std::ifstream &is, TUint & aNumberOfPages);
-
- private:
- TInt ConstructL( TUint16 aNumberOfPages, TInt aSize);
- CBytePairCompressedImage();
-
- private:
- IndexTableHeader iHeader;
- IndexTableItem* iPages;
- TUint8* iOutBuffer;
-
-};
-
-
-CBytePairCompressedImage::CBytePairCompressedImage()
-{
-
-}
-
-
-CBytePairCompressedImage* CBytePairCompressedImage::NewLC(TUint16 aNumberOfPages, TInt aSize)
-{
- CBytePairCompressedImage* self = new CBytePairCompressedImage;
- if( NULL == self)
- {
- return self;
- }
-
- if( KErrNone == self->ConstructL(aNumberOfPages, aSize))
- {
- return self;
- }
- return NULL;
-}
-
-
-TInt CBytePairCompressedImage::ConstructL(TUint16 aNumberOfPages, TInt aSize)
-{
- //Print(EWarning,"Start ofCBytePairCompressedImage::ConstructL(%d, %d)\n", aNumberOfPages, aSize );
- iHeader.iNumberOfPages = aNumberOfPages;
- iHeader.iDecompressedSize = aSize;
-
- if( 0 != aNumberOfPages)
- {
- iPages = (IndexTableItem *) calloc(aNumberOfPages, sizeof(IndexTableItem));
-
- if( NULL == iPages )
- {
- return KErrNoMemory;
- }
- }
-
- iHeader.iSizeOfData = sizeof(iHeader.iSizeOfData) +
- sizeof(iHeader.iDecompressedSize) +
- sizeof(iHeader.iNumberOfPages) +
- aNumberOfPages * sizeof(TUint16);
-
- iOutBuffer = (TUint8 *) calloc(4 * PAGE_SIZE, sizeof(TUint8) );
-
- if ( NULL == iOutBuffer)
- {
- return KErrNoMemory;
- }
- return KErrNone;
-} // End of ConstructL()
-
-CBytePairCompressedImage::~CBytePairCompressedImage()
-{
-
- for( int i = 0; i < iHeader.iNumberOfPages; i++)
- {
- free(iPages[i].iCompressedPageData);
- iPages[i].iCompressedPageData = NULL;
- }
-
- free( iPages );
- iPages = NULL;
-
- free( iOutBuffer );
- iOutBuffer = NULL;
-}
-
-
-void CBytePairCompressedImage::AddPage(TUint16 aPageNum, TUint8 * aPageData, TUint16 aPageSize)
-{
- //Print(EWarning,"Start of AddPage(aPageNum:%d, ,aPageSize:%d)\n",aPageNum, aPageSize );
-
-#ifdef __TEST_ONLY__
-
- iPages[aPageNum].iSizeOfCompressedPageData = 2;
-
- iPages[aPageNum].iCompressedPageData = (TUint8 *) calloc(iPages[aPageNum].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- memcpy(iPages[aPageNum].iCompressedPageData, (TUint8 *) &aPageNum, iPages[aPageNum].iSizeOfCompressedPageData);
-
-
-#else
-
- TUint16 compressedSize = (TUint16) Pak(iOutBuffer,aPageData,aPageSize );
- iPages[aPageNum].iSizeOfCompressedPageData = compressedSize;
- //Print(EWarning,"Compressed page size:%d\n", iPages[aPageNum].iSizeOfCompressedPageData );
-
- iPages[aPageNum].iCompressedPageData = (TUint8 *) calloc(iPages[aPageNum].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- if( NULL == iPages[aPageNum].iCompressedPageData )
- {
- return;
- }
-
- memcpy(iPages[aPageNum].iCompressedPageData, iOutBuffer, iPages[aPageNum].iSizeOfCompressedPageData );
-
-#endif
-
- iHeader.iSizeOfData += iPages[aPageNum].iSizeOfCompressedPageData;
-}
-
-void CBytePairCompressedImage::WriteOutTable(std::ofstream & os)
-{
- // Write out IndexTableHeader
- //Print(EWarning,"Write out IndexTableHeader(iSizeOfData:%d,iDecompressedSize:%d,iNumberOfPages:%d)\n",iHeader.iSizeOfData, iHeader.iDecompressedSize, iHeader.iNumberOfPages );
- //Print(EWarning,"sizeof(IndexTableHeader) = %d, , sizeof(TUint16) = %d\n",sizeof(IndexTableHeader), sizeof(TUint16) );
- //os.write((const char *) &iHeader, sizeof(IndexTableHeader));
- os.write((const char *) &iHeader.iSizeOfData, sizeof(iHeader.iSizeOfData));
- os.write((const char *) &iHeader.iDecompressedSize, sizeof(iHeader.iDecompressedSize));
- os.write((const char *) &iHeader.iNumberOfPages, sizeof(iHeader.iNumberOfPages));
-
-
- // Write out IndexTableItems (size of each compressed page)
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- os.write((const char *) &(iPages[i].iSizeOfCompressedPageData), sizeof(TUint16));
- }
-
- // Write out compressed pages
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- os.write( (const char *)iPages[i].iCompressedPageData, iPages[i].iSizeOfCompressedPageData);
- }
-
-}
-
-
-int CBytePairCompressedImage::ReadInTable(std::ifstream &is, TUint & aNumberOfPages)
-{
- // Read page index table header
- is.read((char *)&iHeader, (sizeof(iHeader.iSizeOfData)+sizeof(iHeader.iDecompressedSize)+sizeof(iHeader.iNumberOfPages)));
-
- // Allocatin place to Page index table entries
- iPages = (IndexTableItem *) calloc(iHeader.iNumberOfPages, sizeof(IndexTableItem));
-
- if( NULL == iPages )
- {
- return KErrNoMemory;
- }
-
- // Read whole Page index table
-
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- is.read((char *) &(iPages[i].iSizeOfCompressedPageData), sizeof(TUint16));
- }
-
- // Read compressed data pages page by page, decompress and store them
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
-
- iPages[i].iCompressedPageData = (TUint8 *) calloc(iPages[i].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- if( NULL == iPages[i].iCompressedPageData )
- {
- return KErrNoMemory;
- }
-
- is.read((char *)iPages[i].iCompressedPageData, iPages[i].iSizeOfCompressedPageData);
- }
-
- aNumberOfPages = iHeader.iNumberOfPages;
-
- return KErrNone;
-}
-
-int CBytePairCompressedImage::GetPage(TUint16 aPageNum, TUint8 * aPageData)
-{
- TUint8* pakEnd;
-
- const TInt MaxBlockSize = 0x1000;
-
- TUint16 uncompressedSize = (TUint16) Unpak( aPageData,
- MaxBlockSize,
- iPages[aPageNum].iCompressedPageData,
- iPages[aPageNum].iSizeOfCompressedPageData,
- pakEnd );
-
- return uncompressedSize;
-
-
-}
-
-
-void CompressPages(TUint8* bytes, TInt size, std::ofstream& os)
-{
- // Build a list of compressed pages
- TUint16 numOfPages = (TUint16) ((size + PAGE_SIZE - 1) / PAGE_SIZE);
-
- CBytePairCompressedImage* comprImage = CBytePairCompressedImage::NewLC(numOfPages, size);
- if (!comprImage)
- {
- //Print(EError," NULL == comprImage\n");
- return;
- }
-
- TUint pageNum;
- TUint remain = (TUint)size;
- for (pageNum=0; pageNum<numOfPages; ++pageNum)
- {
- TUint8* pageStart = bytes + pageNum * PAGE_SIZE;
- TUint pageLen = remain>PAGE_SIZE ? PAGE_SIZE : remain;
- comprImage->AddPage((TUint16)pageNum, pageStart, (TUint16)pageLen);
- remain -= pageLen;
- }
-
- // Write out index table and compressed pages
- comprImage->WriteOutTable(os);
-
-
- delete comprImage;
- comprImage = NULL;
-
-}
-
-
-int DecompressPages(TUint8 * bytes, std::ifstream& is)
-{
- TUint decompressedSize = 0;
- CBytePairCompressedImage *comprImage = CBytePairCompressedImage::NewLC(0, 0);
- if( NULL == comprImage)
- {
- //Print(EError," NULL == comprImage\n");
- return KErrNoMemory;
- }
-
- TUint numberOfPages = 0;
- comprImage->ReadInTable(is, numberOfPages);
-
-
- TUint8* iPageStart;
- TUint16 iPage = 0;
-
- while(iPage < numberOfPages )
- {
- iPageStart = &bytes[iPage * PAGE_SIZE];
-
- decompressedSize += comprImage->GetPage(iPage, iPageStart);
-
- ++iPage;
- }
-
- delete comprImage;
- return decompressedSize;
-
-}
--- a/toolsandutils/e32tools/elf2e32/source/parameterlistinterface.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Interface ParameterListInterface for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "parameterlistinterface.h"
-
-/**
-Destructor for the ParameterListInterface Class
-
-@internalComponent
-@released
-*/
-ParameterListInterface::~ParameterListInterface()
-{
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/parameterlistinterface.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for the ParameterListInterface of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef PARAMETERLISTINTERFACE_H
-#define PARAMETERLISTINTERFACE_H
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
-#pragma warning(disable: 4702) // unreachable code
-#endif
-
-#include <string>
-#include <vector>
-#include "e32imagedefs.h"
-
-enum ETargetType
-{
- ETargetTypeNotSet = - 2,
- EInvalidTargetType = - 1,
- /** Target type is Library */
- ELib,
- /** Target type is DLL */
- EDll,
- EExe,
- EPolyDll,
- EExexp,
- EStdExe
-};
-
-typedef unsigned int UINT;
-
-using std::vector;
-/**
-This class is the abstract base class from which ParameterManager is derived.
-
-@internalComponent
-@released
-*/
-class ParameterListInterface
-{
-
-public:
- typedef vector<char *> LibSearchPaths;
-
- struct SysDefs
- {
- unsigned int iSysDefOrdinalNum;
- char * iSysDefSymbolName;
- };
-
- typedef struct SysDefs Sys;
-
- typedef std::string string;
-
- virtual ~ParameterListInterface();
-/**
-This function extracts the DEF file name that is passed as input through the --definput option.
-
-@internalComponent
-@released
-
-@return the name of the input DEF file if provided as input through --definput or 0.
-*/
- virtual char * DefInput()=0;
-/**
-This function extracts the Elf file name that is passed as input through the --dsoin option.
-
-@internalComponent
-@released
-
-@return the name of the input Elf file if provided as input through --dsoin or 0.
-*/
- virtual char * ElfInput()=0;
-/**
-This function extracts the E32 image name that is passed as input through the --e32dump option.
-
-@internalComponent
-@released
-
-@return the name of the input E32 image if provided as input through --e32dump or 0.
-*/
- virtual char * E32Input()=0;
- virtual bool E32ImageInOption()=0;
- virtual bool FileDumpOption()=0;
- virtual int DumpOptions()=0;
-
-/**
-This function extracts the output DEF file name that is passed as input through the --defoutput option.
-
-@internalComponent
-@released
-
-@return the name of the output DEF file if provided as input through --defoutput or 0.
-*/
- virtual char * DefOutput()=0;
-/**
-This function extracts the DSO file name that is passed as input through the --dso option.
-
-@internalComponent
-@released
-
-@return the name of the output DSO file if provided as input through --dso or 0.
-*/
- virtual char * DSOOutput()=0;
-/**
-This function extracts the E32 image output that is passed as input through the --output option.
-
-@internalComponent
-@released
-
-@return the name of the output E32 image output if provided as input through --output or 0.
-*/
- virtual char * E32ImageOutput()=0;
-/**
-This function extracts the target type that is passed as input through the --targettype option.
-
-@internalComponent
-@released
-
-@return the name of the input target type if provided as input through --targettype or 0.
-*/
- virtual ETargetType TargetTypeName()=0;
-/**
-This function extracts the name of the DLL (that the DSO is to be linked with)
-that is passed as input through the --linkas option.
-
-@internalComponent
-@released
-
-@return the name of the DLL name to be linked with if provided as input through --linkas or 0.
-*/
- virtual char * LinkAsDLLName()=0;
-/**
-This function extracts the path (where the intermediate libraries should be put)
-that is passed as input through the --libpath option.
-
-@internalComponent
-@released
-
-@return the path if provided as input through --libpath or 0.
-*/
- virtual LibSearchPaths& LibPath()=0;
-/**
-This function extracts the filename from the absolute path that is given as input.
-
-@internalComponent
-@released
-
-@param aFileName
-The filename alongwith the absolute path.
-
-@return the filename (without the absolute path) for valid input else the filename itself.
-
-*/
- virtual char * FileName(char * aArg)=0;
-/**
-This function finds out the directory separator '\' in the path
-
-@internalComponent
-@released
-
-@return the directory spearator '\'
-*/
- virtual char DirectorySeparator()=0;
-/**
-This function finds out if the --definput option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --definput option is passed in or False.
-*/
- virtual bool DefFileInOption()=0;
-/**
-This function finds out if the --elfinput option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --elfinput option is passed in or False.
-*/
- virtual bool ElfFileInOption()=0;
-/**
-This function finds out if the --dso option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --dso option is passed in or False.
-*/
- virtual bool DSOFileOutOption()=0;
-/**
-This function finds out if the --linkas option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --linkas option is passed in or False.
-*/
- virtual bool LinkAsOption()=0;
-/**
-This function parses the command line options and sets the appropriate values based on the
-input options.
-
-@internalComponent
-@released
-
-*/
- virtual void ParameterAnalyser()=0;
-
- virtual bool LogFileOption()=0;
- virtual char* LogFile()=0;
-
- virtual bool E32OutOption()=0;
- virtual bool DefFileOutOption()=0;
-
- virtual bool Uid1Option()=0;
- virtual bool SecureIdOption()=0;
- virtual bool VendorIdOption()=0;
-
- virtual bool MessageFileOption()=0;
- virtual char* MessageFile()=0;
-
- virtual bool DumpMessageFileOption()=0;
- virtual char* DumpMessageFile()=0;
-
- virtual Sys SysDefSymbols(int count)=0;
-
-
- virtual UINT Uid1() = 0;
- virtual UINT Uid2() = 0;
- virtual UINT Uid3() = 0;
- virtual UINT SecureId() = 0;
- virtual UINT VendorId() = 0;
- virtual bool FixedAddress() = 0;
- virtual bool Compress() = 0;
- virtual UINT CompressionMethod() = 0;
- virtual size_t HeapCommittedSize() = 0;
- virtual size_t HeapReservedSize() = 0;
- virtual size_t StackCommittedSize() = 0;
- virtual bool Unfrozen() = 0;
- virtual bool IgnoreNonCallable() = 0;
- virtual SCapabilitySet Capability() = 0;
- virtual int SysDefCount() = 0;
- virtual char * FileDumpSubOptions() = 0;
- virtual TProcessPriority Priority() = 0;
- virtual bool DllDataP() = 0;
- virtual unsigned int Version() = 0;
- virtual bool CallEntryPoint() = 0; //{ return true;}
- virtual UINT FPU() = 0;
-
- virtual bool IsCodePaged() = 0;
- virtual bool IsCodeUnpaged() = 0;
- virtual bool IsCodeDefaultPaged() = 0;
-
- virtual bool IsDataPaged() = 0;
- virtual bool IsDataUnpaged() = 0;
- virtual bool IsDataDefaultPaged() = 0;
-
- virtual bool ExcludeUnwantedExports() = 0;
- virtual bool IsCustomDllTarget() = 0;
- virtual bool SymNamedLookup() = 0;
- virtual bool IsDebuggable() = 0;
- virtual bool IsSmpSafe() = 0;
-};
-
-
-#endif // PARAMETERLISTINTERFACE_H
-
--- a/toolsandutils/e32tools/elf2e32/source/parametermanager.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3730 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ParameterManager for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-// This must go before ParameterManager.h
-#define __INCLUDE_CAPABILITY_NAMES__
-#include <e32capability.h>
-
-#include "pl_common.h"
-#include "parametermanager.h"
-#include "errorhandler.h"
-#include <iostream>
-
-#include "h_utl.h"
-#include "h_ver.h"
-/**
-Constructor for the ParameterManager.
-
-@internalComponent
-@released
-
-@param aArgc
- The number of command line arguments passed into the program
-@param aArgv
- The listing of all the arguments
-*/
-ParameterManager::ParameterManager(int aArgc, char** aArgv) :
- iArgc(aArgc),
- iArgv(aArgv),
- iImageLocation(0),
- iImageName(0),
- iTargetTypeOption(false),
- iDefFileInOption(false),
- iDefFileOutOption(false),
- iFileDumpOption(false),
- iDSOFileOutOption(false),
- iOutFileOption(false),
- iElfFileInOption(false),
- iE32ImageInOption(false),
- iLinkAsOption(false),
- iUid1Option(false),
- iSecureIDOption(false),
- iVendorIDOption(false),
- iUID1(0),
- iUID2(0),
- iUID3(0),
- iSecureID(0),
- iVendorID(0),
- iCompress(true),
- iCompressionMethod(KUidCompressionDeflate),
- iFixedAddress(false),
- iHeapCommittedSize(0x1000),
- iHeapReservedSize(0x100000),
- iStackCommittedSize(0x2000),
- iUnfrozen(false),
- iIgnoreNonCallable(false),
- iTargetTypeName(ETargetTypeNotSet),
- iDefOutput(0),
- iDSOOutput(0),
- iOutFileName(0),
- iDefInput(0),
- iElfInput(0),
- iE32Input(0),
- iLinkDLLName(0),
- iDumpOptions(EDumpDefaults),
- iFileDumpSubOptions(0),
- iSysDefOption(false),
- iLogFileName(0),
- iLogFileOption(false),
- iMessageFileName(0),
- iMessageFileOption(false),
- iDumpMessageFileName(0),
- iDumpMessageFileOption(false),
- iDllDataP(false),
- iLibPathList (0),
- iSysDefCount (0),
- iPriorityOption(false),
- iPriorityVal((TProcessPriority)0),
- iVersion(0x000a0000u),
- iVersionOption(false),
- iCallEntryPoint(true),
- iFPU(0),
- iFPUOption(false),
- iArgumentCount(0),
-
- iCodePaged(false),
- iCodeUnpaged(false),
- iCodeDefaultPaged(false),
-
- iDataPaged(false),
- iDataUnpaged(false),
- iDataDefaultPaged(false),
-
- iExcludeUnwantedExports(false),
- iCustomDllTarget(false),
- iSymNamedLookup(false),
- iDebuggable(false),
- iSmpSafe(false)
-{
- iArgumentCount = aArgc;
- ParamList temp(aArgv, aArgv+aArgc);
- iParamList = temp;
- iCapability.iCaps[0] = 0;
- iCapability.iCaps[1] = 0;
-}
-
-/**
-Destructor for the ParameterManager.
-
-@internalComponent
-@released
-*/
-ParameterManager::~ParameterManager()
-{
- DELETE_PTR_ARRAY(iImageLocation);
-}
-
-/**
-Function to check if the given value is a valid number (decimal value)
-
-@internalComponent
-@released
-
-@param aArg
-Value to be checked
-@return True if the provided value is a decimal value.
-*/
-static bool IsAllDigits(const char * aArg)
-{
- const char * p = aArg;
- while (*p)
- {
- if (!isdigit(*p++)) return false;
- }
- return true;
-}
-
-/**
-Function to check if the given value is a valid number (Hexadecimal value)
-
-@internalComponent
-@released
-
-@param aArg
-Value to be checked
-@return True if the provided value is a hexadecimal value.
-*/
-static bool IsAllXDigits(const char * aArg)
-{
- const char * p = aArg;
- while (*p)
- {
- if (!isxdigit(*p++)) return false;
- }
- return true;
-}
-
-/**
-Function to check if the given value is a valid number (Decimal or Hexadecimal value)
-
-@internalComponent
-@released
-
-@param aVal
-Holds the validated number.
-@param aArg
-Value to be checked
-@return True if the provided value is a valid number.
-*/
-static bool GetUInt(UINT & aVal, const char * aArg)
-{
- char * final = (char *)aArg;
- // try base 10 first
- if (IsAllDigits(aArg))
- {
- aVal = strtoul(aArg, &final, 10);
- if (aArg != final) return true;
- // now try as hex
- }
- if (aArg[0] == '0' && (aArg[1] == 'x' || aArg[1] == 'X'))
- {
- aArg += 2;
- if (IsAllXDigits(aArg))
- {
- final = (char *)aArg ;
- aVal = strtoul(aArg, &final, 16);
- if (aArg != final) return true;
- }
- }
-
- return false;
-}
-
-const char * ParameterManager::iParamPrefix = "--";
-const char * ParameterManager::iParamShortPrefix = "-";
-const char ParameterManager::iParamEquals = '=';
-
-// Option Map
-const ParameterManager::OptionDesc ParameterManager::iOptions[] =
-{
- {
- "definput",
- (void *)ParameterManager::ParseDefInput,
- "Input DEF File",
- },
- {
- "defoutput",
- (void *)ParameterManager::ParseDefOutput,
- "Output DEF File",
- },
- {
- "elfinput",
- (void *)ParameterManager::ParseElfInput,
- "Input ELF File",
- },
- {
- "output",
- (void *)ParameterManager::ParseOutput,
- "Output E32 Image",
- },
- {
- "dso",
- (void *)ParameterManager::ParseDSOOutput,
- "Output import DSO File",
- },
- {
- "targettype",
- (void *)ParameterManager::ParseTargetTypeName,
- "Target Type",
- },
- {
- "linkas",
- (void *)ParameterManager::ParseLinkAs,
- "name",
- },
- {
- "uid1",
- (void *)ParameterManager::ParseUID1,
- "UID 1",
- },
- {
- "uid2",
- (void *)ParameterManager::ParseUID2,
- "UID 2",
- },
- {
- "uid3",
- (void *)ParameterManager::ParseUID3,
- "UID 3",
- },
- {
- "sid",
- (void *)ParameterManager::ParseSecureId,
- "Secure ID",
- },
- {
- "vid",
- (void *)ParameterManager::ParseVendorId,
- "Vendor ID",
- },
- {
- "fixedaddress",
- (void *)ParameterManager::ParseFixedAddress,
- "Has fixed address",
- },
- {
- "uncompressed",
- (void *)ParameterManager::ParseUncompressed,
- "Don't compress output e32image",
- },
- {
- "compressionmethod",
- (void*)ParameterManager::ParseCompressionMethod,
- "Input compression method [none|inflate|bytepair]\n\t\tnone no compress the image.\
- \n\t\tinflate compress image with Inflate algorithm.\
- \n\t\tbytepair tcompress image with BytePair Pak algorithm."
- },
- {
- "heap",
- (void *)ParameterManager::ParseHeap,
- "Heap committed and reserved size in bytes(.EXEs only)",
- },
- {
- "stack",
- (void *)ParameterManager::ParseStackCommitted,
- "Stack size in bytes(.EXEs only)",
- },
- {
- "unfrozen",
- (void *)ParameterManager::ParseUnfrozen,
- "Don't treat input dot-def file as frozen",
- },
- {
- "ignorenoncallable",
- (void *)ParameterManager::ParseIgnoreNonCallable,
- "Suppress implicit exports",
- },
- {
- "capability",
- (void *)ParameterManager::ParseCapability,
- "capability option",
- },
- {
- "libpath",
- (void *)ParameterManager::ParseLibPaths,
- "A semi-colon separated search path list to locate import DSOs",
- },
- {
- "sysdef",
- (void *)ParameterManager::ParseSysDefs,
- "A semi-colon separated Pre Defined Symbols to be exported and the ordinal number",
- },
- {
- "log",
- (void *)ParameterManager::ParseLogFile,
- "Output Log Message",
- },
- {
- "messagefile",
- (void *)ParameterManager::ParseMessageFile,
- "Input Message File",
- },
- {
- "dumpmessagefile",
- (void *)ParameterManager::ParseDumpMessageFile,
- "Output Message File",
- },
- {
- "dlldata",
- (void *)ParameterManager::ParseAllowDllData,
- "Allow writable static data in DLL",
- },
- {
- "dump",
- (void *)ParameterManager::ParseFileDump,
- "Input dump options [hscdeit] --e32input <filename>\n\tFlags for dump:\n\t\th Header \
- \n\t\ts Security info\n\t\tc Code section\n\t\td Data section \
- \n\t\te Export info\n\t\ti Import table\n\t\tt Symbol Info",
- },
- {
- "e32input",
- (void *)ParameterManager::ParseE32ImageInput,
- "Input E32 Image File Name",
- },
- {
- "priority",
- (void *)ParameterManager::ParsePriority,
- "Input Priority",
- },
- {
- "version",
- (void *)ParameterManager::ParseVersion,
- "Module Version",
- },
- {
- "callentry",
- (void *)ParameterManager::ParseCallEntryPoint,
- "Call Entry Point",
- },
- {
- "fpu",
- (void *)ParameterManager::ParseFPU,
- "FPU type [softvfp|vfpv2]",
- },
- {
- "codepaging",
- (void *)ParameterManager::ParseCodePaging,
- "Code Paging Strategy [paged|unpaged|default]",
- },
- {
- "datapaging",
- (void *)ParameterManager::ParseDataPaging,
- "Data Paging Strategy [paged|unpaged|default]",
- },
-
- {
- "paged",
- (void *)ParameterManager::ParsePaged,
- "This option is deprecated. Use --codepaging=paged instead.",
- },
- {
- "unpaged",
- (void *)ParameterManager::ParseUnpaged,
- "This option is deprecated. Use --codepaging=unpaged instead.",
- },
- {
- "defaultpaged",
- (void *)ParameterManager::ParseDefaultPaged,
- "This option is deprecated. Use --codepaging=default instead.",
- },
-
- {
- "excludeunwantedexports",
- (void *)ParameterManager::ParseExcludeUnwantedExports,
- "Exclude Unwanted Exports",
- },
- {
- "customdlltarget",
- (void *)ParameterManager::ParseIsCustomDllTarget,
- "Custom Dll Target",
- },
- {
- "namedlookup",
- (void*)ParameterManager::ParseSymNamedLookup,
- "Enable named lookup of symbols",
- },
- {
- "debuggable",
- (void*)ParameterManager::ParseDebuggable,
- "Debuggable by run-mode debug subsystem",
- },
- {
- "smpsafe",
- (void*)ParameterManager::ParseSmpSafe,
- "SMP Safe",
- },
- {
- "help",
- (void *)ParameterManager::ParamHelp,
- 0,
- },
-};
-
-// Map for the short options (abbreviation)
-const ParameterManager::OptionDesc ParameterManager::iShortOptions[] =
-{
- {
- "h",
- (void *)ParameterManager::ParamHelp,
- 0,
- },
-};
-
-/**
-This function finds the total number of options with normal prefix ('--')
-
-@internalComponent
-@released
-
-@return the total number of options with normal prefix '--' in the option list.
-*/
-int ParameterManager::NumOptions()
-{
- return (sizeof(iOptions) / sizeof(OptionDesc));
-}
-
-/**
-This function finds the total number of options with short prefix ('-')
-
-@internalComponent
-@released
-
-@return the total number of options with short prefix '-' in the option list.
-*/
-int ParameterManager::NumShortOptions()
-{
- return (sizeof(iShortOptions) / sizeof(OptionDesc));
-}
-
-/**
-This function initializes the option list, options preceeded by '--' and '-'
-
-@internalComponent
-@released
-*/
-void ParameterManager::InitParamParser()
-{
- int lim = NumOptions();
- int shortoptionlim = NumShortOptions();
- int i;
-
- for (i = 0; i < lim; i++)
- {
- string aOption = iOptions[i].iName;
- iOptionMap[aOption] = &iOptions[i];
- }
-
- for (i = 0; i < shortoptionlim; i++)
- {
- string aShortOption = iShortOptions[i].iName;
- iShortOptionMap[aShortOption] = &iShortOptions[i];
- }
-}
-
-/**
-This function parses the command line options and identifies the input parameters.
-If no options or if --log is the only option passed in, then usage information will
-be displayed.
-
-@internalComponent
-@released
-*/
-void ParameterManager::ParameterAnalyser()
-{
- InitParamParser();
- const OptionDesc * aHelpDesc = iOptionMap["help"];
- int prefixLen = strlen(iParamPrefix);
- int prefixShortLen = strlen(iParamShortPrefix);
- int ArgCount = iArgumentCount-1;
- RecordImageLocation();
- ParamList::iterator p = iParamList.begin()+1;
-
- int OnlyLoggingOption = 0;
-
- // Have to have some arguments. Otherwise, assume this is a request for --help and display the usage information
- if (p == iParamList.end())
- {
- ParserFn parser = (ParserFn)aHelpDesc->iParser ;
- parser(this, "help", 0, aHelpDesc);
- }
-
- if ( (ArgCount ==1) && (!strncmp(*p,"--log",5)) )
- OnlyLoggingOption = 1;
-
- for (; p != iParamList.end(); p++)
- {
- int Prefix=0, ShortPrefix=0;
- ArgCount--;
-
-
- // Check if the option provided is correct and display help on getting incorrect options
- try
- {
- if (!strncmp(*p, iParamPrefix, prefixLen))
- Prefix = 1;
- else if (!strncmp(*p, iParamShortPrefix, prefixShortLen))
- ShortPrefix = 1;
- else // Option is neither preceeded by '-' or by '--'
- throw ParameterParserError(OPTIONNAMEERROR,*p);
- }
- catch (ErrorHandler& error)
- {
- error.Report();
- ParserFn parser = (ParserFn)aHelpDesc->iParser ;
- parser(this, *p, 0, 0);
- }
-
- char *option;
- const OptionDesc * aDesc;
- char * optval=NULL;
-
- // Get the option name excluding the prefix, '-' or '--'if (Prefix)
- if (Prefix)
- {
- option = *p + prefixLen;
- }
- else
- {
- option = *p + prefixShortLen;
- }
-
- char * pos = strchr(*p, iParamEquals);
-
- char *end = pos ? pos : *p + strlen(*p);
-
- string aName(option, end);
- string optionval;
-
- if (pos)
- {
- if (*end != 0 && (*(end+1) != NULL) )
- {
- // Check to ensure that optval points to the correct option value
- optval=end+1;
- }
- if ( ((p+1) != iParamList.end()) && (**(p+1) != '-') )
- {
- pos = 0;
- }
- }
- if ( !pos)
- {
- // The option is not immediately preceeded by '='
- // Space may be used to separate the input option and the paramters
- // '=' may be enclosed within space
- //if ((p+1) != iParamList.end())
- if (ArgCount != 0) //To find if we have consumed all the arguments
- {
- while ( ((p+1) != iParamList.end()) && (**(p+1) != '-') )
- {
- end = *(p+1);
- if (*end == '=')
- {
- if ( (*(end+1) != ' ') && (*(end+1) != NULL) )
- // This is the case where '=' is preceeded by space.
- optionval += end+1;
- }
- else
- {
- optionval += end;
- }
- p++;
- ArgCount-- ;
- }
- if (optionval.length())
- {
- if (optval)
- strcat(optval, optionval.c_str());
- else
- {
- optval = new char[optionval.length()+1];
- strcpy(optval, optionval.c_str());
- }
- }
- }
- }
-
- if (Prefix)
- aDesc = iOptionMap[aName];
- else
- aDesc = iShortOptionMap[aName];
-
- ParserFn parser = aDesc ?(ParserFn)aDesc->iParser : (ParserFn)aHelpDesc->iParser ;
- // NB aDesc might be NULL which tells help to exit with error.
- try
- {
- if (!aDesc)
- throw ParameterParserError(OPTIONNAMEERROR,*p);
- }
- catch (ErrorHandler& error)
- {
- error.Report();
- ParserFn parser = (ParserFn)aHelpDesc->iParser ;
- parser(this, "help", 0, 0);
- }
-
- // If --log is the only option provided, then display the usage information
- if (OnlyLoggingOption)
- {
- parser(this, (char *)aName.c_str(), optval, aDesc);
- parser = (ParserFn)aHelpDesc->iParser ;
- parser(this, "help", 0, 0);
- }
-
- parser(this, const_cast<char*>(aName.c_str()), optval, aDesc);
- }
-}
-
-/**
-This function extracts the path
-
-@internalComponent
-@released
-
-@param aPathName
-The file path name
-
-@return the Path in case of valid path name, else 0.
-
-*/
-char * ParameterManager::Path(char * aPathName)
-{
- string str(aPathName);
- size_t pos = str.find_last_of(DirectorySeparator());
-
- if (pos < str.size())
- {
- char * aPath = new char[pos+2];
- memcpy(aPath, aPathName, pos+1);
- aPath[pos+1] = 0;
- return aPath;
- }
- else
- return (char *)0;
-}
-
-
-/**
-This function extracts the location where the image is to be dumped and the image name.
-
-@internalComponent
-@released
-*/
-void ParameterManager::RecordImageLocation()
-{
- iImageLocation = Path(iArgv[0]);
- iImageName = FileName(iArgv[0]);
-}
-
-/**
-This function finds out if the --definput option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --definput option is passed in or False.
-*/
-bool ParameterManager::DefFileInOption()
-{
- return iDefFileInOption;
-}
-
-/**
-This function finds out if the --e32input option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --e32input option is passed in or False.
-*/
-bool ParameterManager::E32ImageInOption()
-{
- return iE32ImageInOption;
-}
-
-/**
-This function finds out if the --elfinput option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --elfinput option is passed in or False.
-*/
-bool ParameterManager::ElfFileInOption()
-{
- return iElfFileInOption;
-}
-
-/**
-This function finds out if the --dso option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --dso option is passed in or False.
-*/
-bool ParameterManager::DSOFileOutOption()
-{
- return iDSOFileOutOption;
-}
-
-/**
-This function finds out if the --defoutput option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --defoutput option is passed in or False.
-*/
-bool ParameterManager::DefFileOutOption()
-{
- return iDefFileOutOption;
-}
-
-/**
-This function finds out if the --output option is passed to the program.
-
-
-@internalComponent
-@released
-
-@return true if --output option is passed else return False.
-*/
-bool ParameterManager::E32OutOption()
-{
- return iOutFileOption;
-}
-
-/**
-This function finds out if the --linkas option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --linkas option is passed in or False.
-*/
-bool ParameterManager::LinkAsOption()
-{
- return iLinkAsOption;
-}
-
-
-/**
-This function finds out if the --UID1 option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --UID1 option is passed in or False.
-*/
-bool ParameterManager::Uid1Option()
-{
- return iUid1Option;
-}
-
-/**
-This function finds out if the --sid option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --sid option is passed in or False.
-*/
-bool ParameterManager::SecureIdOption()
-{
- return iSecureIDOption;
-}
-
-/**
-This function finds out if the --vid option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --vid option is passed in or False.
-*/
-bool ParameterManager::VendorIdOption()
-{
- return iVendorIDOption;
-}
-
-/**
-This function finds out if the --log option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --log option is passed in or False.
-*/
-bool ParameterManager::LogFileOption()
-{
- return iLogFileOption;
-}
-
-/**
-This function finds out if the --messagefile option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --messagefile option is passed in or False.
-*/
-bool ParameterManager::MessageFileOption()
-{
- return iMessageFileOption;
-}
-
-/**
-This function finds out if the --dumpmessagefile option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --dumpmessagefile option is passed in or False.
-*/
-bool ParameterManager::DumpMessageFileOption()
-{
- return iDumpMessageFileOption;
-}
-
-/**
-This function finds out if the --fixedaddress option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --fixedaddress option is passed in or False.
-*/
-bool ParameterManager::FixedAddress()
-{
- return iFixedAddress;
-}
-
-/**
-This function finds out if the --uncompressed option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --uncompressed option is passed in or False.
-*/
-bool ParameterManager::Compress()
-{
- return iCompress;
-}
-
-
-/**
-This function finds out if the --compressionmethod option is passed to the program.
-
-@internalComponent
-@released
-
-@return UId if --compressionmethod option is passed in or UId of deflate compressor (compatibility).
-*/
-UINT ParameterManager::CompressionMethod()
-{
- return iCompressionMethod;
-}
-
-
-/**
-This function finds out if the --unfrozen option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --unfrozen option is passed in or False.
-*/
-bool ParameterManager::Unfrozen()
-{
- return iUnfrozen;
-}
-
-/**
-This function finds out if the --ignorenoncallable option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --ignorenoncallable option is passed in or False.
-*/
-bool ParameterManager::IgnoreNonCallable()
-{
- return iIgnoreNonCallable;
-}
-
-/**
-This function finds out if the --dlldata option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --dlldata option is passed in or False.
-*/
-bool ParameterManager::DllDataP()
-{
- return iDllDataP;
-}
-
-/**
-This function finds out if the --version option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --version option is passed in or False.
-*/
-bool ParameterManager::VersionOption()
-{
- return iVersionOption;
-}
-
-/**
-This function finds out if the --callentry option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --callentry option is passed in or False.
-*/
-bool ParameterManager::CallEntryPoint()
-{
- return iCallEntryPoint;
-}
-
-/**
-This function finds out if the --priority option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --priority option is passed in or False.
-*/
-bool ParameterManager::PriorityOption()
-{
- return iPriorityOption;
-}
-
-/**
-This function finds out if the --sysdef option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --sysdef option is passed in or False.
-*/
-bool ParameterManager::SysDefOption()
-{
- return iSysDefOption;
-}
-
-/**
-This function finds out if the --dump option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --dump option is passed in or False
-*/
-bool ParameterManager::FileDumpOption()
-{
- return iFileDumpOption;
-}
-
-/**
-This function finds out if the --fpu option is passed to the program.
-
-@internalComponent
-@released
-
-@return True if --fup option is passed in or False.
-*/
-bool ParameterManager::FPUOption()
-{
- return iFPUOption;
-}
-
-
-/**
-This function extracts the DEF file name that is passed as input through the --definput option.
-
-@internalComponent
-@released
-
-@return the name of the input DEF file if provided as input through --definput or 0.
-*/
-char * ParameterManager::DefInput()
-{
- return iDefInput;
-}
-
-/**
-This function extracts the Elf file name that is passed as input through the --elfinput option.
-
-@internalComponent
-@released
-
-@return the name of the input Elf file if provided as input through --elfinput or 0.
-*/
-char * ParameterManager::ElfInput()
-{
- return iElfInput;
-}
-
-/**
-This function extracts the E32 image name that is passed as input through the --e32input option.
-
-@internalComponent
-@released
-
-@return the name of the input E32 image if provided as input through --e32input or 0.
-*/
-char * ParameterManager::E32Input()
-{
- return iE32Input;
-}
-
-/**
-This function extracts the output DEF file name that is passed as input through the --defoutput option.
-
-@internalComponent
-@released
-
-@return the name of the output DEF file if provided as input through --defoutput or 0.
-*/
-char * ParameterManager::DefOutput()
-{
- return iDefOutput;
-}
-
-/**
-This function extracts the DSO file name that is passed as input through the --dso option.
-
-@internalComponent
-@released
-
-@return the name of the output DSO file if provided as input through --dso or 0.
-*/
-char * ParameterManager::DSOOutput()
-{
- return iDSOOutput;
-}
-
-/**
-This function extracts the E32 image output that is passed as input through the --output option.
-
-@internalComponent
-@released
-
-@return the name of the output E32 image output if provided as input through --output or 0.
-*/
-char * ParameterManager::E32ImageOutput()
-{
- return iOutFileName;
-}
-
-/**
-This function extracts the target type that is passed as input through the --targettype option.
-
-@internalComponent
-@released
-
-@return the name of the input target type if provided as input through --targettype or 0.
-*/
-ETargetType ParameterManager::TargetTypeName()
-{
- return iTargetTypeName;
-}
-
-/**
-This function extracts the name of the DLL (that the DSO is to be linked with)
-that is passed as input through the --linkas option.
-
-@internalComponent
-@released
-
-@return the name of the DLL name to be linked with if provided as input through --linkas or 0.
-*/
-char * ParameterManager::LinkAsDLLName()
-{
- return iLinkDLLName;
-}
-
-/**
-This function extracts the path (where the intermediate libraries should be put)
-that is passed as input through the --libpath option.
-
-@internalComponent
-@released
-
-@return the path if provided as input through --libpath or 0.
-*/
-ParameterListInterface::LibSearchPaths& ParameterManager::LibPath()
-{
- return iLibPathList;
-}
-
-/**
-This function extracts the total number of predefined symbols passed to --sysdef option.
-
-@internalComponent
-@released
-
-@return the total number of predefined symbols passed through --elfinput or 0.
-*/
-int ParameterManager::SysDefCount()
-{
- return iSysDefCount;
-}
-
-/**
-This function extracts the E32 image dump options passed as input through the --dump option.
-
-/@internalComponent
-@released
-
-@return the name of the dump options if provided as input through --dump or 0.
-*/
-char * ParameterManager::FileDumpSubOptions()
-{
- return iFileDumpSubOptions;
-}
-
-/**
-This function extracts the E32 image dump options in integer value passed as character input
-through the --dump option.
-
-@internalComponent
-@released
-
-@return the name of the dump options in integer.
-*/
-int ParameterManager::DumpOptions()
-{
- return iDumpOptions;
-}
-
-/**
-This function gets the first UID in a compound identifier (UID type) that is passed as
-input through the --uid1 option.UID1 differentiates the executables, DLLs and file stores.
-
-@internalComponent
-@released
-
-@return the System level identifier if provided as input through --uid1 or 0.
-*/
-UINT ParameterManager::Uid1()
-{
- return iUID1;
-}
-
-/**
-This function gets the UID2 that is passed as input through the --uid2 option.
-UID2 differentiates the static interface (shared library) and polymorphic interface
-(application or plug-in framework) DLLs.
-
-@internalComponent
-@released
-
-@return the Interface identifier if provided as input through --uid2 or 0.
-*/
-UINT ParameterManager::Uid2()
-{
- return iUID2;
-}
-
-/**
-This function gets the UID3 that is passed as input through the --uid3 option. UID3
-is shared by all objects belonging to a given program, including library DLLs if any,
-framework DLLs, and all documents.
-
-@internalComponent
-@released
-
-@return the Project identifier if provided as input through --uid3 or 0.
-*/
-UINT ParameterManager::Uid3()
-{
- return iUID3;
-}
-
-/**
-This function gets the Secure Id that is passed as input through the --sid option.
-
-@internalComponent
-@released
-
-@return the Secure Id if provided as input through --sid or 0.
-*/
-UINT ParameterManager::SecureId()
-{
- return iSecureID;
-}
-
-/**
-This function gets the Vendor Id that is passed as input through the --vid option.
-
-@internalComponent
-@released
-
-@return the Vendor Id if provided as input through --vid or 0.
-*/
-UINT ParameterManager::VendorId()
-{
- return iVendorID;
-}
-
-/**
-This function gets the capability value passed to '--capability' option.
-
-@internalComponent
-@released
-
-@return the capability value passed to '--capability' option.
-*/
-SCapabilitySet ParameterManager::Capability()
-{
- return iCapability;
-}
-
-/**
-This function extracts the Log file name that is passed as input through the --log option.
-
-@internalComponent
-@released
-
-@return the name of the Log file if provided as input through --log or 0.
-*/
-char * ParameterManager::LogFile()
-{
- return iLogFileName;
-}
-
-/**
-This function extracts the Message file name that is passed as input through the --messagefile option.
-
-@internalComponent
-@released
-
-@return the name of the Message file if provided as input through --messagefile or 0.
-*/
-char * ParameterManager::MessageFile()
-{
- return iMessageFileName;
-}
-
-/**
-This function extracts the Message file name that is passed as input through the --dumpmessagefile option.
-
-@internalComponent
-@released
-
-@return the name of the Message file to be dumped if provided as input through --dumpmessagefile or 0.
-*/
-char * ParameterManager::DumpMessageFile()
-{
- return iDumpMessageFileName;
-}
-
-/**
-This function extracts the list of predefined symbols that is passed as input through
-the --sysdef option.
-
-@internalComponent
-@released
-
-@return the list of predefined symbols that is passed as input through the --sysdef option.
-*/
-ParameterManager::Sys ParameterManager::SysDefSymbols(int sysdefcount)
-{
- return iSysDefSymbols[sysdefcount];
-}
-
-/**
-This function extracts the heap commited size passed as input to --heap option.
-
-@internalComponent
-@released
-
-@return the heap commited size passed as input to --heap option.
-*/
-size_t ParameterManager::HeapCommittedSize()
-{
- return iHeapCommittedSize;
-}
-
-/**
-This function extracts the heap reserved size passed as input to --heap option.
-
-@internalComponent
-@released
-
-@return the heap reserved size passed as input to --heap option.
-*/
-size_t ParameterManager::HeapReservedSize()
-{
- return iHeapReservedSize;
-}
-
-/**
-This function extracts the stack commited size passed as input to --stack option.
-
-@internalComponent
-@released
-
-@return the stack commited size passed as input to --stack option.
-*/
-size_t ParameterManager::StackCommittedSize()
-{
- return iStackCommittedSize;
-}
-
-/**
-This function extracts the priority value passed as input to --priority option.
-
-@internalComponent
-@released
-
-@return the priority value passed as input to --priority option
-*/
-TProcessPriority ParameterManager::Priority()
-{
- return iPriorityVal;
-}
-
-/**
-This function extracts the version information passed as input to --version option.
-
-@internalComponent
-@released
-
-@return the version information passed as input to --version option.
-*/
-UINT ParameterManager::Version()
-{
- return iVersion;
-}
-
-/**
-This function extracts the fpu information passed as input to the --fpu option.
-
-@internalComponent
-@released
-
-@return the fpu information passed as input to the --fpu option.
-*/
-UINT ParameterManager::FPU()
-{
- return iFPU;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsCodePaged()
-{
- return iCodePaged;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsCodeUnpaged()
-{
- return iCodeUnpaged;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsCodeDefaultPaged()
-{
- return iCodeDefaultPaged;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsDataPaged()
-{
- return iDataPaged;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsDataUnpaged()
-{
- return iDataUnpaged;
-}
-
-/**
-@internalComponent
-@released
-*/
-bool ParameterManager::IsDataDefaultPaged()
-{
- return iDataDefaultPaged;
-}
-
-/**
-This function finds out if the --excludeunwantedexports option is passed to the program.
-
-@internalComponent
-@released
-
-@return true if --excludeunwantedexports option is passed in or False.
-*/
-bool ParameterManager::ExcludeUnwantedExports()
-{
- return iExcludeUnwantedExports;
-}
-
-/**
-This function finds out if the --customdlltarget option is passed to the program.
-
-@internalComponent
-@released
-
-@return true if --customdlltarget option is passed in or False.
-*/
-bool ParameterManager::IsCustomDllTarget()
-{
- return iCustomDllTarget;
-}
-
-/**
-This function extracts the SymNamedLookup information passed as input to the --namedlookup option.
-
-@internalComponent
-@released
-
-@return the namedlookup information passed as input to the --namedlookup option.
-*/
-bool ParameterManager::SymNamedLookup()
-{
- return iSymNamedLookup;
-}
-
-/**
-This function determines if the -debuggable option is passed to the program.
-
-@internalComponent
-@released
-
-@return true if --debuggable is passed in or False.
-*/
-bool ParameterManager::IsDebuggable()
-{
- return iDebuggable;
-}
-
-
-bool ParameterManager::IsSmpSafe()
-{
- return iSmpSafe;
-}
-
-/**
-This function extracts the filename from the absolute path that is given as input.
-
-@internalComponent
-@released
-
-@param aFileName
-The filename alongwith the absolute path.
-
-@return the filename (without the absolute path) for valid input else the filename itself.
-*/
-char * ParameterManager::FileName(char * aFileName)
-{
- string str(aFileName);
-
- size_t pos = str.find_last_of(DirectorySeparator());
-#ifndef __LINUX__
- // Support Unix slashes on Windows when stripping filenames from paths
- if (pos > str.size())
- {
- pos = str.find_last_of('/');
- }
-#endif
-
- if (pos < str.size())
- return aFileName + pos + 1;
- else
- return aFileName;
-}
-
-/**
-This function finds out the directory separator '\' in the path
-
-@internalComponent
-@released
-
-@return the directory spearator '\'
-*/
-char ParameterManager::DirectorySeparator()
-{
-#ifdef __LINUX__
- return '/';
-#else
- return '\\';
-#endif
-}
-
-/**
-This function set the input Def file name that is passed through --definput option.
-
-void ParameterManager::ParseDefInput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --definput
-@param aValue
-The DEF file name passed to --definput option
-@param aDesc
-Pointer to function ParameterManager::ParseDefInput returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDefInput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetDefInput(aValue);
-}
-
-/**
-This function set the input Elf file name that is passed through --elfinput option.
-
-void ParameterManager::ParseElfInput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --elfinput
-@param aValue
-The ELF file name passed to --elfinput option
-@param aDesc
-Pointer to function ParameterManager::ParseElfInput returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseElfInput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetElfInput(aValue);
-}
-
-/**
-This function set the output Def file name that is passed through --defoutput option.
-
-void ParameterManager::ParseDefOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --defoutput
-@param aValue
-The DEF file name passed to --defoutput option
-@param aDesc
-Pointer to function ParameterManager::ParseDefOutput returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDefOutput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetDefOutput(aValue);
-}
-
-/**
-This function set the input E32 file name that is passed through --e32input option.
-
-void ParameterManager::ParseE32Input(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --e32input
-@param aValue
-The E32 file name passed to --e32input option
-@param aDesc
-Pointer to function ParameterManager::ParseE32Input returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseE32ImageInput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetE32Input(aValue);
-}
-
-/**
-This function set the output E32 image name that is passed through --output option.
-
-void ParameterManager::ParseOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --output
-@param aValue
-The E32 file name passed to --output option
-@param aDesc
-Pointer to function ParameterManager::ParseOutput returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseOutput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetE32Output(aValue);
-}
-
-/**
-This function set the output Log file name that is passed through --log option.
-
-void ParameterManager::ParseLogFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --log
-@param aValue
-The Log file name passed to --log option
-@param aDesc
-Pointer to function ParameterManager::ParseLogFile returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseLogFile)
-{
- INITIALISE_PARAM_PARSER;
- if(aValue)
- {
- aPM->SetLogFile(aValue);
- MessageHandler::StartLogging(aValue);
- }
- else
- {
- throw ParameterParserError(NOARGUMENTERROR, "--log");
- }
-}
-
-/**
-This function set the input Message file name that is passed through --messagefile option.
-
-void ParameterManager::ParseMessageFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --messagefile
-@param aValue
-The Message file name passed to --messagefile option
-@param aDesc
-Pointer to function ParameterManager::ParseMessageFile returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseMessageFile)
-{
- INITIALISE_PARAM_PARSER;
- if(aValue)
- {
- aPM->SetMessageFile(aValue);
- MessageHandler::InitializeMessages(aValue);
- }
- else
- {
- throw ParameterParserError(NOARGUMENTERROR, "--messagefile");
- }
-}
-
-/**
-This function set the Message file name to be dumped that is passed through --dumpmessagefile option.
-
-void ParameterManager::ParseDumpMessageFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --dumpmessagefile
-@param aValue
-The output Message file name passed to --dumpmessagefile option
-@param aDesc
-Pointer to function ParameterManager::ParseDumpMessageFile returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDumpMessageFile)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetDumpMessageFile(aValue);
-}
-
-/**
-This function checks the arguments passed to the options. If an incorrect argument
-is passed or if no arguments are passed then appropriate error message is displayed.
-
-@internalComponent
-@released
-
-@param aValue
-Input to the option
-@param aOption
-Option that is passed as input
-@return the validated value
-*/
-UINT ValidateInputVal(char * aValue, char * aOption)
-{
- UINT uid;
- if (!aValue)
- throw ParameterParserError(NOARGUMENTERROR, aOption);
- else if (!GetUInt(uid, aValue))
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
- return uid;
-}
-
-/**
-There are some boolean options which does not expect any inputs. This function checks
-if there are any the arguments passed to the option. In case of getting an input argument,
-the warning message "Value is ignored" is displayed.
-
-@internalComponent
-@released
-
-@param aValue
-Input to the option
-@param aOption
-Option that is passed as input
-*/
-void CheckInput(char * aValue, char * aOption)
-{
- if (aValue)
- MessageHandler::GetInstance()->ReportMessage(WARNING, VALUEIGNOREDWARNING, aOption);
-}
-
-/**
-This function set the version information that is passed through --version option.
-
-void ParameterManager::ParseVersion(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --version
-@param aValue
-The version information passed to --version option
-@param aDesc
-Pointer to function ParameterManager::ParseVersion returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseVersion)
-{
- INITIALISE_PARAM_PARSER;
- UINT version = 0;
- UINT majorVal = 0;
- UINT minorVal = 0;
-
- if(!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--version");
-
- char * tokens = strdup(aValue);
- char * major, * minor;
-
- major = strtok(tokens, ".");
- majorVal = ValidateInputVal(major, "--version");
- minor = strtok(NULL, ".");
- if (minor && !GetUInt(minorVal, minor))
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "--version");
-
- version = ((majorVal & 0xFFFF) << 16) | (minorVal & 0xFFFF);
- aPM->SetVersion(version);
-}
-
-/**
-This function set the UID1 value that is passed through --uid1 option.
-
-void ParameterManager::ParseUID1(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --uid1
-@param aValue
-The UID1 value passed to --uid1 option
-@param aDesc
-Pointer to function ParameterManager::ParseUID1 returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUID1)
-{
- INITIALISE_PARAM_PARSER;
- UINT aUid = ValidateInputVal(aValue, "--uid1");
- aPM->SetUID1(aUid);
-}
-
-/**
-This function set the UID2 value that is passed through --uid2 option.
-
-void ParameterManager::ParseUID2(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --uid2
-@param aValue
-The UID2 value passed to --uid2 option
-@param aDesc
-Pointer to function ParameterManager::ParseUID2 returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUID2)
-{
- INITIALISE_PARAM_PARSER;
- UINT aUid = ValidateInputVal(aValue, "--uid2");
- aPM->SetUID2(aUid);
-}
-
-/**
-This function set the UID3 value that is passed through --uid3 option.
-
-void ParameterManager::ParseUID3(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --uid3
-@param aValue
-The UID3 value passed to --uid3 option
-@param aDesc
-Pointer to function ParameterManager::ParseUID3 returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUID3)
-{
- INITIALISE_PARAM_PARSER;
- UINT aUid = ValidateInputVal(aValue, "--uid3");
- aPM->SetUID3(aUid);
-}
-
-/**
-This function set the Secure ID value that is passed through --sid option.
-
-void ParameterManager::ParseSecureId(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --sid
-@param aValue
-The Secure ID value passed to --sid option
-@param aDesc
-Pointer to function ParameterManager::ParseSecureId returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseSecureId)
-{
- INITIALISE_PARAM_PARSER;
- UINT aUid = ValidateInputVal(aValue, "--sid");
- aPM->SetSecureId(aUid);
-}
-
-/**
-This function set the Vendor ID value that is passed through --vid option.
-
-void ParameterManager::ParseVendorId(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --vid
-@param aValue
-The Vendor ID value passed to --vid option
-@param aDesc
-Pointer to function ParameterManager::ParseVendorId returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseVendorId)
-{
- INITIALISE_PARAM_PARSER;
- UINT aUid = ValidateInputVal(aValue, "--vid");
- aPM->SetVendorId(aUid);
-}
-
-/**
-This function set the FixedAddress flag if --fixedaddress option is passed to the program.
-
-void ParameterManager::ParseFixedAddress(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --fixedaddress
-@param aValue
-The value passed to --fixedaddress option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseFixedAddress returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseFixedAddress)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--fixedaddress");
- aPM->SetFixedAddress(true);
-}
-
-/**
-This function set the CallEntryPoint flag if --callentry option is passed to the program.
-
-void ParameterManager::ParseCallEntryPoint(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --callentry
-@param aValue
-The value passed to --callentry option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseCallEntryPoint returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseCallEntryPoint)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetCallEntryPoint(true);
-}
-
-/**
-This function set the Uncompressed flag if --uncompressed option is passed to the program.
-
-void ParameterManager::ParseUncompressed(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --uncompressed
-@param aValue
-The value passed to --uncompressed option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseUncompressed returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUncompressed)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--uncompressed");
- aPM->SetCompress(false);
-}
-
-
-static const ParameterManager::CompressionMethodDesc MethodNames[] =
-{
- { "none", 0},
- { "inflate", KUidCompressionDeflate},
- { "bytepair", KUidCompressionBytePair},
- { 0, 0}
-};
-
-/**
-This function parses the compression method value passed in and finds the corresponding match
-from the list of existing method values.
-
-@internalComponent
-@released
-
-@param aMethod
-Holds the method value mapped from list.
-@param aText
-The priority value passed to --compressionmethod option
-@return True if the method value passed in is a valid one present in the list.
-*/
-static bool ParseCompressionMethodArg(UINT & aMethod, const char *aText)
-{
-
- int i = 0;
- aMethod = 0;
- for (;; i++)
- {
- if (!MethodNames[i].iMethodName)
- return false;
- if (!stricmp(aText, MethodNames[i].iMethodName))
- {
- aMethod = MethodNames[i].iMethodUid;
- return true;
- }
- }
- return false;
-}
-
-/**
-This function set the CompressionMethod variable if --compressionmethod option is passed to the program.
-
-void ParameterManager::ParseUncompressed(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --compressionmethod
-@param aValue
-The value passed to --compressionmethod option, in this case none|inflate|bytepair
-@param aDesc
-Pointer to function ParameterManager::ParseCompressionMethod returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseCompressionMethod)
-{
- INITIALISE_PARAM_PARSER;
- UINT method;
- if(!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--compressionmethod");
-
- if(ParseCompressionMethodArg(method, aValue) )
- aPM->SetCompressionMethod(method);
- else
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "compression method");
-}
-
-/**
-This function parses the compression method value passed in and finds the corresponding match
-from the list of existing method values.
-
-@internalComponent
-@released
-
-
-
-/**
-This function set the AllowDllData flag if --dlldata option is passed to the program.
-
-void ParameterManager::ParseAllowDllData(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --dlldata
-@param aValue
-The value passed to --dlldata option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseAllowDllData returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseAllowDllData)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--dlldata");
- aPM->SetDllDataP(true);
-}
-
-static const ParameterManager::PriorityValueDesc PriorityNames[] =
-{
- { "Low", EPriorityLow},
- { "Background", EPriorityBackground},
- { "Foreground", EPriorityForeground},
- { "High", EPriorityHigh},
- { "WindowServer", EPriorityWindowServer},
- { "FileServer", EPriorityFileServer},
- { "RealTimeServer", EPriorityRealTimeServer},
- { "Supervisor", EPrioritySupervisor},
- { 0, (TProcessPriority)0}
-};
-
-/**
-This function parses the priority value passed in and finds the corresponding match
-from the list of existing priority values.
-
-@internalComponent
-@released
-
-@param aPriority
-Holds the priority value mapped from list.
-@param aText
-The priority value passed to --priority option
-@return True if the priority value passed in is a valid one present in the list.
-*/
-static bool ParsePriorityArg(unsigned int & aPriority, const char *aText)
-{
- int i = 0;
- aPriority = 0;
- for (;; i++)
- {
- if (!PriorityNames[i].iName)
- return false;
- if (!stricmp(aText, PriorityNames[i].iName))
- {
- aPriority = PriorityNames[i].iPriority;
- return true;
- }
- }
- return false;
-}
-
-
-/**
-This function set the priority value that is passed through --priority option.
-
-void ParameterManager::ParsePriority(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --priority
-@param aValue
-The priority value passed to --priority option
-@param aDesc
-Pointer to function ParameterManager::ParsePriority returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParsePriority)
-{
- INITIALISE_PARAM_PARSER;
- unsigned int priority;
- if (!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--priority");
- if (GetUInt(priority, aValue) || ParsePriorityArg(priority, aValue))
- aPM->SetPriority((TProcessPriority)priority);
- else
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "priority");
-}
-
-/**
-This function sets the predefined symbols, at the specified ordinal numbers, that are passed through
---sysdef option.
-
-void ParameterManager::ParseSysDefs(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --sysdef
-@param aValue
-The predefined symbols alongwith the ordinal numbers passed to --sysdef option
-@param aDesc
-Pointer to function ParameterManager::ParseSysDefs returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseSysDefs)
-{
- INITIALISE_PARAM_PARSER;
- if (!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--sysdef");
- string aSysDefValues(aValue);
- string::iterator p = aSysDefValues.begin();
-
- int sysdeflength = aSysDefValues.size();
-
- int parsesysdef = 1;
-
- int sysdefcount=0;
-
- while (parsesysdef && sysdeflength)
- {
-
- int q = 0;
- unsigned int ordinalnum = 0;
- char *symbol = 0;
-
- int nq = aSysDefValues.find_first_of(",", q,sizeof(*p));
- if (nq && (nq != string::npos))
- {
- int len = nq;
- symbol = new char[len+1];
- memcpy(symbol, p, len);
- symbol[len] = 0;
- q = nq+1;
-
- char val = *(p+q);
- if (!val || !isdigit(val))
- throw ParameterParserError(SYSDEFERROR, "--sysdef");
- ordinalnum = *(p+q) - '0';
- aPM->SetSysDefs(ordinalnum, symbol, sysdefcount);
-
- unsigned int separator = aSysDefValues.find(";", 0);
-
- if (separator && (separator != string::npos))
- {
- if (separator != (unsigned int)(q+1))
- throw ParameterParserError(MULTIPLESYSDEFERROR, "--sysdef");
- else
- {
- sysdeflength -= separator + 1;
- aSysDefValues = aSysDefValues.substr(separator+1);
- sysdefcount++;
- }
- }
- else
- {
- sysdeflength -= q+1;
- if (sysdeflength)
- throw ParameterParserError(MULTIPLESYSDEFERROR, "--sysdef");
- else
- parsesysdef = 0;
- }
- }
- else
- {
- if (!nq && sysdeflength)
- throw ParameterParserError(SYSDEFNOSYMBOLERROR, "--sysdef");
- else
- throw ParameterParserError(SYSDEFERROR, "--sysdef");
- }
- }
-}
-
-/**
-This function parses the capability value passed to --capability option.
-
-@internalComponent
-@released
-
-@param aName
-The pointer marking the beginning value passed to the --capability option
-@param aEnd
-The pointer marking the end value passed to the --capability option
-@param aCapabilities
-List of Capability Values allowed
-@param aInvert
-Flag to denote if value can be inverted.
-*/
-void ParameterManager::ParseCapability1(const char * aName, const char * aEnd, SCapabilitySet& aCapabilities, bool aInvert)
-{
- int n = aEnd - aName;
- int i = 0;
- if(n==3 && strnicmp("all",aName,n)==0)
- {
- if(aInvert)
- throw CapabilityError(CAPABILITYALLINVERSIONERROR);
-
- for(i=0; i<ECapability_Limit; i++)
- {
- if(CapabilityNames[i])
- aCapabilities[i>>5] |= (1<<(i&31));
- }
- return;
- }
-
- if(n==4 && strnicmp("none",aName,n)==0)
- {
- if(aInvert)
- throw CapabilityError(CAPABILITYNONEINVERSIONERROR);
-
- memset(&aCapabilities,0,sizeof(aCapabilities));
- return;
- }
-
- for(i=0; i<ECapability_Limit; i++)
- {
- const char* cap = CapabilityNames[i];
- if(!cap)
- continue;
- if((int)strlen(cap)!=n)
- continue;
- if(strnicmp(cap,aName,n)!=0)
- continue;
- break;
- }
- if(i>=ECapability_Limit)
- {
- string aBadCap(aName, aEnd);
- throw UnrecognisedCapabilityError(UNRECOGNISEDCAPABILITYERROR,"BAD CAP");
- }
- if(aInvert)
- aCapabilities[i>>5] &= ~(1<<(i&31));
- else
- aCapabilities[i>>5] |= (1<<(i&31));
-}
-
-/**
-This function parses the capability value passed to --capability option.
-
-@internalComponent
-@released
-
-@param aCapabilities
-List of Capability Values allowed
-@param aText
-Value passed to --capability option.
-*/
-void ParameterManager::ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText)
-{
- string aCapList(aText);
- string::iterator b = aCapList.begin();
- string::iterator e = b;
- bool invert = false;
-
- while(e != aCapList.end())
- {
- invert = false;
- if (*b == '-')
- {
- invert = true;
- b++;
- }
- else if (*b == '+')
- b++;
-
- e = b;
- for (; e != aCapList.end(); e++)
- {
- if (*e == '-' || *e == '+') break;
- }
- if (e != b)
- ParseCapability1(b, e, aCapabilities, invert);
-
- b = e;
-
- }
-}
-
-/**
-This function parses the capability value passed to --capability option.
-
-void ParameterManager::ParseCapability(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --capability
-@param aValue
-The predefined symbols alongwith the ordinal numbers passed to --capability option
-@param aDesc
-Pointer to function ParameterManager::ParseCapability returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseCapability)
-{
- INITIALISE_PARAM_PARSER;
- unsigned int cap;
- SCapabilitySet capSet = {0, 0};
- if (!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--capability");
- if (GetUInt(cap, aValue))
- {
- aPM->SetCapability(cap);
- }
- else
- {
- aPM->ParseCapabilitiesArg(capSet, aValue);
- aPM->SetCapability(capSet);
- }
-}
-
-/**
-This function set the Heap Reserved and Committed Size value that is passed through --heap option.
-
-void ParameterManager::ParseHeap(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --heap
-@param aValue
-The Heap Reserved and Committed Size value passed to --heap option separated by ','.
-@param aDesc
-Pointer to function ParameterManager::ParseHeap returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseHeap)
-{
- INITIALISE_PARAM_PARSER;
- string aArg(aValue);
- UINT committed = aPM->HeapCommittedSize();
- UINT reserved = aPM->HeapReservedSize();
- int p = aArg.find_first_of(",");
- if (p < 0)
- {
- if ( !GetUInt(committed, aValue))
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "heap");
- }
- else
- {
- aArg[p] = 0;
- const char * committedval = aArg.c_str();
- const char * reservedval = committedval + p + 1;
- if (!(GetUInt(committed, committedval) && GetUInt(reserved, reservedval)))
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "heap");
- }
- aPM->SetHeapCommittedSize(committed);
- aPM->SetHeapReservedSize(reserved);
-}
-
-/**
-This function set the stack Committed Size that is passed through --stack option.
-
-void ParameterManager::ParseStackCommitted(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --stack
-@param aValue
-The Stack Committed Size value passed to --stack option.
-@param aDesc
-Pointer to function ParameterManager::ParseStackCommitted returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseStackCommitted)
-{
- INITIALISE_PARAM_PARSER;
- UINT aSize = ValidateInputVal(aValue, "--stack");
- aPM->SetStackCommittedSize(aSize);
-}
-
-/**
-This function set the Unfrozen flag if --unfrozen option is passed to the program.
-
-void ParameterManager::ParseUnfrozen(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --unfrozen
-@param aValue
-The value passed to --unfrozen option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseUnfrozen returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUnfrozen)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--unfrozen");
- aPM->SetUnfrozen(true);
-}
-
-/**
-This function set the ignorenoncallable flag if --ignorenoncallable option is passed to the program.
-
-void ParameterManager::ParseIgnoreNonCallable(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --ignorenoncallable
-@param aValue
-The value passed to --ignorenoncallable option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::Parseignorenoncallable returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseIgnoreNonCallable)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--ignorenoncallable");
- aPM->SetIgnoreNonCallable(true);
-}
-
-/**
-This function sets the FPU type that is passed using the --fpu option.
-
-void ParameterManager::ParseFPU(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --fpu
-@param aValue
-The fpu information passed to the --fpu option
-@param aDesc
-Pointer to function ParameterManager::ParseFPU returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseFPU)
-{
- INITIALISE_PARAM_PARSER;
-
- if (strnicmp(aValue, "softvfp", 7)==0)
- aPM->SetFPU(0);
- else if (strnicmp(aValue, "vfpv2", 5)==0)
- aPM->SetFPU(1);
- else
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
-}
-
-/**
-This function set the Paged flag if --paged option is passed to the program.
-
-void ParameterManager::ParsePaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --paged
-@param aValue
-The value passed to --paged option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParsePaged returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParsePaged)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--paged");
-
- if (aPM->IsCodeUnpaged() || aPM->IsCodeDefaultPaged())
- {
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-
- aPM->SetCodePaged(true);
-}
-
-/**
-This function set the Unpaged flag if --unpaged option is passed to the program.
-
-void ParameterManager::ParseUnpaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --unpaged
-@param aValue
-The value passed to --unpaged option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseUnpaged returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseUnpaged)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--unpaged");
-
- if (aPM->IsCodePaged() || aPM->IsCodeDefaultPaged())
- {
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-
- aPM->SetCodeUnpaged(true);
-}
-
-/**
-This function set the Defaultpaged flag if --defaultpaged option is passed to the program.
-
-void ParameterManager::ParseDefaultpaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --defaultpaged
-@param aValue
-The value passed to --defaultpaged option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseDefaultpaged returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDefaultPaged)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--defaultpaged");
-
- if (aPM->IsCodePaged() || aPM->IsCodeUnpaged())
- {
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-
- aPM->SetCodeDefaultPaged(true);
-}
-
-
-/**
-@internalComponent
-@released
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseCodePaging)
-{
- INITIALISE_PARAM_PARSER;
-
- if (strnicmp(aValue, "paged", 5)==0)
- {
- aPM->SetCodePaged(true);
- }
- else if (strnicmp(aValue, "unpaged", 7)==0)
- {
- aPM->SetCodeUnpaged(true);
- }
- else if (strnicmp(aValue, "default", 7)==0)
- {
- aPM->SetCodeDefaultPaged(true);
- }
- else
- {
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
- }
-
- // Check that we haven't been given conflicting options.
-
- unsigned check = 0;
-
- if ( aPM->IsCodePaged() )
- {
- check++;
- }
- if ( aPM->IsCodeUnpaged() )
- {
- check++;
- }
- if ( aPM->IsCodeDefaultPaged() )
- {
- check++;
- }
-
- if (check > 1)
- {
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-}
-
-/**
-@internalComponent
-@released
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDataPaging)
-{
- INITIALISE_PARAM_PARSER;
-
- if (strnicmp(aValue, "paged", 5)==0)
- {
- aPM->SetDataPaged(true);
- }
- else if (strnicmp(aValue, "unpaged", 7)==0)
- {
- aPM->SetDataUnpaged(true);
- }
- else if (strnicmp(aValue, "default", 7)==0)
- {
- aPM->SetDataDefaultPaged(true);
- }
- else
- {
- throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
- }
-
- // Check that we haven't been given conflicting options.
-
- unsigned check = 0;
-
- if ( aPM->IsDataPaged() )
- {
- check++;
- }
- if ( aPM->IsDataUnpaged() )
- {
- check++;
- }
- if ( aPM->IsDataDefaultPaged() )
- {
- check++;
- }
-
- if (check > 1)
- {
- throw InvalidInvocationError(INVALIDINVOCATIONERROR);
- }
-}
-
-
-/**
-This function sets the iExcludeUnwantedExports flag if --excludeunwantedexports option is passed to the program.
-
-void ParameterManager::ParseExcludeUnwantedExports(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --excludeunwantedexports
-@param aValue
-The value passed to --excludeunwantedexports, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseExcludeUnwantedExports returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseExcludeUnwantedExports)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--excludeunwantedexports");
- aPM->SetExcludeUnwantedExports(true);
-}
-
-/**
-This function sets the customdlltarget flag if --customdlltarget option is passed to the program.
-
-void ParameterManager::ParseIsCustomDllTarget(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --customdlltarget
-@param aValue
-The value passed to --customdlltarget option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseIsCustomDllTarget returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseIsCustomDllTarget)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--customdlltarget");
- aPM->SetCustomDllTarget(true);
-}
-
-DEFINE_PARAM_PARSER(ParameterManager::ParseSymNamedLookup)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--namedlookup");
- aPM->SetSymNamedLookup(true);
-}
-
-/**
-This function set the iDebuggable flag if --debuggable option is passed to the program.
-
-void ParameterManager::ParseDebuggable(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --debuggable
-@param aValue
-The value passed to --debuggable option, in this case NULL
-@param aDesc
-Pointer to function ParameterManager::ParseDebuggable returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDebuggable)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--debuggable");
- aPM->SetDebuggable(true);
-}
-
-
-DEFINE_PARAM_PARSER(ParameterManager::ParseSmpSafe)
-{
- INITIALISE_PARAM_PARSER;
- CheckInput(aValue, "--smpsafe");
- aPM->SetSmpSafe(true);
-}
-
-static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
-{
- { "DLL", EDll },
- { "LIB", ELib },
- // allow full name
- { "LIBRARY", ELib},
- { "IMPLIB", ELib},
- { "EXE", EExe},
- { "ANI", EPolyDll},
- { "APP", EPolyDll},
- { "CTL", EPolyDll},
- { "CTPKG", EPolyDll},
- { "FSY", EPolyDll},
- { "LDD", EPolyDll},
- { "ECOMIIC", EPolyDll},
- { "PLUGIN", EPolyDll},
- { "PLUGIN3", EPolyDll},
- { "KDLL", EPolyDll},
- { "KEXT", EPolyDll},
- { "MDA", EPolyDll},
- { "MDl", EPolyDll},
- { "RDL", EPolyDll},
- { "NOTIFIER", EPolyDll},
- { "NOTIFIER2", EPolyDll},
- { "TEXTNOTIFIER2", EPolyDll},
- { "PDD", EPolyDll},
- { "PDL", EPolyDll},
- { "VAR", EPolyDll},
- { "VAR2", EPolyDll},
- { "EXEXP", EExexp},
- { "STDEXE", EStdExe},
- { "STDDLL", EDll},
- { 0, EInvalidTargetType }
-};
-
-/**
-Function to check if the given target type is a valid one from the list.
-
-@internalComponent
-@released
-
-@param aArg
-Value to be checked, the one that is passed to '--targettype'.
-@return True if the provided value is a valid targettype.
-*/
-static ETargetType IsDefaultTargetType(const char * aArg)
-{
- for (int i = 0; DefaultTargetTypes[i].iName; i++)
- {
- if (aArg && !stricmp(aArg, DefaultTargetTypes[i].iName))
- return DefaultTargetTypes[i].iTargetType;
- }
- return EInvalidTargetType;
-}
-
-/**
-Function to check if the given target type is a valid one from the list. If no value is
-passed or if unsupported targettypes are passed, then the appropriate warnings are displayed.
-
-@internalComponent
-@released
-
-@param aArg
-Value to be checked, the one that is passed to '--targettype'.
-@return the appropriate matching value from the list.
-*/
-ETargetType ParameterManager::ValidateTargetType(const char * aArg)
-{
- ETargetType res = IsDefaultTargetType(aArg);
- if (res == EInvalidTargetType)
- {
- if (aArg)
- MessageHandler::GetInstance()->ReportMessage(WARNING, UNSUPPORTEDTARGETTYPEERROR,aArg);
- else
- MessageHandler::GetInstance()->ReportMessage(WARNING, TARGETTYPENOTSPECIFIEDERROR);
- }
- return res;
-}
-
-/**
-This function set the target type that is passed through --targettype option.
-
-void ParameterManager::ParseTargetTypeName(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --targettype
-@param aValue
-The target type passed to --targettype option
-@param aDesc
-Pointer to function ParameterManager::ParseTargetTypeName returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseTargetTypeName)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetTargetTypeName(aPM->ValidateTargetType(aValue));
-}
-
-/**
-This function set the output DSO file name that is passed through --dso option.
-
-void ParameterManager::ParseDSOOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --dso
-@param aValue
-The DSO file name passed to --dso option
-@param aDesc
-Pointer to function ParameterManager::ParseDSOOutput returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseDSOOutput)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetDSOOutput(aValue);
-}
-
-/**
-This function displays the usage information if --help option is passed in.
-For invalid option, this function displays the usage information and throws the
-appropriate error message.
-
-void ParameterManager::ParamHelp(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --help or -h
-@param aValue
-The value passed to --help option, in this case, no value, hence 0.
-@param aDesc
-Pointer to function ParameterManager::ParamHelp returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParamHelp)
-{
- INITIALISE_PARAM_PARSER;
- using std::cerr;
- using std::endl;
-
- cerr << "\nSymbian Post Linker, " << "Elf2E32"
- << " V" << MajorVersion << "." << MinorVersion << " (Build "<<Build <<")"
- << endl;
-
- cerr << "Usage:\t" << "elf2e32" << " [options] [filename]\n" << endl;
-
- cerr << "Options:\n" ;
-
- const OptionDesc * aHelpDesc = aPM->iOptionMap["help"];
- int lim = aPM->NumOptions();
- for (int i = 0; i < lim; i++)
- {
- if (aPM->iOptions[i].iName == aHelpDesc->iName)
- {
- cerr << '\t' << aPM->iParamPrefix << aPM->iOptions[i].iName
- << " : This command." << endl;
- }
- else
- {
- cerr << '\t' << aPM->iParamPrefix << aPM->iOptions[i].iName;
- if (aPM->iOptions[i].iDoc) cerr << aPM->iParamEquals << aPM->iOptions[i].iDoc;
- cerr << endl;
- }
- }
-
- if (!aDesc)
- exit(EXIT_FAILURE);
- else
- exit(EXIT_SUCCESS);
-}
-
-/**
-This function set the LibPath that is passed through --libpath option.
-
-void ParameterManager::ParseLibPath(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --libpath
-@param aValue
-The LibPath value passed to --libpath option.
-@param aDesc
-Pointer to function ParameterManager::ParseLibPath returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseLibPaths)
-{
- INITIALISE_PARAM_PARSER;
- if (!aValue)
- throw ParameterParserError(NOARGUMENTERROR, "--libpath");
- string aPathList(aValue);
- const char* p = aPathList.c_str();
- int n = strlen(p);
- int q = 0;
- while (n)
- {
- int nq = aPathList.find_first_of(";", q, sizeof(*p));
- if (nq > 0)
- {
- // handle case where there are multiple paths which are ; separated
- int len = nq - q;
- if (p[len-1] == aPM->DirectorySeparator()) len--;
- char * path = new char[len+1];
- memcpy(path, p+q, len);
- path[len] = 0;
- aPM->iLibPathList.push_back(path);
- n -= nq - q + 1;
- q = nq+1;
- }
- else
- {
- p += q;
- int len = strlen(p);
- if (p[len-1] == aPM->DirectorySeparator()) len--;
- char * path = new char[len+1];
- memcpy(path, p, len);
- path[len] = 0;
- aPM->iLibPathList.push_back(path);
- break;
- }
- }
-}
-
-/**
-This function sets the linkas dll name when --linkas option is passed in.
-
-void ParameterManager::ParseLinkAs(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --linkas
-@param aValue
-The DLL name to be linked with passed through --linkas option
-@param aDesc
-Pointer to function ParameterManager::ParseLinkAs returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseLinkAs)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetLinkDLLName(aValue);
-}
-
-/**
-This function set the sub options that are passed through --dump option.
-
-void ParameterManager::ParseFileDump(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
-
-@internalComponent
-@released
-
-@param aPM
-Pointer to the ParameterManager
-@param aOption
-Option that is passed as input, in this case --dump
-@param aValue
-The FileDump suboptions passed to --dump option.
-@param aDesc
-Pointer to function ParameterManager::ParseFileDump returning void.
-*/
-DEFINE_PARAM_PARSER(ParameterManager::ParseFileDump)
-{
- INITIALISE_PARAM_PARSER;
- aPM->SetFileDumpOptions(aValue);
-}
-
-/**
-This function sets the target type that is passed as input through the --targettype option
-and sets the flag if --targettype option is passed in.
-
-@internalComponent
-@released
-
-@param aTargetTypeVal
-Name of the input target type if provided as input through --targettype or 0.
-*/
-void ParameterManager::SetTargetTypeName(ETargetType aTargetTypeVal)
-{
- iTargetTypeOption = true;
- iTargetTypeName = aTargetTypeVal;
-}
-
-/**
-This function sets the DEF file name that is passed as input through the --definput option and
-sets the flag if --definput option is passed in.
-
-@internalComponent
-@released
-
-@param aDefInputVal
-Name of the input DEF file if provided as input through --definput or 0.
-*/
-void ParameterManager::SetDefInput(char * aDefInputVal)
-{
- iDefFileInOption = true;
- iDefInput = aDefInputVal;
-}
-
-/**
-This function sets the DSO file name that is passed as input through the --dso option
-and sets the flag if the --dso option is passed in.
-
-@internalComponent
-@released
-
-@param aDSOOutputVal
-Name of the output DSO file if provided as input through --dso or 0.
-*/
-void ParameterManager::SetDSOOutput(char * aDSOOutputVal)
-{
- iDSOFileOutOption = true;
- iDSOOutput = aDSOOutputVal;
-}
-
-/**
-This function sets the Elf file name that is passed as input through the --dsoin option.
-
-@internalComponent
-@released
-
-@param aSetElfInput
-Name of the input Elf file if provided as input through --dsoin or 0.
-*/
-void ParameterManager::SetElfInput(char * aElfInputVal)
-{
- iElfFileInOption = true;
- iElfInput = aElfInputVal;
-}
-
-/**
-This function sets the E32 name that is passed as input through the --e32dump option.
-
-@internalComponent
-@released
-
-@param aSetE32Input
-Name of the input E32 image if provided as input through --e32dump or 0.
-*/
-void ParameterManager::SetE32Input(char * aSetE32Input)
-{
- iE32ImageInOption = true;
- iE32Input = aSetE32Input;
-}
-
-/**
-This function sets the E32 dump options that is passed as input through the --dump option.
-
-@internalComponent
-@released
-
-@param aSetFileDumpOptions
-Dump sub options passed to --dump option
-*/
-void ParameterManager::SetFileDumpOptions(char * aSetFileDumpOptions)
-{
- iFileDumpOption = true;
- iFileDumpSubOptions = aSetFileDumpOptions;
-
- if (aSetFileDumpOptions)
- {
- iDumpOptions=0;
- while (char c = *(aSetFileDumpOptions++))
- {
- if (c < 'a')
- c += 'a'-'A';
- switch(c)
- {
- case 'h': iDumpOptions |= EDumpHeader; break;
- case 's': iDumpOptions |= EDumpSecurityInfo; break;
- case 'c': iDumpOptions |= EDumpCode; break;
- case 'd': iDumpOptions |= EDumpData; break;
- case 'e': iDumpOptions |= EDumpExports; break;
- case 'i': iDumpOptions |= EDumpImports; break;
- case 'a': iDumpOptions |= EDumpAsm; break; //Dump the Assembler code
- case 't': iDumpOptions |= EDumpSymbols;break;
- default:
- iDumpOptions=0;
- return;
- }
- }
- }
-}
-
-/**
-This function extracts the E32 image output that is passed as input through the --output option.
-
-@internalComponent
-@released
-
-@param aSetE32Output
-Name of the output E32 image output if provided as input through --output or 0.
-*/
-void ParameterManager::SetE32Output(char * aSetE32Output)
-{
- iOutFileOption = true;
- iOutFileName = aSetE32Output;
-}
-
-/**
-This function sets the output DEF file name that is passed as input through the --defoutput option.
-
-@internalComponent
-@released
-
-@param aSetDefOutput
-Name of the output DEF file if provided as input through --defoutput or 0.
-*/
-void ParameterManager::SetDefOutput(char * aSetDefOutput)
-{
- iDefFileOutOption = true;
- iDefOutput = aSetDefOutput;
-}
-
-/**
-This function sets the name of the DLL (that the DSO is to be linked with) that is passed
-as input through the --linkas option and sets the flag if the --linkas option is passed in.
-
-@internalComponent
-@released
-
-@param aSetLinkDLLName
-The DLL name with which the DSO is to be linked with
-*/
-void ParameterManager::SetLinkDLLName(char * aSetLinkDLLName)
-{
- iLinkAsOption = true;
- iLinkDLLName = aSetLinkDLLName;
-}
-
-/**
-This function sets the priority value.
-
-@internalComponent
-@released
-
-@param anewVal
-priority value passed in to --priority option.
-*/
-void ParameterManager::SetPriority(TProcessPriority anewVal)
-{
- iPriorityOption = true;
- iPriorityVal = anewVal;
-}
-
-/**
-This function sets the capability value.
-
-@internalComponent
-@released
-
-@param anewVal
-Capability value passed in to --capability option.
-*/
-void ParameterManager::SetCapability(unsigned int anewVal)
-{
- iCapability[0] = anewVal;
-}
-
-/**
-This function sets the capability value.
-
-@internalComponent
-@released
-
-@param anewVal
-Capability value passed in to --capability option.
-*/
-void ParameterManager::SetCapability(SCapabilitySet & anewVal)
-{
- iCapability = anewVal;
-}
-
-/**
-This function sets the list of predefined symbols passed to --sysdef option.
-
-@internalComponent
-@released
-
-@param aOrdinalnum
-Ordinal number of the predefined symbols
-@param aSymbol
-Symbol Name
-@param aCount
-Position of the predefined symbol
-*/
-void ParameterManager::SetSysDefs(unsigned int aOrdinalnum, char* aSymbol, int aCount)
-{
- iSysDefOption = 1;
- iSysDefSymbols[aCount].iSysDefOrdinalNum = aOrdinalnum;
- iSysDefSymbols[aCount].iSysDefSymbolName = aSymbol;
- iSysDefCount = (aCount+1);
-}
-
-/**
-This function sets the output LOG file name that is passed as input through the --log option.
-
-@internalComponent
-@released
-
-@param aSetLogFile
-Name of the output LOG file if provided as input through --log or 0.
-*/
-void ParameterManager::SetLogFile(char * aSetLogFile)
-{
- iLogFileOption = true;
- iLogFileName = aSetLogFile;
-}
-
-/**
-This function sets the Message file name that is passed as input through the --messagefile option.
-
-@internalComponent
-@released
-
-@param aMessageFile
-Name of the Message file if provided as input through --messagefile or 0.
-*/
-void ParameterManager::SetMessageFile(char * aMessageFile)
-{
- iMessageFileOption = true;
- iMessageFileName = aMessageFile;
-}
-
-/**
-This function sets the Message file name that is passed as input through the --dumpmessagefile option.
-
-@internalComponent
-@released
-
-@param aDumpMessageFile
-Name of the Message file to be dumped if provided as input through --dumpmessagefile or 0.
-*/
-void ParameterManager::SetDumpMessageFile(char * aDumpMessageFile)
-{
- iDumpMessageFileOption = true;
- iDumpMessageFileName = aDumpMessageFile;
-}
-
-/**
-This function sets iFixedAddress if --fixedaddress is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --fixedaddress is passed in.
-*/
-void ParameterManager::SetFixedAddress(bool aSetFixedAddress)
-{
- iFixedAddress = aSetFixedAddress;
-}
-
-/**
-This function sets iCompress if --uncompressed is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --uncompressed is passed in.
-*/
-void ParameterManager::SetCompress(bool aSetCompress)
-{
- iCompress = aSetCompress;
-}
-
-/**
-This function sets iCompress if --uncompressed is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --uncompressed is passed in.
-*/
-void ParameterManager::SetCompressionMethod(UINT aCompressionMethod)
-{
-
- iCompressionMethod = aCompressionMethod;
-}
-
-
-/**
-This function sets iCallEntryPoint if --callentry is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --callentry is passed in.
-*/
-void ParameterManager::SetCallEntryPoint(bool aSetCallEntryPoint)
-{
- iCallEntryPoint = aSetCallEntryPoint;
-}
-
-/**
-This function sets the Version information passed to '--version' option.
-
-@internalComponent
-@released
-
-@param aVersion information
-Version information passed to '--version' option.
-*/
-void ParameterManager::SetVersion(UINT aSetVersion)
-{
- iVersionOption = true;
- iVersion = aSetVersion;
-}
-
-/**
-This function sets the UID1 passed to '--uid1' option.
-
-@internalComponent
-@released
-
-@param aUID1
-UID1 passed to '--uid1' option.
-*/
-void ParameterManager::SetUID1(UINT aUID1)
-{
- iUid1Option = true;
- iUID1 = aUID1;
-}
-
-/**
-This function sets the UID2 passed to '--uid2' option.
-
-@internalComponent
-@released
-
-@param aUID2
-UID2passed to '--uid2' option.
-*/
-void ParameterManager::SetUID2(UINT aUID2)
-{
- iUID2 = aUID2;
-}
-
-/**
-This function sets the UID3 passed to '--uid3' option.
-
-@internalComponent
-@released
-
-@param aUID3
-UID3 passed to '--uid3' option.
-*/
-void ParameterManager::SetUID3(UINT aUID3)
-{
- iUID3 = aUID3;
-}
-
-/**
-This function sets the Secure ID passed to '--sid' option.
-
-@internalComponent
-@released
-
-@param aSetSecureID
-Secure ID passed to '--sid' option.
-*/
-void ParameterManager::SetSecureId(UINT aSetSecureID)
-{
- iSecureIDOption = true;
- iSecureID = aSetSecureID;
-}
-
-/**
-This function sets the Vendor ID passed to '--vid' option.
-
-@internalComponent
-@released
-
-@param aSetVendorID
-Vendor ID passed to '--vid' option.
-*/
-void ParameterManager::SetVendorId(UINT aSetVendorID)
-{
- iVendorIDOption = true;
- iVendorID = aSetVendorID;
-}
-
-/**
-This function sets the heap committed size passed to '--heap' option.
-
-@internalComponent
-@released
-
-@param aSetHeapCommittedSize
-stack committed size passed to '--heap' option.
-*/
-void ParameterManager::SetHeapCommittedSize(UINT aSetHeapCommittedSize)
-{
- iHeapCommittedSize = aSetHeapCommittedSize;
-}
-
-/**
-This function sets the heap reserver size passed to '--heap' option.
-
-@internalComponent
-@released
-
-@param aSetStackReservedSize
-stack reserved size passed to '--heap' option.
-*/
-void ParameterManager::SetHeapReservedSize(UINT aSetHeapReservedSize)
-{
- iHeapReservedSize = aSetHeapReservedSize;
-}
-
-/**
-This function sets the stack committed size passed to '--stack' option.
-
-@internalComponent
-@released
-
-@param aSetStackCommittedSize
-stack committed size passed to '--stack' option.
-*/
-void ParameterManager::SetStackCommittedSize(UINT aSetStackCommittedSize)
-{
- iStackCommittedSize = aSetStackCommittedSize;
-}
-
-/**
-This function sets iUnfrozen if --unfrozen is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --unfrozen is passed in.
-*/
-void ParameterManager::SetUnfrozen(bool aVal)
-{
- iUnfrozen = aVal;
-}
-
-/**
-This function sets iIgnoreNonCallable if --ignorenoncallable is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --ignorenoncallable is passed in.
-*/
-void ParameterManager::SetIgnoreNonCallable(bool aVal)
-{
- iIgnoreNonCallable = aVal;
-}
-
-/**
-This function sets iDllDataP if --dlldata is passed in.
-
-@internalComponent
-@released
-
-@param anewVal
-True if --dlldata is passed in.
-*/
-void ParameterManager::SetDllDataP(bool anewVal)
-{
- iDllDataP = anewVal;
-}
-
-/**
-This function sets the FPU type based on the parsed '--fpu' option.
-
-@internalComponent
-@released
-
-@param aSetVendorID
-FPU type passed to the '--fpu' option.
-*/
-void ParameterManager::SetFPU(UINT aFPU)
-{
- iFPUOption = true;
- iFPU = aFPU;
-}
-
-
-void ParameterManager::SetCodePaged(bool anewVal)
-{
- iCodePaged = anewVal;
-}
-
-void ParameterManager::SetCodeUnpaged(bool anewVal)
-{
- iCodeUnpaged = anewVal;
-}
-
-void ParameterManager::SetCodeDefaultPaged(bool anewVal)
-{
- iCodeDefaultPaged = anewVal;
-}
-
-void ParameterManager::SetDataPaged(bool anewVal)
-{
- iDataPaged = anewVal;
-}
-
-void ParameterManager::SetDataUnpaged(bool anewVal)
-{
- iDataUnpaged = anewVal;
-}
-
-void ParameterManager::SetDataDefaultPaged(bool anewVal)
-{
- iDataDefaultPaged = anewVal;
-}
-
-void ParameterManager::SetSymNamedLookup(bool aVal)
-{
- iSymNamedLookup = aVal;
-}
-
-/**
-This function sets iExcludeUnwantedExports if --excludeunwantedexports is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --excludeunwantedexports is passed in.
-*/
-void ParameterManager::SetExcludeUnwantedExports(bool aVal)
-{
- iExcludeUnwantedExports = aVal;
-}
-
-/**
-This function sets iIsCustomDllTarget if --customdlltarget is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --customdlltarget is passed in.
-*/
-void ParameterManager::SetCustomDllTarget(bool aVal)
-{
- iCustomDllTarget = aVal;
-}
-
-/**
-This function sets iDebuggable if --debuggable is passed in.
-
-@internalComponent
-@released
-
-@param aVal
-True if --debuggable is passed in.
-*/
-void ParameterManager::SetDebuggable(bool aVal)
-{
- iDebuggable = aVal;
-}
-
-
-void ParameterManager::SetSmpSafe(bool aVal)
-{
- iSmpSafe = aVal;
-}
--- a/toolsandutils/e32tools/elf2e32/source/parametermanager.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class ParameterManager of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(SYMBIAN_PARAMETERMANAGER_H_)
-#define SYMBIAN_PARAMETERMANAGER_H_
-
-#include "parameterlistinterface.h"
-#include <vector>
-#include <map>
-#include <string>
-
-class UseCaseBase;
-class Symbol;
-
-
-
-/**
-This class is derived from ParameterListInterface (the abstract base class).
-
-@internalComponent
-@released
-*/
-class ParameterManager : public ParameterListInterface
-{
-
-public:
-
- typedef std::vector<char *> ParamList;
-
- struct OptionDesc
- {
- char * iName;
- const void * iParser;
- char * iDoc;
- };
-
- struct TargetTypeDesc
- {
- const char * iName;
- ETargetType iTargetType;
- };
-
- struct PriorityValueDesc
- {
- const char * iName;
- TProcessPriority iPriority;
- };
-
- struct CompressionMethodDesc
- {
- const char *iMethodName;
- UINT iMethodUid;
- };
-
- /*struct SysDefs
- {
- int iSysDefOrdinalNum;
- char * iSysDefSymbolName;
- };
-
- typedef struct SysDefs Sys;*/
-
- typedef std::string string;
- typedef std::less<string> OptionCompare;
- typedef std::map<string, const OptionDesc *, OptionCompare> OptionMap;
- typedef vector<char *> LibSearchPaths;
-
- typedef void (*ParserFn)(ParameterManager *, char *, char *, const OptionDesc *);
-
-
- #define DECLARE_PARAM_PARSER(name) \
- static void name(ParameterManager* aPM, char* aOption, char* aValue, void* aDesc)
-
- #define DEFINE_PARAM_PARSER(name) \
- void name(ParameterManager * aPM, char * aOption, char* aValue, void * aDesc)
-
- #define INITIALISE_PARAM_PARSER \
- aOption = aOption; \
- aValue = aValue; \
- aDesc = aDesc;
-
- DECLARE_PARAM_PARSER(ParseDefInput);
- DECLARE_PARAM_PARSER(ParseDSOOutput);
- DECLARE_PARAM_PARSER(ParseTargetTypeName);
- DECLARE_PARAM_PARSER(ParseLinkAs);
- DECLARE_PARAM_PARSER(ParseDefOutput);
- DECLARE_PARAM_PARSER(ParseElfInput);
- DECLARE_PARAM_PARSER(ParseFileDump);
- DECLARE_PARAM_PARSER(ParseE32ImageInput);
- DECLARE_PARAM_PARSER(ParseOutput);
- DECLARE_PARAM_PARSER(ParseLogFile);
- DECLARE_PARAM_PARSER(ParseMessageFile);
- DECLARE_PARAM_PARSER(ParseDumpMessageFile);
-
- DECLARE_PARAM_PARSER(ParamHelp);
- DECLARE_PARAM_PARSER(ParseUID1);
- DECLARE_PARAM_PARSER(ParseUID2);
- DECLARE_PARAM_PARSER(ParseUID3);
-
-
- DECLARE_PARAM_PARSER(ParseCapability);
- DECLARE_PARAM_PARSER(ParseSecureId);
- DECLARE_PARAM_PARSER(ParseVendorId);
- DECLARE_PARAM_PARSER(ParseFixedAddress);
- DECLARE_PARAM_PARSER(ParseUncompressed);
- DECLARE_PARAM_PARSER(ParseCompressionMethod);
- DECLARE_PARAM_PARSER(ParseHeap);
- DECLARE_PARAM_PARSER(ParseStackCommitted);
- DECLARE_PARAM_PARSER(ParseUnfrozen);
- DECLARE_PARAM_PARSER(ParseIgnoreNonCallable);
- DECLARE_PARAM_PARSER(ParseLibPaths);
- DECLARE_PARAM_PARSER(ParseSysDefs);
- DECLARE_PARAM_PARSER(ParseAllowDllData);
- DECLARE_PARAM_PARSER(ParsePriority);
- DECLARE_PARAM_PARSER(ParseVersion);
- DECLARE_PARAM_PARSER(ParseCallEntryPoint);
- DECLARE_PARAM_PARSER(ParseFPU);
-
- DECLARE_PARAM_PARSER(ParsePaged);
- DECLARE_PARAM_PARSER(ParseUnpaged);
- DECLARE_PARAM_PARSER(ParseDefaultPaged);
-
- DECLARE_PARAM_PARSER(ParseCodePaging);
- DECLARE_PARAM_PARSER(ParseDataPaging);
-
- DECLARE_PARAM_PARSER(ParseExcludeUnwantedExports);
- DECLARE_PARAM_PARSER(ParseIsCustomDllTarget);
- DECLARE_PARAM_PARSER(ParseSymNamedLookup);
- DECLARE_PARAM_PARSER(ParseDebuggable);
- DECLARE_PARAM_PARSER(ParseSmpSafe);
-
- ParameterManager(int aArgc, char** aArgv);
- virtual ~ParameterManager();
- void ParameterAnalyser();
- void SetDefInput(char * aDefInputVal);
- void SetDSOOutput(char * aDSOOutputVal);
- void SetElfInput(char * aSetElfInput);
- void SetE32Input(char * aSetE32Input);
- void SetFileDumpOptions(char * aSetE32DumpOptions);
- void SetE32Output(char * aSetE32Output);
- void SetDefOutput(char * aSetDefOutput);
- void SetTargetTypeName(ETargetType aSetTargetTypeName);
- void SetLinkDLLName(char * aSetLinkDLLName);
- void SetUID1(UINT aSetUINT1);
- void SetUID2(UINT aSetUINT2);
- void SetUID3(UINT aSetUINT3);
- void SetFixedAddress(bool aSetFixedAddress);
- void SetCompress(bool aSetCompress);
- void SetCompressionMethod(UINT aCompressionMethod);
- void SetSecureId(UINT aSetSecureID);
- void SetVendorId(UINT aSetVendorID);
- void SetHeapCommittedSize(UINT aSetHeapCommittedSize);
- void SetHeapReservedSize(UINT aSetHeapReservedSize);
- void SetStackCommittedSize(UINT aSetStackCommittedSize);
- void SetUnfrozen(bool aVal);
- void SetIgnoreNonCallable(bool aVal);
- void SetCapability(unsigned int newVal);
- void SetCapability(SCapabilitySet & newVal);
- void SetSysDefs(unsigned int aSysDefOrdinal, char * aSysDefSymbol, int aCount);
- void SetLogFile(char * aSetLogFile);
- void SetMessageFile(char *aMessageFile);
- void SetDumpMessageFile(char *aDumpMessageFile);
- void SetDllDataP(bool newVal);
- void SetPriority(TProcessPriority anewVal);
- void SetVersion(UINT aSetVersion);
- void SetCallEntryPoint(bool aCallEntryPoint);
- void SetFPU(UINT aVal);
-
- void SetCodePaged(bool);
- void SetCodeUnpaged(bool);
- void SetCodeDefaultPaged(bool);
-
- void SetDataPaged(bool);
- void SetDataUnpaged(bool);
- void SetDataDefaultPaged(bool);
-
- void SetExcludeUnwantedExports(bool aVal);
- void SetCustomDllTarget(bool aVal);
- void SetSymNamedLookup(bool aVal);
- void SetDebuggable(bool aVal);
- void SetSmpSafe(bool aVal);
-
- int NumOptions();
- int NumShortOptions();
- void InitParamParser();
- void ParseCommandLine();
- void RecordImageLocation();
- char * Path(char * aArg);
- ETargetType TargetTypeName();
- ETargetType ValidateTargetType(const char * aTargetType);
- LibSearchPaths& LibPath();
- char * DefInput();
- char * ElfInput();
- char * E32Input();
- bool DefFileInOption();
- bool DefFileOutOption();
- bool ElfFileInOption();
- bool E32ImageInOption();
- bool FileDumpOption();
- bool DSOFileOutOption();
- bool E32OutOption();
- bool LinkAsOption();
- bool Uid1Option();
- bool SecureIdOption();
- bool VendorIdOption();
- bool SysDefOption();
- bool LogFileOption();
- bool MessageFileOption();
- bool DumpMessageFileOption();
- bool DllDataP();
- TProcessPriority Priority();
- bool PriorityOption();
- bool VersionOption();
- bool CallEntryPoint();
- bool FPUOption();
-
- char * DefOutput();
- char * DSOOutput();
- char * E32ImageOutput();
- char * LinkAsDLLName();
- char * FileName(char * aArg);
- char * LogFile();
- char * MessageFile();
- char * DumpMessageFile();
- char * FileDumpOptions();
- char * FileDumpSubOptions();
- int DumpOptions();
- int SysDefCount();
- char DirectorySeparator();
- //int SysDefOrdinalNum();
- //char * SysDefSymbol();
- Sys SysDefSymbols(int count);
- UINT Uid1();
- UINT Uid2();
- UINT Uid3();
- UINT SecureId();
- UINT VendorId();
- UINT Version();
- bool FixedAddress();
- bool Compress();
- UINT CompressionMethod();
- size_t HeapCommittedSize();
- size_t HeapReservedSize();
- size_t StackCommittedSize();
- bool Unfrozen();
- bool IgnoreNonCallable();
- UseCaseBase * SelectUseCase();
- SCapabilitySet Capability();
- void ParseCapability1(const char * name, const char * end, SCapabilitySet& aCapabilities, bool invert);
- void ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText);
- UINT FPU();
-
- bool IsCodePaged();
- bool IsCodeUnpaged();
- bool IsCodeDefaultPaged();
-
- bool IsDataPaged();
- bool IsDataUnpaged();
- bool IsDataDefaultPaged();
-
- bool ExcludeUnwantedExports();
- bool IsCustomDllTarget();
- bool SymNamedLookup();
- bool IsDebuggable();
- bool IsSmpSafe();
-
-private:
- /** The number of command line arguments passed into the program */
- int iArgc;
-
- /** The listing of all the arguments */
- char ** iArgv;
-
- /** REVISIT */
- char * iImageLocation;
-
- /** REVISIT */
- char * iImageName;
-
- /** To check if the --targettypeoption (Option to pass the target type of the final image) is provided */
- bool iTargetTypeOption;
-
- /** To check if the --definput (Option to pass the input DEF File) is passed as input */
- bool iDefFileInOption;
-
- /** To check if the --defoutput (Option to pass the output DEF File name) is passed as input */
- bool iDefFileOutOption;
-
- /** To check if the --dump is passed as input */
- bool iFileDumpOption;
-
- /** To check if the --dso (Option to pass the output DSO File name) is passed as input */
- bool iDSOFileOutOption;
-
- /** To check if the --output (Option to pass the output image name) is passed as input */
- bool iOutFileOption;
-
- /** To check if the --elfinput (Option to pass the input Elf File) is passed as input */
- bool iElfFileInOption;
-
- /** To check if the --e32input (Option to pass the input E32 File) is passed as input */
- bool iE32ImageInOption;
-
- /** To check if the --linkas (Option to pass DLL name to be linked with) is passed as input */
- bool iLinkAsOption;
-
- bool iUid1Option;
- bool iSecureIDOption;
- bool iVendorIDOption;
-
- /** System level identifier, identifies the general type of a Symbian OS object */
- UINT iUID1;
-
- /** Interface identifier, distinguishes within a type (i.e.within a UID1) */
- UINT iUID2;
-
- /** Project identifier, identifies a particular subtype */
- UINT iUID3;
-
- UINT iSecureID;
-
- UINT iVendorID;
-
- bool iCompress;
- UINT iCompressionMethod;
-
- bool iFixedAddress;
-
- size_t iHeapCommittedSize;
- size_t iHeapReservedSize;
- size_t iStackCommittedSize;
- bool iUnfrozen;
- bool iIgnoreNonCallable;
-
-
- /** List of the parameters */
- ParamList iParamList;
-
- /** The short prefix '-' used for the command line options for the program */
- static const char * iParamShortPrefix;
-
- /** The normal prefix '--' used for the command line options for the program */
- static const char * iParamPrefix;
-
- /** The '=' used for passing the arguments to the command line options for the program */
- static const char iParamEquals;
-
- /** The list of command line options (with normal prefix '--') that will be accepted by the program */
- static const OptionDesc iOptions[];
-
- /** The list of command line options (with short prefix '-') that will be accepted by the program */
- static const OptionDesc iShortOptions[];
-
- /** The map between the command line option (with normal prefix '--') and the corresponding function */
- OptionMap iOptionMap;
-
- /** The map between the command line option (with short prefix '-') and the corresponding function */
- OptionMap iShortOptionMap;
-
- /** The usecase that is selected, could either be LibraryTarget or DLLTarget or EXETarget */
- UseCaseBase *iUseCase;
-
- /** Target Type that is passed as input to the --targettype option */
- ETargetType iTargetTypeName;
-
- /** File name of the output DEF file passed as input to the --defoutput option */
- char * iDefOutput;
-
- /** File name of the output DSO file passed as input to the --dso option */
- char * iDSOOutput;
-
- /** File name of the output image passed as input to the --output option */
- char * iOutFileName;
-
- /** File name of the input DEF file passed as input to the --definput option */
- char * iDefInput;
-
- /** File name of the input DSO file passed as input to the --dsoin option */
- char * iElfInput;
-
- /** File name of the input E32 image passed as input to the --e32dump option */
- char * iE32Input;
-
- /** File name of the DLL to be linked with passed as input to the --linkas option */
- char * iLinkDLLName;
-
- /** Path name of the intermediate libraries passed as input to the --libpath option */
- char * iLibPath;
-
- int iDumpOptions;
- char *iFileDumpSubOptions;
-
- bool iSysDefOption;
- char * iLogFileName;
- bool iLogFileOption;
- char * iMessageFileName;
- bool iMessageFileOption;
- char * iDumpMessageFileName;
- bool iDumpMessageFileOption;
-
- bool iDllDataP;
-
- //vector<char*> iLibPathList;
- LibSearchPaths iLibPathList;
- SCapabilitySet iCapability;
- //struct SysDefs iSysDefSymbols[10];
- Sys iSysDefSymbols[10];
- int iSysDefCount;
- bool iPriorityOption;
- TProcessPriority iPriorityVal;
- UINT iVersion;
- bool iVersionOption;
- bool iCallEntryPoint;
- UINT iFPU;
- bool iFPUOption;
-
- int iArgumentCount;
-
- bool iCodePaged;
- bool iCodeUnpaged;
- bool iCodeDefaultPaged;
-
- bool iDataPaged;
- bool iDataUnpaged;
- bool iDataDefaultPaged;
-
- bool iExcludeUnwantedExports;
- bool iCustomDllTarget;
- bool iSymNamedLookup;
- bool iDebuggable;
- bool iSmpSafe;
-};
-
-
-#endif // !defined(SYMBIAN_PARAMETERMANAGER_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_common.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class SymbolAttrib for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include <tools/elfdefs.h>
-#include "pl_common.h"
-
-
-VersionInfo::VersionInfo(): iSOName(0), iLinkAs(0), iVerCategory(VER_CAT_NONE)
-{}
-
-VersionInfo::~VersionInfo()
-{}
-
-/**
-hash function for ELF symbols
-@param name
-@internalComponent
-@released
-*/
-unsigned long Util::elf_hash(const unsigned char *name)
-{
- unsigned long h, g;
- for (h = 0; *name != 0; ++name)
- {
- h = (h << 4) + *name;
- g = h & 0xf0000000;
- if (g != 0) h ^= g >> 24;
- h &= ~g;
- }
- return h;
-}
--- a/toolsandutils/e32tools/elf2e32/source/pl_common.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class SymbolAttrib for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined _PL_COMMON_H_
-#define _PL_COMMON_H_
-
-#ifdef _MSC_VER
- #pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
- #pragma warning(disable: 4514) // unreferenced inline function has been removed
- #pragma warning(disable: 4702) // unreachable code
- #pragma warning(disable: 4710) // function not inlined
-#endif
-
-#include <tools/elfdefs.h>
-
-typedef unsigned long PLULONG;
-typedef unsigned int PLUINT32;
-typedef unsigned short PLUINT16;
-typedef unsigned char PLUCHAR;
-typedef int PLINT32;
-typedef short PLINT16;
-typedef unsigned char PLUINT8;
-typedef char PLCHAR;
-typedef unsigned int PLMemAddr32;
-typedef unsigned int PLOffset32;
-typedef unsigned short PLOffset16;
-
-#define DELETE_PTR(aPtr) delete aPtr; aPtr = NULL;
-#define DELETE_PTR_ARRAY(aPtr) delete[] aPtr; aPtr = NULL;
-
-#define ELF_ENTRY_PTR(ptype, base, offset) \
- ((ptype*)((char*)base + offset))
-
-//enum for version category
-enum VER_CATEGORY{
- VER_CAT_NONE = 0,
- VER_CAT_DEFINED,
- VER_CAT_NEEDED
-
-};
-
-/**
-Class for general utility
-@internalComponent
-@released
-*/class Util {
-public:
- static unsigned long elf_hash(const unsigned char *name);
-};
-
-/**
-class for Version info
-@internalComponent
-@released
-*/
-class VersionInfo {
-public:
- VersionInfo();
- ~VersionInfo();
-
- char* iSOName;
- char* iLinkAs;
- char iVerCategory;
-};
-
-//enum for e32 dump flag and dumping asm file flag
-enum TDumpFlags
-{
- EDumpHeader = 1<<0,
- EDumpSecurityInfo = 1<<1,
- EDumpCode = 1<<2,
- EDumpData = 1<<3,
- EDumpExports = 1<<4,
- EDumpImports = 1<<5,
- EDumpAsm = 1<<6, //Added (Only)option for generating assembly code for deffile input.//DumpAsm
- EDumpSymbols = 1<<7,//Not added as a default option.
- EDumpDefaults = EDumpHeader|EDumpCode|EDumpData|EDumpExports|EDumpImports
-};
-
-#endif //_PL_COMMON_H_
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_dllsymbol.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DllSymbol for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_dllsymbol.h"
-
-
-/**
-Constructor for class DllSymbol
-@param aName - symbol name
-@param aType - symbol type
-@param aElfSym - elf symbol
-@param aSymbolIndex - index in the symbol table
-@internalComponent
-@released
-*/
-DllSymbol::DllSymbol(char* aName, SymbolType aType, Elf32_Sym* aElfSym, \
- PLUINT32 aSymbolIndex): Symbol(aName, aType), iElfSym(aElfSym), iSymbolIndex(aSymbolIndex)
-{
-}
-
-/**
-Constructor for class DllSymbol
-@param aSymbol - symbol name
-@param aType - symbol type
-@param aAbsent - flag if the symbol is marked absent
-@internalComponent
-@released
-*/
-DllSymbol::DllSymbol(Symbol* aSymbol, SymbolType aType, bool aAbsent): Symbol(*aSymbol, aType, aAbsent), iElfSym(NULL), iSymbolIndex(0)
-{
-}
-
-/**
-Destructor for class DllSymbol
-@internalComponent
-@released
-*/
-DllSymbol::~DllSymbol(){
-
-}
-
-
-
-
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_dllsymbol.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DllSymbol for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_DLLSYMBOL_H_)
-#define _PL_DLLSYMBOL_H_
-
-#include <tools/elfdefs.h>
-#include "pl_symbol.h"
-
-/**
-The class DLLSymbol properties for both imported and exported symbols.
-@internalComponent
-@released
-*/
-class DllSymbol : public Symbol
-{
-
-public:
- DllSymbol(char* aName,SymbolType aType, Elf32_Sym* aElfSym, PLUINT32 aSymbolIndex);
- DllSymbol(Symbol* aSymbol, SymbolType aType, bool aAbsent);
- ~DllSymbol();
-
- Elf32_Sym *iElfSym;
- /**
- * The index of this symbol in the symbol table(required for the hash table while
- * creating the dso).
- */
- PLUINT32 iSymbolIndex;
-
-};
-
-
-
-
-#endif // !defined(_PL_DLLSYMBOL_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_dso_handler.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DSOHandler for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#include "pl_dso_handler.h"
-#include "pl_elfconsumer.h"
-#include "pl_elfproducer.h"
-
-/**
-Constructor for class DSOHandler
-@param aParameterListInterface - instance of ParameterListInterface
-@internalComponent
-@released
-*/
-DSOHandler::DSOHandler( ParameterListInterface *aParameterListInterface){
-
- iParameterListInterface = aParameterListInterface;
- iElfProducer = new ElfProducer(iParameterListInterface);
- iElfConsumer = new ElfConsumer(iParameterListInterface);
-}
-
-
-
-/**
-Destructor for class DSOHandler to release allocated memory
-@internalComponent
-@released
-*/
-DSOHandler::~DSOHandler(){
-
- DELETE_PTR(iElfProducer);
- DELETE_PTR(iElfConsumer);
-}
-
-
-/**
-Reads the ELF executable file through its ElfConsumer member
-@param aElfFile The ELF executable file name
-@internalComponent
-@released
-@return Error status
-*/
-PLUINT32 DSOHandler::ReadElfFile(char* aElfFile){
- return iElfConsumer->ReadElfFile( aElfFile );
-}
-
-/**
-Processes the ELF executable file through its ElfConsumer member
-@internalComponent
-@released
-@return Error status
-*/
-void DSOHandler::ProcessElfFile(){
- iElfConsumer->ProcessElfFile();
-}
-
-/**
-Writes the proxy DSO file through its ElfProducer member
-@internalComponent
-@released
-@return Error Status
-@param aDsoFullName The full path and the proxy DSO library file name
-@param aDSOName The proxy DSO library file name
-@param aDllName The DLL name that defines the exported symbols.
-@param aSymbolList The list of exported Symbols that are to be included within the proxy DSO library.
-*/
-PLUINT32 DSOHandler::WriteElfFile(char* aDsoFullName, char* aDSOName, char* aDllName, SymbolList& aSymbolList){
-
- iElfProducer->SetSymbolList( aSymbolList );
- iElfProducer->WriteElfFile(aDsoFullName, aDSOName, aDllName);
-
- return 0;
-}
-
-
-/**
-This operation fetches the list of symbols that are exported from the ELF
-file. This list is used by UseCaseHandler to finalise the export symbols and
-compare them with those found from the DEF file.
-@internalComponent
-@released
-@return Error status
-@param aList A reference to the list is passed so as to fetch all the exported Symbols from ELF executable.
-*/
-int DSOHandler::GetElfExportSymbolList(SymbolList& aList){
- return (iElfConsumer->GetElfSymbolList(aList));
-}
-
-
-/**
-
-@internalComponent
-@released
-@param
-*/
-void DSOHandler::GetImageDetails(/*E32ImageInterface aImageInterface*/){
-
-}
-
-/**
-Function for retuning instance of elf consumer
-@internalComponent
-@released
-@return return the elf consumer instance
-*/
-ElfExecutable * DSOHandler::ElfExecutableP(){
- return iElfConsumer;
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_dso_handler.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class DSOHandler for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_DSOHANDLER_H_)
-#define _PL_DSOHANDLER_H_
-#include "pl_common.h"
-#include <list>
-
-using std::list;
-
-class Symbol;
-class ElfExecutable;
-class ElfProducer;
-class ElfConsumer;
-class ParameterListInterface;
-
-/**
-This class is for reading the input ELF file. If the input is of type ET_DYN, it
-initiates writing the dso file.
-@internalComponent
-@released
-
-*/
-class DSOHandler
-{
-
- typedef std::list<Symbol*> SymbolList;
-
-public:
- DSOHandler( ParameterListInterface *aParameterListInterface);
- ~DSOHandler();
- PLUINT32 ReadElfFile(char* aElfFile);
- void ProcessElfFile();
- PLUINT32 WriteElfFile(char* aDsoFullName, char* aDllName, char* aFile, SymbolList& aSymbolList);
- int GetElfExportSymbolList(SymbolList& aList);
- void GetImageDetails(/*E32ImageInterface aImageInterface*/);
- ElfExecutable * ElfExecutableP();
-
-private:
- /** This member handles reading the ELF exucutable file. */
- ElfConsumer* iElfConsumer;
- /** This member is responsible for generating the proxy DSO file. */
- ElfProducer* iElfProducer;
- ParameterListInterface *iParameterListInterface;
-};
-
-
-
-
-#endif // !defined(_PL_DSOHANDLER_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfconsumer.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfConsumer for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfconsumer.h"
-#include "parameterlistinterface.h"
-#include "errorhandler.h"
-#include <iostream>
-#include <string>
-
-using std::list;
-using std::cout;
-using std::endl;
-using std::min;
-
-/**
-Constructor for class ElfConsumer
-@param aParameterListInterface - instance of class ParameterListInterface
-@internalComponent
-@released
-*/
-ElfConsumer::ElfConsumer(ParameterListInterface *aParameterListInterface) :\
- ElfExecutable(aParameterListInterface) ,\
- iMemBlock(NULL)
-{
-}
-
-
-/**
-Destructor for class ElfConsumer
-@internalComponent
-@released
-*/
-ElfConsumer::~ElfConsumer(){
-
- DELETE_PTR_ARRAY(iMemBlock);
-}
-
-
-/**
-This operation takes the member of the ElfFileWriter object that is to be populated with the
-export info in the iExports member (from the iInputElfFile member of ElfConsumer).
-@param aFile - Elf file name
-@internalComponent
-@released
-*/
-PLUINT32 ElfConsumer::ReadElfFile(char* aFile){
- FILE* aFd;
-
- if( (aFd = fopen(aFile,"rb")) == NULL) {
- throw FileError(FILEOPENERROR, aFile);
- }
-
- fseek(aFd, 0, SEEK_END);
-
- PLUINT32 aSz = ftell(aFd);
- iMemBlock = new char[aSz];
-
- fseek(aFd, 0, SEEK_SET);
-
- // Certain Windows devices (e.g., network shares) limit the size of I/O operations to 64MB
- // or less. We read all the data in individual KMaxWindowsIOSize (32MB) chunks to be safe.
- PLUINT32 chunkSize = 0;
- for( PLUINT32 bytesRead = 0; bytesRead < aSz; bytesRead += chunkSize) {
-
- chunkSize = min(aSz - bytesRead, PLUINT32(KMaxWindowsIOSize));
-
- if( fread(iMemBlock + bytesRead, chunkSize, 1, aFd) != 1) {
- throw FileError(FILEREADERROR, aFile);
- }
- }
-
- return 0;
-}
-
-
-/**
-Funtion for getting elf symbol list
-@param aList - list of symbols found in elf files
-@return - 0 for no exports in elf files, otherwise number of symbols found
-@internalComponent
-@released
-*/
-int ElfConsumer::GetElfSymbolList(list<Symbol*>& aList){
-
- if( !iExports )
- return 0;
-
- //Get the exported symbols
- vector<DllSymbol*> aTmpList = iExports->GetExports(true);
-
- typedef vector<DllSymbol*> List;
- List::iterator aItr = aTmpList.begin();
- while( aItr != aTmpList.end() ){
- aList.push_back((Symbol*) (*aItr));
- aItr++;
- }
- aTmpList.clear();
- return aList.size();
-}
-
-/**
-Funtion for getting image details
-@internalComponent
-@released
-*/
-void ElfConsumer::GetImageDetails(/*E32ImageInterface aInterface*/){
-
-}
-
-
-/**
-Funtion for processing elf file
-@internalComponent
-@released
-*/
-PLUINT32 ElfConsumer::ProcessElfFile(){
-
- Elf32_Ehdr *aElfHdr = ELF_ENTRY_PTR(Elf32_Ehdr, iMemBlock, 0);
-
- try
- {
- ElfExecutable::ProcessElfFile(aElfHdr);
-
- /* The following is a workaround for the ARM linker problem.
- * Linker Problem: ARM linker generates Long ARM to Thumb veneers for which
- * relocation entries are not generated.
- * The linker problem is resolved in ARM Linker version RVCT 2.2 Build 616.
- * Hence the workaround is applicable only for executables generated
- * by ARM linker 2.2 and if build number is below 616.
- */
- char * aARMCompiler = "ARM Linker, RVCT";
- int length = strlen(aARMCompiler);
- char * aCommentSection = ElfExecutable::FindCommentSection();
- /* The .comment section in an elf file contains the compiler version information and
- * it is used to apply the fore mentioned workaround.
- * Some build tool chains generating elf file output without the .comment section,
- * just to save the disk space. In this case the variable aCommentSection gets the NULL value.
- * Solution: This workaround is only applicable for RVCT compiler. So if the .comment section
- * is not available in the elf file, then this workaround is no need to be applied.
- */
- if(aCommentSection != NULL)
- {
- if (!strncmp(aCommentSection, aARMCompiler, length))
- {
- int WorkAroundBuildNo = 616;
- int BuildNo = 0;
- char* RVCTVersion = aCommentSection+length;
-
- /* RVCTVersion contains the following string
- * "<MajorVersion>.<MinorVersion> [Build <BuildNumber>]"
- * Example: "2.2 [Build 616]"
- */
- String Version(RVCTVersion);
- size_t pos = Version.find_last_of(' ');
- size_t size = Version.size();
- if (pos < size)
- {
- size_t index = pos + 1;
- if (index < size)
- {
- BuildNo = atoi(strtok(RVCTVersion+index, "]"));
- }
- }
-
- /* Workaround is applicable only when the version is 2.2 and if the
- * build number is below 616.
- */
- size_t minorVersionPos = Version.find_first_of('.');
- char RVCTMinorVersion='0';
- if (minorVersionPos < size)
- {
- size_t index = minorVersionPos + 1;
- if (index < size)
- {
- RVCTMinorVersion = *(RVCTVersion + index);
- }
- }
-
- if ((*RVCTVersion == '2') && (RVCTMinorVersion == '2') &&
- (BuildNo < WorkAroundBuildNo))
- {
- /* The static symbol table should be processed to identify the veneer symbols.
- * Relocation entries should be generated for these symbols if the linker
- * is not generating the same.
- */
- ElfExecutable::FindStaticSymbolTable();
- ElfExecutable::ProcessVeneers();
- }
- }
- }
- }
- catch(ErrorHandler&)
- {
- throw;
- }
- /*catch(...) // If there are any other unhandled exception,they are handled here.
- {
- //Warning to indicate that there had been an exception at this point.
- MessageHandler::GetInstance()->ReportWarning(ELFFILEERROR,(char*)iParameterListInterface->ElfInput());
- throw;
- } */
- return 0;
-}
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfconsumer.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfConsumer for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFCONSUMER_H_)
-#define _PL_ELFCONSUMER_H_
-
-#include "pl_elfexecutable.h"
-#include <list>
-#include <stdio.h>
-
-using std::list;
-
-enum{ KMaxWindowsIOSize = 31 * 1024 * 1024 };
-
-/**
-This class is for reading the ELF file generated by the static linker and based on whether it is
-ET_EXEC or ET_DYN, it processes the imports(if required) or exports respectively.
-@internalComponent
-@released
-*/
-class ElfConsumer : public ElfExecutable
-{
-public:
- ElfConsumer(ParameterListInterface *aParameterListInterface);
- virtual ~ElfConsumer();
- PLUINT32 ReadElfFile(char* aFile);
- int GetElfSymbolList(list<Symbol*>& aList);
- void GetImageDetails(/*E32ImageInterface aInterface*/);
- PLUINT32 ProcessElfFile();
-
-private:
- char* iMemBlock;
-};
-
-
-
-
-#endif // !defined(_PL_ELFCONSUMER_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfexecutable.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1484 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfExecutable for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#include "pl_elfexecutable.h"
-#include "errorhandler.h"
-#include <stdio.h>
-#include "parameterlistinterface.h"
-#include "pl_elfimportrelocation.h"
-#include "pl_dllsymbol.h"
-#include "messagehandler.h"
-#include "pl_elflocalrelocation.h"
-
-
-/**
-Constructor for class ElfExecutable
-@param aParameterListInterface - Instance of class ParameterListInterface
-@internalComponent
-@released
-*/
-ElfExecutable::ElfExecutable(ParameterListInterface *aParameterListInterface) :\
- iElfHeader(NULL), \
- iEntryPoint(0),\
- iProgHeader(NULL), \
- iSONameOffset(0) ,\
- iSections (NULL) , \
- iVersionDef (NULL) , iVerDefCount(0), \
- iVersionNeed (NULL) , iVerNeedCount(0), \
- iVersionTbl (NULL) ,iRelSize(0),iRelEntSize(0), \
- iNRelocs(0),
- iRel (NULL) ,iRelaSize(0), iRelaEntSize(0), \
- iRela(NULL),
- iStringTable (NULL) , \
- iSectionHdrStrTbl(NULL), \
- iVerInfo(NULL), iElfDynSym (NULL), \
- iSymTab (NULL), \
- iStrTab (NULL), \
- iLim (NULL), \
- iNSymbols(0), \
- iHashTbl (NULL) , \
- iDynSegmentHdr (NULL) , \
- iDataSegmentHdr (NULL) ,iDataSegment(NULL), iDataSegmentSize(0), iDataSegmentIdx(0), \
- iCodeSegmentHdr (NULL) , iCodeSegment(NULL), iCodeSegmentSize(0), iCodeSegmentIdx(0), \
- iExports (NULL), \
- iParameterListInterface(aParameterListInterface),\
- iPltGotBase(0), iPltGotLimit(0), iStrTabSz(0), iSymEntSz(0), \
- iPltGot(NULL), iPltRel(NULL),iPltRelaSz(0), iPltRela(NULL), iPltRelSz(0) \
-
-{
-}
-
-
-/**
-Destructor for class ElfExecutable
-@internalComponent
-@released
-*/
-ElfExecutable::~ElfExecutable()
-{
- delete iExports;
- delete [] iVerInfo;
- /*
- all of these were getting deleted, they are not allocated by
- ElfExecutable, they simply refer to a linear array of images
- in an ElfImage, hence they shouldn't be de-allocated
-
- delete iRela;
- delete iPltRel;
- delete iPltRela; */
-
- iNeeded.clear();
- iSymbolTable.clear();
-}
-
-
-/**
-Function to process Elf file
-@param aElfHdr - pointer to Elf header
-@return 0 if its valid ELF file
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::ProcessElfFile(Elf32_Ehdr *aElfHdr) {
-
- iElfHeader = aElfHdr;
- iEntryPoint = aElfHdr->e_entry;
-
- ValidateElfFile();
-
- /* A valid ELF file so far..*/
-
- /* Get the Section base..*/
- if(iElfHeader->e_shnum) {
- iSections = ELF_ENTRY_PTR(Elf32_Shdr, iElfHeader, iElfHeader->e_shoff);
- }
-
- /* Get the program header..*/
- if(iElfHeader->e_phnum) {
- iProgHeader = ELF_ENTRY_PTR(Elf32_Phdr, iElfHeader, iElfHeader->e_phoff);
- }
-
- /* Get the section-header-string table..*/
- if(iElfHeader->e_shstrndx != SHN_UNDEF) {
-
- if(iElfHeader->e_shstrndx > iElfHeader->e_shnum ) {
- throw ELFFormatError(ELFSHSTRINDEXERROR,iParameterListInterface->ElfInput());
- }
-
- iSectionHdrStrTbl = ELF_ENTRY_PTR(char, iElfHeader, iSections[iElfHeader->e_shstrndx].sh_offset);
- }
-
- if( iProgHeader ) {
- PLUINT32 aIdx = 0;
-
- while( aIdx < iElfHeader->e_phnum) {
- switch( iProgHeader[aIdx].p_type ) {
- case PT_DYNAMIC:
- {
- iDynSegmentHdr = &iProgHeader[aIdx];
- }
- break;
- case PT_LOAD:
- {
- if( (iProgHeader[aIdx].p_flags) & (PF_X | PF_ARM_ENTRY) ) {
- iCodeSegmentHdr = &iProgHeader[aIdx];
- iCodeSegmentIdx = aIdx;
- iCodeSegment = ELF_ENTRY_PTR(char, iElfHeader, iCodeSegmentHdr->p_offset);
- iCodeSegmentSize = iCodeSegmentHdr->p_filesz;
- }
- else if( (iProgHeader[aIdx].p_flags) & (PF_W | PF_R) ) {
- iDataSegmentHdr = &iProgHeader[aIdx];
- iDataSegmentIdx = aIdx;
- iDataSegment = ELF_ENTRY_PTR(char, iElfHeader, iDataSegmentHdr->p_offset);
- iDataSegmentSize = iDataSegmentHdr->p_filesz;
- }
- }
- break;
- default:
- break;
-
- }
- aIdx++;
- }
-
- if( iDynSegmentHdr ) {
- ProcessDynamicEntries();
- }
-
- ProcessSymbols();
- ProcessRelocations();
- }
-
- return 0;
-}
-
-/**
-Function to Find the Static Symbol Table
-@internalComponent
-@released
-*/
-void ElfExecutable::FindStaticSymbolTable()
-{
- size_t nShdrs = iElfHeader->e_shnum;
-
- if (nShdrs)
- {
- // Find the static symbol table and string table
- for (PLUINT32 i = 0; i < nShdrs; i++)
- {
- if (iSections[i].sh_type == SHT_SYMTAB)
- {
- iSymTab = ELF_ENTRY_PTR(Elf32_Sym, iElfHeader, iSections[i].sh_offset);
- iLim = ELF_ENTRY_PTR(Elf32_Sym, iSymTab, iSections[i].sh_size);
- if (iStrTab) break;
- }
- else if (iSections[i].sh_type == SHT_STRTAB)
- {
- char * aSectionName = iSectionHdrStrTbl + iSections[i].sh_name;
- if (!strcmp(aSectionName, ".strtab"))
- {
- iStrTab = ELF_ENTRY_PTR(char, iElfHeader, iSections[i].sh_offset);
- if (iSymTab) break;
- }
- }
- }
- }
-}
-
-/**
-Function to Find the Comment Section
-@return aComment - Pointer to Comment Section
-@internalComponent
-@released
-*/
-char* ElfExecutable::FindCommentSection()
-{
- size_t nShdrs = iElfHeader->e_shnum;
- char *aCommentSection = ".comment";
- char *aComment;
-
- if (nShdrs)
- {
- // find the comment section
- for (PLUINT32 i = 0; i < nShdrs; i++)
- {
- if (iSections[i].sh_type == SHT_PROGBITS)
- {
- char * aSectionName = iSectionHdrStrTbl + iSections[i].sh_name;
- int length = strlen(aCommentSection);
- if (!strncmp(aSectionName, aCommentSection, length))
- {
- aComment = ELF_ENTRY_PTR(char, iElfHeader, iSections[i].sh_offset);
- return aComment;
- }
- }
- }
- }
- return NULL;
-}
-
-/**
-Function to process the ARM to Thumb veneers
-@internalComponent
-@released
-*/
-void ElfExecutable::ProcessVeneers()
-{
- if (iSymTab && iStrTab)
- {
- ElfRelocations::RelocationList & iLocalCodeRelocs = GetCodeRelocations();
-
- Elf32_Sym *aSymTab = iSymTab;
- int length = strlen("$Ven$AT$L$$");
-
- // Process the symbol table to find Long ARM to Thumb Veneers
- // i.e. symbols of the form '$Ven$AT$L$$'
- for(; aSymTab < iLim; aSymTab++)
- {
- if (!aSymTab->st_name) continue;
- char * aSymName = iStrTab + aSymTab->st_name;
- Elf32_Sym *aSym;
-
- if (!strncmp(aSymName, "$Ven$AT$L$$", length))
- {
- aSym = aSymTab;
- Elf32_Addr r_offset = aSym->st_value;
- Elf32_Addr aOffset = r_offset + 4;
- Elf32_Word aInstruction = FindValueAtLoc(r_offset);
- bool aRelocEntryFound = false;
-
- ElfRelocations::RelocationList::iterator r;
- for (r = iLocalCodeRelocs.begin(); r != iLocalCodeRelocs.end(); r++)
- {
- ElfLocalRelocation * aReloc = *r;
- // Check if there is a relocation entry for the veneer symbol
- if (aReloc->iAddr == aOffset)
- {
- aRelocEntryFound = true;
- break;
- }
- }
-
- Elf32_Word aPointer = FindValueAtLoc(aOffset);
-
- /* If the symbol addresses a Thumb instruction, its value is the
- * address of the instruction with bit zero set (in a
- * relocatable object, the section offset with bit zero set).
- * This allows a linker to distinguish ARM and Thumb code symbols
- * without having to refer to the map. An ARM symbol will always have
- * an even value, while a Thumb symbol will always have an odd value.
- * Reference: Section 4.5.3 in Elf for the ARM Architecture Doc
- * aIsThumbSymbol will be 1 for a thumb symbol and 0 for ARM symbol
- */
- int aIsThumbSymbol = aPointer & 0x1;
-
- /* The relocation entry should be generated for the veneer only if
- * the following three conditions are satisfied:
- * 1) Check if the instruction at the symbol is as expected
- * i.e. has the bit pattern 0xe51ff004 == 'LDR pc,[pc,#-4]'
- * 2) There is no relocation entry generated for the veneer symbol
- * 3) The instruction in the location provided by the pointer is a thumb symbol
- */
- if (aInstruction == 0xE51FF004 && !aRelocEntryFound && aIsThumbSymbol)
- {
- ElfLocalRelocation *aRel;
- PLUCHAR aType = R_ARM_NONE;
-
- aRel = new ElfLocalRelocation(this, aOffset, 0, 0, aType, NULL, ESegmentRO, aSym, false, true);
- if(aRel)
- {
- aRel->Add();
- }
- }
- }
- }
- }
-}
-
-/**
-Function to find the content of the address passed in
-@param aOffset - Address
-@return aLocVal - The content of the address, like instruction or a pointer
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::FindValueAtLoc(Elf32_Addr aOffset)
-{
- Elf32_Phdr *aHdr = Segment(aOffset);
- PLUINT32 aLoc = aHdr->p_offset + aOffset - aHdr->p_vaddr;
- Elf32_Word *aLocVal = ELF_ENTRY_PTR(Elf32_Word, iElfHeader, aLoc);
- return *aLocVal;
-}
-
-/**
-Function to process Elf symbols
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::ProcessSymbols(){
- PLUINT32 aSymIdx = 0;
- DllSymbol *aSymbol;
- char *aDllName;
- char *aSymName, *aNewSymName;
- SymbolType aType;
-
- while( aSymIdx < iNSymbols ) {
-
- aSymName = ELF_ENTRY_PTR(char, iStringTable, iElfDynSym[aSymIdx].st_name );
-
- if( ExportedSymbol( &iElfDynSym[aSymIdx] ) ){
-
- if( FunctionSymbol( &iElfDynSym[aSymIdx] ))
- aType = SymbolTypeCode;
- else
- aType = SymbolTypeData;
-
- aSymName = ELF_ENTRY_PTR(char, iStringTable, iElfDynSym[aSymIdx].st_name );
- aDllName = iVerInfo[iVersionTbl[aSymIdx]].iLinkAs;
- aNewSymName = new char[strlen(aSymName)+1];
- strcpy(aNewSymName, aSymName);
- aSymbol = new DllSymbol( aNewSymName, aType, &iElfDynSym[aSymIdx], aSymIdx);
- aSymbol->SetSymbolSize(iElfDynSym[aSymIdx].st_size);
-
- //Putting the symbols into a hash table - Used later while processing relocations
- iSymbolTable[aSymIdx] = aSymbol ;
- if( !AddToExports( aDllName, aSymbol ))
- {
- //Not a valid export... delete it..
- delete aSymbol;
- }
- }
- else if( ImportedSymbol( &iElfDynSym[aSymIdx] ) ){
-
- if( FunctionSymbol( &iElfDynSym[aSymIdx] ))
- aType = SymbolTypeCode;
- else
- aType = SymbolTypeData;
-
- aSymName = ELF_ENTRY_PTR(char, iStringTable, iElfDynSym[aSymIdx].st_name );
-
- /*
- * All imported symbols must be informed via the version needed information.
- */
- if( iVerInfo[iVersionTbl[aSymIdx]].iVerCategory != VER_CAT_NEEDED ) {
- throw UndefinedSymbolError(UNDEFINEDSYMBOLERROR, iParameterListInterface->ElfInput(), aSymName);
- }
- aDllName = iVerInfo[iVersionTbl[aSymIdx]].iLinkAs;
- //aSymbol = new DllSymbol( aSymName, aType, &iElfDynSym[aSymIdx], aSymIdx);
-
- //Putting the symbols into a hash table
- //iSymbolTable[aSymIdx] = aSymbol ;
- }
- aSymIdx++;
- }
-
- return 0;
-}
-
-/**
-This function Dump all the sections with their section details (i.e., the section name, type,
-size and linked section if any)
-@param aFile - ELF file name
-@internalComponent
-@released
-*/
-void ElfExecutable::DumpElfFile(char* aFile){
- aFile = aFile;
-}
-
-
-/**
-This function adds exports into the export list
-@param aDll - Dll name
-@param aSymbol - Symbol
-@return
-@internalComponent
-@released
-*/
-DllSymbol* ElfExecutable::AddToExports(char* aDll, DllSymbol* aSymbol){
- if( !iExports ) {
- iExports = new ElfExports();
- }
- return iExports->Add( aDll, this, aSymbol );
-}
-
-
-/**
-This function adds imports into the map
-@param aReloc - Instance of class ElfImportRelocation
-@internalComponent
-@released
-*/
-void ElfExecutable::AddToImports(ElfImportRelocation* aReloc){
- SetVersionRecord(aReloc);
- //char *aDll = iVerInfo[iVersionTbl[aReloc->iSymNdx]].iLinkAs;
- char *aDll = aReloc->iVerRecord->iLinkAs;
- iImports.Add( (const char*)aDll, aReloc );
-
-}
-
-/**
-This function adds local relocation into a list
-@param aReloc - Instance of class ElfImportRelocation
-@internalComponent
-@released
-*/
-void ElfExecutable::AddToLocalRelocations(ElfRelocation* aReloc) {
- iLocalRelocations.Add((ElfLocalRelocation*)aReloc);
-}
-
-/**
-This function records the version of an imported symbol
-@param aReloc - Instance of class ElfImportRelocation
-@internalComponent
-@released
-*/
-void ElfExecutable::SetVersionRecord( ElfRelocation* aReloc ) {
- if( !aReloc )
- return;
- ((ElfImportRelocation*)aReloc)->iVerRecord = &iVerInfo[ iVersionTbl[aReloc->iSymNdx]];
-}
-
-/**
-This function validates the ELF file
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::ValidateElfFile() {
-
- /*Check if the ELF-Magic is correct*/
- if(!(iElfHeader->e_ident[EI_MAG0] == ELFMAG0) &&
- (iElfHeader->e_ident[EI_MAG1] == ELFMAG1) &&
- (iElfHeader->e_ident[EI_MAG2] == ELFMAG2) &&
- (iElfHeader->e_ident[EI_MAG3] == ELFMAG3) ) {
- throw ELFFormatError(ELFMAGICERROR, iParameterListInterface->ElfInput());
- }
-
- /*32-bit ELF file*/
- if(iElfHeader->e_ident[EI_CLASS] != ELFCLASS32) {
- throw ELFFormatError(ELFCLASSERROR, iParameterListInterface->ElfInput());
- }
-
- /* Check if the ELF file is in Little endian format*/
- if(iElfHeader->e_ident[EI_DATA] != ELFDATA2LSB) {
- throw ELFFormatError(ELFLEERROR, iParameterListInterface->ElfInput());
- }
-
- /* The ELF executable must be a DLL or an EXE*/
- if( iElfHeader->e_type != ET_EXEC && iElfHeader->e_type != ET_DYN) {
- throw ELFFormatError(ELFEXECUTABLEERROR, iParameterListInterface->ElfInput());
- }
-
- return 0;
-}
-
-
-/**
-This function processes the dynamic table.
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::ProcessDynamicEntries(){
-
- PLUINT32 aIdx = 0;
- bool aSONameFound = false;
- bool aPltRelTypeSeen = false, aJmpRelSeen = false;
- list<PLUINT32> aNeeded;
- Elf32_Dyn *aDyn = ELF_ENTRY_PTR(Elf32_Dyn, iElfHeader, iDynSegmentHdr->p_offset);
-
- while( aDyn[aIdx].d_tag != DT_NULL ) {
- switch (aDyn[aIdx].d_tag) {
- case DT_NEEDED:
- aNeeded.push_back( aDyn[aIdx].d_val );
- break;
- case DT_HASH:
- iHashTbl = ELF_ENTRY_PTR(Elf32_HashTable, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_STRTAB:
- iStringTable = ELF_ENTRY_PTR(char, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_SYMTAB:
- iElfDynSym = ELF_ENTRY_PTR(Elf32_Sym, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_RELA:
- iRela = ELF_ENTRY_PTR(Elf32_Rela, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_RELASZ:
- iRelaSize = aDyn[aIdx].d_val;
- break;
- case DT_RELAENT:
- iRelaEntSize = aDyn[aIdx].d_val;
- break;
- case DT_SONAME:
- aSONameFound = true;
- iSONameOffset = aDyn[aIdx].d_val;
- break;
- case DT_REL:
- iRel = ELF_ENTRY_PTR(Elf32_Rel, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_RELSZ:
- iRelSize = aDyn[aIdx].d_val;
- break;
- case DT_RELENT:
- iRelEntSize = aDyn[aIdx].d_val;
- break;
- case DT_VERSYM:
- iVersionTbl = ELF_ENTRY_PTR(Elf32_Half, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_VERDEF:
- iVersionDef = ELF_ENTRY_PTR(Elf32_Verdef, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_VERDEFNUM:
- iVerDefCount = aDyn[aIdx].d_val;
- break;
- case DT_VERNEED:
- iVersionNeed = ELF_ENTRY_PTR(Elf32_Verneed, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_VERNEEDNUM:
- iVerNeedCount = aDyn[aIdx].d_val;
- break;
- case DT_STRSZ:
- iStrTabSz = aDyn[aIdx].d_val;
- break;
- case DT_SYMENT:
- iSymEntSz = aDyn[aIdx].d_val;
- break;
- case DT_PLTRELSZ:
- iPltRelSz = aDyn[aIdx].d_val;
- break;
- case DT_PLTGOT:
- iPltGot = ELF_ENTRY_PTR(Elf32_Word, iElfHeader, aDyn[aIdx].d_val);
- break;
- case DT_RPATH:
- break;
- case DT_SYMBOLIC:
- break;
- case DT_INIT:
- break;
- case DT_FINI:
- break;
- case DT_PLTREL:
- aPltRelTypeSeen = true;
- iPltRelType = aDyn[aIdx].d_val;
- break;
- case DT_DEBUG:
- break;
- case DT_TEXTREL:
- break;
- case DT_JMPREL:
- aJmpRelSeen = true;
- iJmpRelOffset = aDyn[aIdx].d_val;
- break;
- case DT_BIND_NOW:
- break;
- case DT_INIT_ARRAY:
- break;
- case DT_FINI_ARRAY:
- break;
- case DT_INIT_ARRAYSZ:
- break;
- case DT_FINI_ARRAYSZ:
- break;
- case DT_RELCOUNT:
- break;
- case DT_ARM_PLTGOTBASE:
- iPltGotBase = aDyn[aIdx].d_val;
- break;
- case DT_ARM_PLTGOTLIMIT:
- iPltGotLimit = aDyn[aIdx].d_val;
- break;
- case DT_ARM_SYMTABSZ:
- iNSymbols = aDyn[aIdx].d_val;
- break;
- default:
- //cout << "Unknown entry in dynamic table Tag=0x%x Value=0x%x",aDyn[aIdx].d_tag, aDyn[aIdx].d_val);
- break;
- }
- aIdx++;
- }
-
- //String table is found, so get the strings...
- if(aSONameFound) {
- iSOName = ELF_ENTRY_PTR(char, iStringTable, iSONameOffset);
- }
-
- std::list<PLUINT32>::iterator aItr = aNeeded.begin();
- char *aStr;
- for( ; aItr != aNeeded.end();aItr++ ) {
- aStr = ELF_ENTRY_PTR(char, iStringTable, *aItr);
- iNeeded.push_back( aStr );
- }
-
- if(iVerNeedCount || iVerDefCount) {
- ProcessVerInfo();
- }
-
- if(iHashTbl)
- {
- //The number of symbols should be same as the number of chains in hashtable
- if (iNSymbols && (iNSymbols != iHashTbl->nChains))
- throw ELFFormatError(SYMBOLCOUNTMISMATCHERROR,(char*)iParameterListInterface->ElfInput());
- else
- //The number of symbols is same as the number of chains in hashtable
- iNSymbols = iHashTbl->nChains;
- }
-
- if( aPltRelTypeSeen && aJmpRelSeen) {
-
- if (iPltRelType == DT_REL)
- {
- iPltRel = ELF_ENTRY_PTR(Elf32_Rel, iElfHeader, iJmpRelOffset);
- // check to see if PltRels are included in iRel. If they are
- // ignore them since we don't care about the distinction
- if (iRel <= iPltRel && iPltRel < ELF_ENTRY_PTR(Elf32_Rel, iRel, iRelSize))
- iPltRel = 0;
- }
- else
- {
- iPltRela = ELF_ENTRY_PTR(Elf32_Rela, iElfHeader, iJmpRelOffset);
- // check to see if PltRels are included in iRel. If they are
- // ignore them since we don't care about the distinction
- if (iRela <= iPltRela && iPltRela < ELF_ENTRY_PTR(Elf32_Rela, iRela, iRelaSize))
- iPltRela = 0;
- }
- }
-
- return 0;
-}
-
-/**
-This function processes version information
-@internalComponent
-@released
-*/
-void ElfExecutable::ProcessVerInfo() {
- PLUINT32 aSz = iVerNeedCount + iVerDefCount + 1;
- iVerInfo = new VersionInfo[aSz];
-
- Elf32_Verdef *aDef;
- Elf32_Verdaux *aDaux;
- Elf32_Verneed *aNeed;
- Elf32_Vernaux *aNaux;
- char *aSoName;
- char *aLinkAs;
-
- aDef = iVersionDef;
-
- while( aDef ) {
- aDaux = ELF_ENTRY_PTR( Elf32_Verdaux, aDef, aDef->vd_aux);
- aLinkAs = ELF_ENTRY_PTR(char, iStringTable, aDaux->vda_name );
- aSoName = iSOName;
- iVerInfo[aDef->vd_ndx].iLinkAs = aLinkAs;
- iVerInfo[aDef->vd_ndx].iSOName = aSoName;
- iVerInfo[aDef->vd_ndx].iVerCategory = VER_CAT_DEFINED;
-
- if( !aDef->vd_next ) {
- break;
- }
- aDef = ELF_ENTRY_PTR(Elf32_Verdef, aDef, aDef->vd_next);
- }
-
- aNeed = iVersionNeed;
-
- while( aNeed ) {
- aNaux = ELF_ENTRY_PTR(Elf32_Vernaux, aNeed, aNeed->vn_aux);
- aLinkAs = ELF_ENTRY_PTR(char, iStringTable, aNaux->vna_name);
- aSoName = ELF_ENTRY_PTR(char, iStringTable, aNeed->vn_file);
-
- iVerInfo[aNaux->vna_other].iLinkAs = aLinkAs;
- iVerInfo[aNaux->vna_other].iSOName = aSoName;
- iVerInfo[aNaux->vna_other].iVerCategory = VER_CAT_NEEDED;
-
- if( !aNeed->vn_next ) {
- break;
- }
- aNeed = ELF_ENTRY_PTR(Elf32_Verneed, aNeed, aNeed->vn_next);
- }
-}
-
-/**
-This function processes Elf relocations
-@internalComponent
-@released
-*/
-void ElfExecutable::ProcessRelocations(){
- ProcessRelocations(iRel, iRelSize);
- ProcessRelocations(iRela, iRelaSize);
- ProcessRelocations(iPltRel, iPltRelSz);
- ProcessRelocations(iPltRela, iPltRelaSz);
-}
-
-/**
-Template Function to process relocations
-@param aElfRel - relocation table
-@param aSize - relocation table size
-@internalComponent
-@released
-*/
-template <class T>
-void ElfExecutable::ProcessRelocations(T *aElfRel, size_t aSize){
- if( !aElfRel )
- return;
-
- T * aElfRelLimit = ELF_ENTRY_PTR(T, aElfRel, aSize);
-
- PLUINT32 aSymIdx;
- PLUCHAR aType;
- ElfRelocation *aRel;
- bool aImported;
- Elf32_Word aAddend;
-
- while( aElfRel < aElfRelLimit) {
-
- aType = ELF32_R_TYPE(aElfRel->r_info );
-
- if(ElfRelocation::ValidRelocEntry(aType)) {
-
- aSymIdx = ELF32_R_SYM(aElfRel->r_info);
- aImported = ImportedSymbol( &iElfDynSym[aSymIdx] );
- aAddend = Addend(aElfRel);
- aRel = ElfRelocation::NewRelocEntry(this, aElfRel->r_offset, aAddend, \
- aSymIdx, aType, aElfRel, aImported);
-
- if(aRel) {
- aRel->Add();
- }
- }
- aElfRel++;
- }
-}
-
-/**
-This function finds the addend associated with a relocation entry.
-@param aRel - relocation entry
-@return location in the elf image
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::Addend(Elf32_Rel* aRel) {
- PLUINT32 aOffset;
- Elf32_Word *aAddendPlace;
- Elf32_Phdr *aHdr = Segment(aRel->r_offset);
- aOffset = aHdr->p_offset + aRel->r_offset - aHdr->p_vaddr;
- aAddendPlace = ELF_ENTRY_PTR(Elf32_Word, iElfHeader, aOffset);
- return *aAddendPlace;
-}
-
-/**
-This function returns the addend for a relocation entry
-@param aRel - relocation entry
-@return location in the elf image
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::Addend(Elf32_Rela* aRel) {
- return aRel->r_addend;
-}
-
-/**
-This function gets the version info at an index
-@param aIndex - index into the version table
-@return version record
-@internalComponent
-@released
-*/
-VersionInfo* ElfExecutable::GetVersionInfo(PLUINT32 aIndex){
- return &iVerInfo[ iVersionTbl[aIndex]];
-}
-
-
-/**
-This function returns the Dll name in which an imported symbol is
-defined by looking in the version required section.
-@param aSymbolIndex - Index of symbol
-@return Dll name
-@internalComponent
-@released
-*/
-char* ElfExecutable::SymbolDefinedInDll(PLUINT32 aSymbolIndex){
-
- VersionInfo *aVInfo = GetVersionInfo(aSymbolIndex);
- return aVInfo ? aVInfo->iLinkAs : NULL;
-}
-
-/**
-This function returns the DSO(import library) name where the Symbol information can be found.
-This DSO is then looked up for the ordinal number of this symbol.
-@param aSymbolIndex - Index of symbol
-@return DSO name
-@internalComponent
-@released
-*/
-char* ElfExecutable::SymbolFromDSO(PLUINT32 aSymbolIndex){
-
- VersionInfo *aVInfo = GetVersionInfo(aSymbolIndex);
- return aVInfo ? aVInfo->iSOName : NULL;
-}
-
-/**
-This function returns the segment type
-@param aAddr - Address
-@return Segment type
-@internalComponent
-@released
-*/
-ESegmentType ElfExecutable::SegmentType(Elf32_Addr aAddr) {
-
- try {
- Elf32_Phdr *aHdr = Segment(aAddr);
- if( !aHdr )
- return ESegmentUndefined;
-
- if( aHdr == iCodeSegmentHdr)
- return ESegmentRO;
- else if(aHdr == iDataSegmentHdr)
- return ESegmentRW;
- else
- return ESegmentUndefined;
- }
- catch(...)
- {
- }
-
- return ESegmentUndefined;
-}
-
-/**
-This function returns the segment type
-@param aType
-@return Segment header
-@internalComponent
-@released
-*/
-Elf32_Phdr* ElfExecutable::Segment(ESegmentType aType) {
-
- switch(aType)
- {
- case ESegmentRO:
- return iCodeSegmentHdr;
- case ESegmentRW:
- return iDataSegmentHdr;
- default:
- return NULL;
- }
-}
-
-/**
-Function to get segment header
-@param aAddr - Address
-@return Segment header
-@internalComponent
-@released
-*/
-Elf32_Phdr* ElfExecutable::Segment(Elf32_Addr aAddr) {
-
- if(iCodeSegmentHdr) {
- PLUINT32 aBase = iCodeSegmentHdr->p_vaddr;
- if( aBase <= aAddr && aAddr < (aBase + iCodeSegmentHdr->p_memsz) ) {
- return iCodeSegmentHdr;
- }
- }
- if(iDataSegmentHdr) {
- PLUINT32 aBase = iDataSegmentHdr->p_vaddr;
- if( aBase <= aAddr && aAddr < (aBase + iDataSegmentHdr->p_memsz) ) {
- return iDataSegmentHdr;
- }
- }
-
- throw int(0);
-}
-
-/**
-Thsi function returns the segment header to which the address refers.
-@param aAddr - location
-@return Segment header.
-@internalComponent
-@released
-*/
-Elf32_Phdr* ElfExecutable::SegmentFromAbs(Elf32_Addr aAddr) {
-
- if(iCodeSegmentHdr) {
- PLUINT32 aBase = iCodeSegmentHdr->p_vaddr;
- if( aBase <= aAddr && aAddr <= (aBase + iCodeSegmentHdr->p_memsz) ) {
- return iCodeSegmentHdr;
- }
- }
- if(iDataSegmentHdr) {
- PLUINT32 aBase = iDataSegmentHdr->p_vaddr;
- if( aBase <= aAddr && aAddr <= (aBase + iDataSegmentHdr->p_memsz) ) {
- return iDataSegmentHdr;
- }
- }
- return NULL;
-}
-
-/**
-This function says if the symbol is global.
-@param aSym - Symbol
-@return True if symbol is global, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::GlobalSymbol(Elf32_Sym* aSym)
-{
- return (ELF32_ST_BIND(aSym->st_info) == STB_GLOBAL);
-}
-
-/**
-This function says if the symbol is exported.
-@param aSym - Symbol
-@return True if symbol is exported, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::ExportedSymbol(Elf32_Sym* aSym)
-{
- PLUINT32 aIdx = aSym->st_shndx;
-
- if(GlobalSymbol(aSym) && VisibleSymbol(aSym) && DefinedSymbol(aSym) && \
- (aIdx != SHN_UNDEF) && (FunctionSymbol(aSym) || DataSymbol(aSym) ) && aIdx < SHN_ABS )
- return true;
- return false;
-}
-
-/**
-This function says if the symbol is imported.
-@param aSym - Symbol
-@return True if symbol is imported, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::ImportedSymbol(Elf32_Sym* aSym)
-{
- PLUINT32 aIdx = aSym->st_shndx;
-
- if( (aIdx == SHN_UNDEF) && GlobalSymbol(aSym) && VisibleSymbol(aSym) && (!DefinedSymbol(aSym)) )
- return true;
- return false;
-}
-
-/**
-This function says if the symbol refers to code or data.
-@param aSym - Symbol
-@return True if symbol refers to code, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::FunctionSymbol(Elf32_Sym* aSym)
-{
- return (STT_FUNC == ELF32_ST_TYPE(aSym->st_info));
-}
-
-/**
-This function says if the symbol refers to code or data.
-@param aSym - Symbol
-@return True if symbol refers to data, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::DataSymbol(Elf32_Sym* aSym)
-{
- return (STT_OBJECT == ELF32_ST_TYPE(aSym->st_info));
-}
-
-/**
-This function says if the symbol is defined in the Elf executable.
-@param aSym - Symbol
-@return True if symbol is defined, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::DefinedSymbol(Elf32_Sym* aSym)
-{
- if( aSym->st_shndx == SHN_UNDEF )
- return false;
- ESegmentType aType = SegmentType(aSym->st_value);
- return ((aType == ESegmentRO) || (aType == ESegmentRW));
-}
-
-/**
-This function says if the visibility of the symbol is default.
-@param aSym - Symbol
-@return True if symbol has default visibility, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::VisibleSymbol(Elf32_Sym* aSym)
-{
- return (STV_DEFAULT == ELF32_ST_VISIBILITY(aSym->st_other) || STV_PROTECTED == ELF32_ST_VISIBILITY(aSym->st_other));
-}
-
-/**
-This function finds symbol using the hash table
-@param aName - Symbol name
-@return elf symbol.
-@internalComponent
-@released
-*/
-Elf32_Sym* ElfExecutable::FindSymbol(char* aName) {
- if(!aName )
- return NULL;
-
- PLULONG aHashVal = Util::elf_hash((const PLUCHAR*) aName );
-
- Elf32_Sword* aBuckets = ELF_ENTRY_PTR(Elf32_Sword, iHashTbl, sizeof(Elf32_HashTable) );
- Elf32_Sword* aChains = ELF_ENTRY_PTR(Elf32_Sword, aBuckets, sizeof(Elf32_Sword)*(iHashTbl->nBuckets) );
-
- Elf32_Sword aIdx = aHashVal % iHashTbl->nBuckets;
- aIdx = aBuckets[aIdx];
-
- char *aSymName;
- do {
- aSymName = ELF_ENTRY_PTR(char, iStringTable, iElfDynSym[aIdx].st_name);
- if( !strcmp(aSymName, aName) ) {
- return &iElfDynSym[aIdx];
- }
- aIdx = aChains[aIdx];
- }while( aIdx > 0 );
-
- return NULL;
-}
-
-/**
-Function to get symbol name
-@param aSymIdx - Index of symbol
-@return Symbol name
-@internalComponent
-@released
-*/
-char* ElfExecutable::GetSymbolName( PLUINT32 aSymIdx) {
- return ELF_ENTRY_PTR(char, iStringTable, iElfDynSym[aSymIdx].st_name);
-}
-
-/**
-Function to get symbol ordinal
-@param aSymName - Symbol name
-@return Symbol ordinal
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::GetSymbolOrdinal( char* aSymName) {
- Elf32_Sym *aSym = FindSymbol(aSymName);
- if( !aSym )
- return (PLUINT32)-1;
- return GetSymbolOrdinal( aSym );
-
-}
-
-/**
-Function to get symbol ordinal
-@param aSym - Symbol
-@return Symbol ordinal
-@internalComponent
-@released
-*/
-PLUINT32 ElfExecutable::GetSymbolOrdinal( Elf32_Sym* aSym) {
- PLUINT32 aOrd = (PLUINT32)-1;
- if( aSym->st_shndx == ESegmentRO) {
- Elf32_Word *aLocation, aOffset;
-
- aOffset = iCodeSegmentHdr->p_offset + aSym->st_value - iCodeSegmentHdr->p_vaddr;
- aLocation = ELF_ENTRY_PTR(Elf32_Word, iElfHeader, aOffset);
- aOrd = *aLocation;
- }
- return aOrd;
-}
-
-/**
-Function to get relocation offset
-@param aReloc - Instance of class ElfRelocation
-@return offset
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::GetRelocationOffset(ElfRelocation * aReloc)
-{
- Elf32_Phdr * aHdr = Segment(aReloc->iAddr);
- unsigned int aOffset = aReloc->iAddr - aHdr->p_vaddr;
- return aOffset;
-}
-
-/**
-Function to get relocation place address
-@param aReloc - Instance of class ElfRelocation
-@return address to place relocation
-@internalComponent
-@released
-*/
-Elf32_Word * ElfExecutable::GetRelocationPlace(ElfRelocation * aReloc)
-{
- Elf32_Phdr * aHdr = Segment(aReloc->iAddr);
- unsigned int aOffset = aHdr->p_offset + aReloc->iAddr - aHdr->p_vaddr;
- Elf32_Word * aPlace = ELF_ENTRY_PTR(Elf32_Word, iElfHeader, aOffset);
- return aPlace;
-}
-
-/**
-Function to get local relocation
-@return local relocation
-@internalComponent
-@released
-*/
-ElfRelocations& ElfExecutable::GetLocalRelocations()
-{
- return iLocalRelocations;
-}
-
-/**
-Function to get code relocation
-@return code relocation list
-@internalComponent
-@released
-*/
-ElfRelocations::RelocationList & ElfExecutable::GetCodeRelocations()
-{
- return GetLocalRelocations().GetCodeRelocations();
-}
-
-/**
-Function to get data relocation
-@return data relocation list
-@internalComponent
-@released
-*/
-ElfRelocations::RelocationList & ElfExecutable::GetDataRelocations()
-{
- return GetLocalRelocations().GetDataRelocations();
-}
-
-/**
-Function to get RO base address
-@return RO base virtual address
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::GetROBase()
-{
- if (iCodeSegmentHdr) return iCodeSegmentHdr->p_vaddr;
- return 0;
-}
-
-/**
-Function to get RO segment
-@return code segment
-@internalComponent
-@released
-*/
-MemAddr ElfExecutable::GetRawROSegment()
-{
- return iCodeSegment;
-}
-
-/**
-Function to get RW segment virtual address
-@return RW base address
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::GetRWBase()
-{
- if (iDataSegmentHdr) return iDataSegmentHdr->p_vaddr;
- return 0;
-}
-
-/**
-Function to get Raw RW segment
-@return data segment address
-@internalComponent
-@released
-*/
-MemAddr ElfExecutable::GetRawRWSegment()
-{
- return iDataSegment;
-}
-
-/**
-Function to get RO segment size
-@return code segment size
-@internalComponent
-@released
-*/
-size_t ElfExecutable::GetROSize()
-{
- return iCodeSegmentHdr->p_filesz;
-}
-
-/**
-Function to get RW segment size
-@return data segment size
-@internalComponent
-@released
-*/
-size_t ElfExecutable::GetRWSize()
-{
- if (iDataSegmentHdr)
- return iDataSegmentHdr->p_filesz;;
- return 0;
-}
-
-/**
-Function to get Bss segment size
-@return Bss segment size, if data segment, otherwise 0
-@internalComponent
-@released
-*/
-size_t ElfExecutable::GetBssSize()
-{
- if (iDataSegmentHdr)
- return iDataSegmentHdr->p_memsz - iDataSegmentHdr->p_filesz;
- return 0;
-}
-
-/**
-Function returns entry point location in Elf image.
-@return entry point offset if valid, warning if undefined, otherwise throw error
-@internalComponent
-@released
-*/
-Elf32_Word ElfExecutable::EntryPointOffset()
-{
- if (!(iElfHeader->e_entry) && !(iCodeSegmentHdr->p_vaddr))
- {
- MessageHandler::GetInstance()->ReportMessage(WARNING, UNDEFINEDENTRYPOINTERROR,(char*)iParameterListInterface->ElfInput());
- return 0;
- }
- else if (!(iElfHeader->e_entry))
- throw ELFFormatError(ENTRYPOINTNOTSETERROR, (char*)iParameterListInterface->ElfInput());
- else
- return iElfHeader->e_entry - iCodeSegmentHdr->p_vaddr;
-}
-
-/**
-Function to check exception is present in the Elf image.
-@return True if exception present, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExecutable::ExeceptionsPresentP()
-{
- size_t nShdrs = iElfHeader->e_shnum;
- if (nShdrs)
- {
- // Find the exception index table section
- Elf32_Shdr * aShdr = ELF_ENTRY_PTR(Elf32_Shdr, iElfHeader, iElfHeader->e_shoff);
- char * aShStrTab = ELF_ENTRY_PTR(char, iElfHeader, aShdr[iElfHeader->e_shstrndx].sh_offset);
-
- for (PLUINT32 i = 0; i < nShdrs; i++)
- {
- if (aShdr[i].sh_type == SHT_ARM_EXIDX)
- {
- char * aSectionName = aShStrTab + aShdr[i].sh_name;
- if (!strcmp(aSectionName, ".ARM.exidx"))
- {
- return true;
- }
- }
- }
-
- }
- else
- throw ELFFileError(NEEDSECTIONVIEWERROR, (char*)iParameterListInterface->ElfInput());
-
- return false;
-}
-
-/**
-Function to get the exports in ordinal number order.
-@return ordered exports
-@internalComponent
-@released
-*/
-ElfExports::ExportList &ElfExecutable::GetExportsInOrdinalOrder() {
- return iExports->GetExportsInOrdinalOrder();
-}
-
-/**
-This function looks up for a symbol in the static symbol table.
-@return Elf symbol.
-@internalComponent
-@released
-*/
-Elf32_Sym * ElfExecutable::LookupStaticSymbol(char * aName) {
- size_t nShdrs = iElfHeader->e_shnum;
- if (nShdrs)
- {
- // find the static symbol table and string table
- Elf32_Shdr * aShdr = ELF_ENTRY_PTR(Elf32_Shdr, iElfHeader, iElfHeader->e_shoff);
- char * aShStrTab = ELF_ENTRY_PTR(char, iElfHeader, aShdr[iElfHeader->e_shstrndx].sh_offset);
- Elf32_Sym * aSymTab = 0;
- Elf32_Sym * aLim = 0;
- char * aStrTab = 0;
- for (PLUINT32 i = 0; i < nShdrs; i++)
- {
- if (aShdr[i].sh_type == SHT_SYMTAB)
- {
- aSymTab = ELF_ENTRY_PTR(Elf32_Sym, iElfHeader, aShdr[i].sh_offset);
- aLim = ELF_ENTRY_PTR(Elf32_Sym, aSymTab, aShdr[i].sh_size);
- if (aStrTab) break;
- }
- else if (aShdr[i].sh_type == SHT_STRTAB)
- {
- char * aSectionName = aShStrTab + aShdr[i].sh_name;
- if (!strcmp(aSectionName, ".strtab"))
- {
- aStrTab = ELF_ENTRY_PTR(char, iElfHeader, aShdr[i].sh_offset);
- if (aSymTab) break;
- }
- }
- }
-
- /*if(aHashTbl && aSymTab && aStrTab)
- {
- PLULONG aHashVal = Util::elf_hash((const PLUCHAR*)aName);
- Elf32_Sword* aBuckets = ELF_ENTRY_PTR(Elf32_Sword, aHashTbl, sizeof(Elf32_HashTable) );
- Elf32_Sword* aChains = ELF_ENTRY_PTR(Elf32_Sword, aBuckets, sizeof(Elf32_Sword)*(aHashTbl->nBuckets) );
-
- PLUINT32 aIdx = aHashVal % aHashTbl->nBuckets;
- aIdx = aBuckets[aIdx];
-
- char *aSymName;
- do {
- aSymName = ELF_ENTRY_PTR(char, aStrTab, aSymTab[aIdx].st_name);
- if( !strcmp(aSymName, aName) ) {
- return &aSymTab[aIdx];
- }
- aIdx = aChains[aIdx];
- }while( aIdx > 0 );
-
- return NULL;
- }
- else */
-
- if (aSymTab && aStrTab)
- {
- for(; aSymTab < aLim; aSymTab++)
- {
- if (!aSymTab->st_name) continue;
- char * aSymName = aStrTab + aSymTab->st_name;
- if (!strcmp(aSymName, aName))
- return aSymTab;
- }
- return 0;
- }
- else
- {
- throw ELFFileError(NOSTATICSYMBOLSERROR, (char*)iParameterListInterface->ElfInput());
- }
- }
- else
- {
- throw ELFFileError(NOSTATICSYMBOLSERROR, (char*)iParameterListInterface->ElfInput());
- }
-}
-
-/**
-Function to get imports
-@return imports
-@internalComponent
-@released
-*/
-ElfImports::ImportMap ElfExecutable::GetImports() {
- return iImports.GetImports();
-}
-
-/**
-Function to get exports
-@return exports
-@internalComponent
-@released
-*/
-ElfExports* ElfExecutable::GetExports() {
- return iExports;
-}
-
-/**
-Function to get fixup location
-@param aReloc - Instance of class ElfLocalRelocation
-@param aPlace -
-@return addres of position for relocation
-@internalComponent
-@released
-*/
-Elf32_Word* ElfExecutable::GetFixupLocation(ElfLocalRelocation* aReloc, Elf32_Addr aPlace)
-{
- Elf32_Phdr * aPhdr = aReloc->ExportTableReloc() ?
- iCodeSegmentHdr :
- Segment(aPlace);
- Elf32_Word offset = aPhdr->p_offset + aPlace - aPhdr->p_vaddr;
- return ELF_ENTRY_PTR(Elf32_Word, iElfHeader, offset);
-}
-
-/**
-Function to get the segment type
-@param aSym - Symbol
-@return Segment type
-@internalComponent
-@released
-*/
-ESegmentType ElfExecutable::Segment(Elf32_Sym *aSym)
-{
- Elf32_Phdr * aHdr;
-
- try {
-
- bool limitSymbolFound = false;
-
- // If Symbol is absolute then assume it came from linker and is a
- // limit symbol.
- if (aSym->st_shndx == SHN_ABS)
- {
- aHdr = SegmentFromAbs(aSym->st_value);
- }
- else
- {
- if( (iCodeSegmentHdr && aSym->st_value == (iCodeSegmentHdr->p_vaddr + iCodeSegmentHdr->p_memsz)) ||
- (iDataSegmentHdr && aSym->st_value == (iDataSegmentHdr->p_vaddr + iDataSegmentHdr->p_memsz)) )
- {
- //If Symbol is a $$Limit symbol, then consider the open boundary.
- String limitstr = iStringTable + aSym->st_name;
- if (limitstr.rfind("$$Limit",limitstr.length()) != String::npos)
- {
- aHdr = SegmentFromAbs(aSym->st_value);
- limitSymbolFound = true;
- }
- }
-
- if(!limitSymbolFound )
- {
- aHdr = Segment(aSym->st_value);
- }
-
- }
-
- if (aHdr == iCodeSegmentHdr)
- {
- return ESegmentRO;
- }
- else if (aHdr == iDataSegmentHdr)
- {
- return ESegmentRW;
- }
- }
- catch(...)
- {
- }
- return ESegmentUndefined;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfexecutable.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfExecutable for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFEXECUTABLE_H_)
-#define _PL_ELFEXECUTABLE_H_
-
-#include "pl_common.h"
-#include <list>
-#include <hash_map>
-#include "pl_elfimports.h"
-#include "pl_elfrelocations.h"
-#include "pl_elfexports.h"
-
-using std::list;
-using std::hash_map;
-
-class DllSymbol;
-class Symbol;
-class ElfRelocations;
-class ElfExports;
-class ParameterListInterface;
-class ElfLocalRelocation;
-/**
-This class is for ELF object carrying the elf header, sections, segments.
-@internalComponent
-@released
-*/
-class ElfExecutable
-{
-
-public:
- ElfExecutable(ParameterListInterface *aParameterListInterface);
- virtual ~ElfExecutable();
-
- PLUINT32 ProcessElfFile(Elf32_Ehdr *aElfHdr);
- void DumpElfFile(char* aFile);
-
- PLUINT32 ProcessSymbols();
- ElfImports::ImportMap GetImports();
- ElfExports* GetExports();
- DllSymbol* AddToExports(char* aDll, DllSymbol* aSymbol);
- void AddToImports(ElfImportRelocation* aReloc);
- PLUINT32 AddToRelocations(ElfRelocation* aReloc);
- void AddToLocalRelocations(ElfRelocation* aReloc);
- void ProcessVerInfo();
-
- Elf32_Sym* FindSymbol(char* aSymName);
-
- PLUINT32 GetSymbolOrdinal( char* aSymName);
- PLUINT32 GetSymbolOrdinal( Elf32_Sym* );
- char* GetSymbolName( PLUINT32 aSymIdx);
- Elf32_Word GetRelocationOffset(ElfRelocation * aReloc);
- Elf32_Word *GetRelocationPlace(ElfRelocation * aReloc);
-
- Elf32_Word GetROBase();
- Elf32_Word GetRWBase();
- size_t GetROSize();
- size_t GetRWSize();
- size_t GetBssSize();
- MemAddr GetRawROSegment();
- MemAddr GetRawRWSegment();
- Elf32_Word EntryPointOffset();
- ESegmentType SegmentType(Elf32_Addr aAddr);
- Elf32_Phdr* Segment(Elf32_Addr aAddr);
- ElfRelocations::RelocationList & GetCodeRelocations();
- ElfRelocations::RelocationList & GetDataRelocations();
- ElfRelocations& GetLocalRelocations();
- bool ExeceptionsPresentP();
- ElfExports::ExportList& GetExportsInOrdinalOrder();
- Elf32_Sym* LookupStaticSymbol(char * aName);
-public:
- /**
- * The elf header pointer which points to the base of the file records
- */
- Elf32_Ehdr *iElfHeader;
- Elf32_Addr iEntryPoint;
- /**
- * The dynamic program header of the elf file
- */
- Elf32_Phdr *iProgHeader;
-
- PLUINT32 iSONameOffset;
- char *iSOName;
- /**
- * This member points to the base of the section header table.
- */
- Elf32_Shdr *iSections;
- Elf32_Verdef *iVersionDef;
- PLUINT32 iVerDefCount;
- Elf32_Verneed *iVersionNeed;
- PLUINT32 iVerNeedCount;
- Elf32_Half *iVersionTbl;
- PLUINT32 iRelSize;
- PLUINT32 iRelEntSize;
- PLUINT32 iNRelocs;
- Elf32_Rel *iRel;
- PLUINT32 iRelaSize;
- PLUINT32 iRelaEntSize;
- Elf32_Rela *iRela;
- char *iStringTable;
- char *iSectionHdrStrTbl;
-
- list<char*> iNeeded;
- VersionInfo *iVerInfo;
- /**
- * The dynamic symbol array.
- */
- Elf32_Sym *iElfDynSym;//The ELF symbol
- hash_map<PLUINT32, DllSymbol*> iSymbolTable; //The representation
-
- /**
- * The static symbol table.
- */
- Elf32_Sym *iSymTab;
- char *iStrTab;
- Elf32_Sym *iLim;
-
- PLUINT32 iNSymbols;
- Elf32_HashTable *iHashTbl;
- Elf32_Phdr *iDynSegmentHdr;
- Elf32_Phdr *iDataSegmentHdr;
- MemAddr iDataSegment;
- size_t iDataSegmentSize;
- PLUINT32 iDataSegmentIdx;
- Elf32_Phdr *iCodeSegmentHdr;
- MemAddr iCodeSegment;
- size_t iCodeSegmentSize;
- PLUINT32 iCodeSegmentIdx;
- ElfImports iImports;
- ElfExports *iExports;
- ElfRelocations iLocalRelocations;
- ParameterListInterface *iParameterListInterface;
- PLUINT32 iPltGotBase;
- PLUINT32 iPltGotLimit;
- PLUINT32 iStrTabSz;
- PLUINT32 iSymEntSz;
- Elf32_Word *iPltGot;
- PLUINT32 iPltRelType;
- Elf32_Rel *iPltRel;
- PLUINT32 iPltRelaSz;
- Elf32_Rela *iPltRela;
- PLUINT32 iPltRelSz;
- PLUINT32 iJmpRelOffset;
-
- PLUINT32 ValidateElfFile();
- PLUINT32 ProcessDynamicEntries();
- void ProcessRelocations();
- template <class T> void ProcessRelocations(T *aElfRel, size_t aSize);
-
- VersionInfo* GetVersionInfo(PLUINT32 aIndex);
- char* SymbolDefinedInDll(PLUINT32 aSymbolIndex);
- void SetVersionRecord( ElfRelocation* aReloc );
-
-/** This function says if the Symbol is a global symbol
-@return It returns true if the Symbol is a global one.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool GlobalSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol is Exported
-@return It returns true if the Symbol is an exported one.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool ExportedSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol is Imported
-@return It returns true if the Symbol is an imported one.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool ImportedSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol is a Code Symbol
-@return It returns true if the Symbol is of Code type.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool FunctionSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol is a Data Symbol
-@return It returns true if the Symbol is of Data type.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool DataSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol is Defined
-@return It returns true if the Symbol is defined.
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool DefinedSymbol(Elf32_Sym* aSym);
-
-/** This function says if the Symbol has a default Visibility
-@return It returns true if the Symbol has a default Visibility
-@param aSym The reference to the Symbol whose attribute is being checked
-*/
-bool VisibleSymbol(Elf32_Sym* aSym);
-
-/** This function finds the segment in which this address belongs
-@return the segment type
-@param aAddr The address within the executable
-*/
-
-Elf32_Word Addend(Elf32_Rel* aRel);
-Elf32_Word Addend(Elf32_Rela* aRel);
-
-char* SymbolFromDSO(PLUINT32 aSymbolIndex);
-Elf32_Word* GetFixupLocation(ElfLocalRelocation* aReloc, Elf32_Addr aPlace);
-ESegmentType Segment(Elf32_Sym *aSym);
-Elf32_Phdr* SegmentFromAbs(Elf32_Addr aAddr);
-Elf32_Phdr* Segment(ESegmentType aType);
-
-/** This function processes the linker generated Veneer symbols and
- * creates a relocation entry.
- */
-void ProcessVeneers();
-/** This function processes the ELF file to find the static symbol table.
-*/
-void FindStaticSymbolTable();
-/** This function finds the .comment section
-@return the pointer to the comment section
-*/
-char* FindCommentSection();
-/** This function finds the value at the address passed in
-@return the value at the address passed in
-@param aAddr The address within the executable
-*/
-Elf32_Word FindValueAtLoc(Elf32_Addr aOffset);
-};
-
-
-
-
-#endif // !defined(_PL_ELFEXECUTABLE_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfexports.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfExports for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfexports.h"
-#include "pl_elfexecutable.h"
-#include "pl_dllsymbol.h"
-
-using std::set_difference;
-
-/**
-Constructor for class ElfExports
-@internalComponent
-@released
-*/
-ElfExports::ElfExports() : iDllName(NULL), iSorted(false), iExportsFilteredP(false){
-}
-
-/**
-Destructor for class ElfExports
-@internalComponent
-@released
-*/
-ElfExports::~ElfExports()
-{
- if(iExportList.size())
- {
- ExportList::iterator aItr = iExportList.begin();
- ExportList::iterator last = iExportList.end();
- DllSymbol *temp;
-
- while( aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- }
- iExportList.clear();
-
-}
-
-/**
-This function validates exported symbols. The typeinfo name strings
-are not valid export symbols and are discarded.
-@param aExecutable - Instance of class ElfExecutable
-@param aSym - DllSymbol
-@return True if symbol is valid, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExports::ValidExportP(ElfExecutable * aExecutable, DllSymbol * aSym)
-{
- char * aSymName = aExecutable->GetSymbolName(aSym->iSymbolIndex);
- int result = strncmp(aSymName, "_ZTS", strlen("_ZTS"));
- return ( result != 0);
-}
-
-/**
-This function adds export symbols into exports list.
-@param aDll - Dll name
-@param aExecutable - Instance of class ElfExecutable
-@param aSym - Dll symbol
-@return Dll Symbol if its valid, otherwise NULL
-@internalComponent
-@released
-*/
-DllSymbol* ElfExports::Add(char *aDll, ElfExecutable * aExecutable, DllSymbol *aSym)
-{
- if (ValidExportP(aExecutable, aSym))
- {
- if( !iDllName )
- iDllName = aDll;
-
- iExportList.push_back(aSym);
- iSorted = false;
- return aSym;
- }
- return NULL;
-}
-
-/**
-Function to add elf exports
-@param aDll - Dll name
-@param aSym - Dll symbol
-@internalComponent
-@released
-*/
-void ElfExports::Add(char *aDll, DllSymbol *aSym)
-{
- if( !iDllName )
- iDllName = aDll;
- iExportList.push_back(aSym);
- iSorted = false;
-}
-
-/**
-Function to sort elf exports. Sorting may be done based on the symbol
-name or on the ordinal number depending on the usecase.
-@internalComponent
-@released
-*/
-void ElfExports::Sort()
-{
- if (!iSorted) {
- if(iExportsFilteredP) {
- std::sort(iFilteredExports.begin(), iFilteredExports.end(), PtrELFExportNameCompare());
- }
- else {
- std::sort(iExportList.begin(), iExportList.end(), PtrELFExportNameCompare());
- }
- iSorted = true;
- }
-}
-
-/**
-Function to get exports list.
-@param aSorted - sort before returning the exports.
-@return export list
-@internalComponent
-@released
-*/
-ElfExports::ExportList & ElfExports::GetExports(bool aSorted)
-{
- if (aSorted) Sort();
-
- if(iExportsFilteredP)
- return iFilteredExports;
- else
- return iExportList;
-}
-
-/**
-Function to get exports in ordinal order
-@return export list
-@internalComponent
-@released
-*/
-ElfExports::ExportList & ElfExports::GetExportsInOrdinalOrder()
-{
- if (iExportsFilteredP)
- {
- std::sort(iFilteredExports.begin(), iFilteredExports.end(), PtrELFExportOrdinalCompare());
- return iFilteredExports;
- }
- else
- {
- std::sort(iExportList.begin(), iExportList.end(), PtrELFExportOrdinalCompare());
- return iExportList;
- }
-}
-
-/**
-Function to process the filtered exports
-@internalComponent
-@released
-*/
-void ElfExports::FilterExports()
-{
- std::sort(iExportList.begin(), iExportList.end(), PtrELFExportNameCompare());
- std::sort(iFilteredExports.begin(), iFilteredExports.end(), PtrELFExportNameCompare());
-
- ExportList aNewList(iExportList.size());
- ExportList::iterator aNewListBegin = aNewList.begin();
-
- ExportList::iterator aNewListEnd = set_difference(iExportList.begin(), iExportList.end(), \
- iFilteredExports.begin(), iFilteredExports.end(), aNewListBegin, PtrELFExportNameCompare());
-
- iFilteredExports.clear();
- while (aNewListBegin != aNewListEnd)
- {
- iFilteredExports.push_back(*aNewListBegin);
- aNewListBegin++;
- }
-}
-
-/**
-Function to get number of exports
-@return size of export list
-@internalComponent
-@released
-*/
-size_t ElfExports::GetNumExports()
-{
- return iExportList.size();
-}
-
-/**
-Function to get Dll name
-@return Dll name
-@internalComponent
-@released
-*/
-char* ElfExports::DllName()
-{
- return iDllName;
-}
-
-/**
-Overloaded operator to compare ELF export names.
-@return True if lhs symbol name < rhs symbol name, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExports::PtrELFExportNameCompare::operator()(const Symbol * lhs, const Symbol * rhs) const
-{
- return strcmp( lhs->SymbolName(), rhs->SymbolName()) < 0;
-}
-
-/**
-Overloaded operator to compare ordinal numbers of symbols.
-@return True if lhs symbol name < rhs symbol name, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExports::PtrELFExportOrdinalCompare::operator()(const Symbol * lhs, const Symbol * rhs) const
-{
- return lhs->OrdNum() < rhs->OrdNum();
-}
-
-/**
-Overloaded operator to compare update symbol attributes that are
-being compared. The comparision is done on the symbol names.
-@return True if lhs symbol name < rhs symbol name, otherwise false
-@internalComponent
-@released
-*/
-bool ElfExports::PtrELFExportNameCompareUpdateAttributes::operator()(const Symbol * lhs, const Symbol * rhs) const
-{
- int result = strcmp(lhs->SymbolName(), rhs->SymbolName());
- if (!result)
- {
- if (lhs->OrdNum() > 0)
- ((Symbol*)rhs)->SetOrdinal( lhs->OrdNum());
- else if (rhs->OrdNum() > 0)
- ((Symbol*)lhs)->SetOrdinal( rhs->OrdNum());
-
- if( ((Symbol*)lhs)->Absent() )
- ((Symbol*)rhs)->SetAbsent(true);
- else if ( ((Symbol*)rhs)->Absent() )
- ((Symbol*)lhs)->SetAbsent(true);
-
- if( ((Symbol*)lhs)->SymbolSize() )
- ((Symbol*)rhs)->SetSymbolSize(((Symbol*)lhs)->SymbolSize());
- else if( ((Symbol*)rhs)->SymbolSize() )
- ((Symbol*)lhs)->SetSymbolSize(((Symbol*)rhs)->SymbolSize());
- }
- return result < 0;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfexports.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfExports for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFEXPORTS_H_)
-#define _PL_ELFEXPORTS_H_
-
-#include "pl_common.h"
-#include <vector>
-#include <functional>
-#include <algorithm>
-
-using std::vector;
-using std::binary_function;
-
-class ElfExecutable;
-class DllSymbol;
-class Symbol;
-
-/**
-This class is for exports coming from elf file.
-(Corresponding to the exported symbols defined in the given DLL. These exports are filtered
-by individual targets as per their requirements(relating to class impedimenta). While
-processing these exports, they are also to update the ordinal numbers before these exports
-are written into the dso file.
-@internalComponent
-@released
-*/
-class ElfExports
-{
-
-public:
- typedef std::vector<DllSymbol*> ExportList;
-
-
- struct PtrELFExportNameCompare :
- binary_function<const Symbol *, const Symbol *, bool>
- {
- bool operator()(const Symbol * lhs, const Symbol * rhs) const;
- };
-
- struct PtrELFExportOrdinalCompare :
- binary_function<const Symbol *, const Symbol *, bool>
- {
- bool operator()(const Symbol * lhs, const Symbol * rhs) const;
- };
-
- struct PtrELFExportNameCompareUpdateAttributes :
- binary_function<const Symbol *, const Symbol *, bool>
- {
- bool operator()(const Symbol * lhs, const Symbol * rhs) const;
- };
-
-
- ElfExports();
- ~ElfExports();
-
- bool ValidExportP(ElfExecutable * aExecutable, DllSymbol * aSym);
- void FilterExports();
- DllSymbol* Add(char *aDll, ElfExecutable * aExecutable, DllSymbol *aSym);
- void Add(char *aDll, DllSymbol *aSym);
- void Sort();
- void ExportsFilteredP(bool aExportsFilteredP)
- {
- iExportsFilteredP = aExportsFilteredP;
- }
- bool ExportsFilteredP() {return iExportsFilteredP;}
-
- char* DllName();
- ExportList& GetExports(bool) ;
- ExportList& GetExportsInOrdinalOrder();
- size_t GetNumExports();
- ExportList iFilteredExports;
-
-private:
- ExportList iExportList;
- char *iDllName;
- bool iSorted;
- bool iExportsFilteredP;
-};
-
-
-
-
-#endif // !defined(_PL_ELFEXPORTS_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfimportrelocation.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfImportRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfimportrelocation.h"
-#include "pl_elfexecutable.h"
-
-
-/**
-Constructor for class ElfImportRelocation
-@param aElfExec - Instance of class ElfExecutable
-@param aAddr
-@param aAddend
-@param aIndex
-@param aRelType
-@param aRel
-@internalComponent
-@released
-*/
-ElfImportRelocation::ElfImportRelocation(ElfExecutable *aElfExec,PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel): \
- ElfRelocation(aElfExec, aAddr, aAddend, aIndex, aRelType, aRel), \
- iVerRecord(NULL)
-{
- iSymbol = &(aElfExec->iElfDynSym[iSymNdx]);
- iSegment = aElfExec->Segment(iAddr);
- iSegmentType = aElfExec->SegmentType(iAddr);
-}
-
-
-
-/**
-Destructor for class ElfImportRelocation
-@internalComponent
-@released
-*/
-ElfImportRelocation::~ElfImportRelocation(){
-
-}
-
-
-/**
-Function to know is import relocation
-@internalComponent
-@released
-*/
-bool ElfImportRelocation::IsImportRelocation(){
- return true;
-}
-
-/**
-Function to add import relocation
-@internalComponent
-@released
-*/
-void ElfImportRelocation::Add() {
- iElfExec->AddToImports(this);
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfimportrelocation.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfImportRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFIMPORTRELOCATION_H_)
-#define _PL_ELFIMPORTRELOCATION_H_
-
-#include "pl_elfrelocation.h"
-
-/**
-This class represents relocation entries corresponding to the import symbols.
-@internalComponent
-@released
-*/
-class ElfImportRelocation : public ElfRelocation
-{
-
-public:
- ElfImportRelocation(ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel);
- ~ElfImportRelocation();
- bool IsImportRelocation();
- void Add();
-
- VersionInfo *iVerRecord;
-};
-
-
-
-
-#endif // !defined(_PL_ELFIMPORTRELOCATION_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfimports.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfImports for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfimports.h"
-#include "pl_elfimportrelocation.h"
-
-/**
-Constructor for class ElfImports
-@internalComponent
-@released
-*/
-ElfImports::ElfImports(){
-
-}
-
-/**
-Destructor for class ElfImports to release allocated memory
-@internalComponent
-@released
-*/
-ElfImports::~ElfImports()
-{
-
- if(iImports.size())
- {
- ImportMap::iterator aItr = iImports.begin();
- ImportMap::iterator last = iImports.end();
- RelocationList *rlistTemp;
-
- while( aItr != last)
- {
- rlistTemp = &((*aItr).second);
- RelocationList::iterator aItr1 = rlistTemp->begin();
- RelocationList::iterator last1 = rlistTemp->end();
- ElfImportRelocation *temp;
-
- while( aItr1 != last1)
- {
- temp = *aItr1;
- aItr1++;
- delete temp;
- }
- aItr++;
- rlistTemp->clear();
- }
- }
-
- iImports.clear();
-}
-
-
-/**
-Function to add imports
-@param aDllName - Dll name
-@param aReloc - Elf import relocation
-@internalComponent
-@released
-*/
-void ElfImports::Add(const char* aDllName, ElfImportRelocation *aReloc){
- iImports[aDllName].insert(iImports[aDllName].end(), aReloc);
-}
-
-
-/**
-Function to get import size
-@return import size
-@internalComponent
-@released
-*/
-PLUINT32 ElfImports::GetImportSize(){
-
- PLUINT32 aSize = 0;
-
- ImportMap::iterator aItr = iImports.begin();
- RelocationList aList;
-
- while(aItr != iImports.end()) {
- aList = ((*aItr).second);
- aSize += aList.size();
- aItr++;
- }
- return aSize;
-}
-
-
-/**
-Overloaded operator comparing the symbol names.
-@return True if lhs string is less then rhs, otherwise false
-@internalComponent
-@released
-*/
-bool ElfImports::StringPtrLess::operator() (const char * lhs, const char * rhs) const
-{
- return strcmp(lhs, rhs) < 0;
-}
-
-/**
-Function to get imports
-@return imports
-@internalComponent
-@released
-*/
-ElfImports::ImportMap& ElfImports::GetImports()
-{
- return iImports;
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfimports.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfImports for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#if !defined(_PL_ELFIMPORTS_H_)
-#define _PL_ELFIMPORTS_H_
-
-#include "pl_common.h"
-#include <vector>
-#include <map>
-
-using std::vector;
-using std::map;
-using std::binary_function;
-
-class ElfImportRelocation;
-
-/**
-This class get the list of symbols imported from a list of DSOs.
-@internalComponent
-@released
-*/
-class ElfImports
-{
-
-public:
- struct StringPtrLess : binary_function<const char *, const char *, bool>
- {
- bool operator() (const char * lhs, const char * rhs) const;
- };
-
- typedef std::vector<ElfImportRelocation*> RelocationList;
-
- typedef std::map<const char*, RelocationList, StringPtrLess> ImportMap;
-
- ElfImports();
- ~ElfImports();
-
- void Add(const char* aDll, ElfImportRelocation *aReloc);
- PLUINT32 GetImportSize();
- ImportMap& GetImports();
-
-private:
- ImportMap iImports;
-
-};
-
-
-
-
-#endif // !defined(_PL_ELFIMPORTS_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elflocalrelocation.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfLocalRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elflocalrelocation.h"
-#include "pl_elfexecutable.h"
-#include "e32imagedefs.h"
-
-/**
-Constructor for class ElfLocalRelocation
-@param aElfExec - Instance of class ElfExecutable
-@param aAddr - location where the relocation refers to.
-@param aAddend - addend for the relocation entry
-@param aIndex - symbol index
-@param aRelType - Relocation type
-@param aRel - Elf relocation entry
-@internalComponent
-@released
-*/
-ElfLocalRelocation::ElfLocalRelocation(ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel, bool aVeneerSymbol): \
- ElfRelocation(aElfExec, aAddr, aAddend, aIndex, aRelType, aRel)
-{
- iSegment = aElfExec->Segment( iAddr );
- iSegmentType = aElfExec->SegmentType( iAddr );
- iSymbol = &(aElfExec->iElfDynSym[iSymNdx]);
- iDelSym = false;
- iVeneerSymbol = aVeneerSymbol;
-}
-
-/**
-Constructor for class ElfLocalRelocation
-@param aElfExec - Instance of class ElfExecutable
-@param aAddr - location where the relocation refers to.
-@param aAddend - addend for the relocation entry
-@param aIndex
-@param aRelType - Relocation type
-@param aRel - Elf relocation entry
-@param aSegmentType - Segment type
-@param aSym - Elf symbol
-@param aDelSym - indicate if the symbol is to be deleted by this relocation.
-@internalComponent
-@released
-*/
-ElfLocalRelocation::ElfLocalRelocation(ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel, ESegmentType aSegmentType, Elf32_Sym* aSym,bool aDelSym, bool aVeneerSymbol): \
- ElfRelocation(aElfExec, aAddr, aAddend, aIndex, aRelType, aRel)
-{
- iSegmentType = aSegmentType;
- iSegment = aElfExec->Segment(aSegmentType);
- //iSymbol = &(aElfExec->iElfDynSym[iSymNdx]);
- iSymbol = aSym;
- iDelSym = aDelSym;
- iVeneerSymbol = aVeneerSymbol;
-}
-
-
-/**
-Destructor for class ElfLocalRelocation
-@internalComponent
-@released
-*/
-ElfLocalRelocation::~ElfLocalRelocation()
-{
- if(iDelSym)
- {
- DELETE_PTR(iSymbol);
- }
-
-}
-
-
-/**
-This function overrides the virtual function to indicate that this
-relocation is not an import relocation.
-@return false
-@internalComponent
-@released
-*/
-bool ElfLocalRelocation::IsImportRelocation(){
- return false;
-}
-
-/**
-Function to add local relocations
-@internalComponent
-@released
-*/
-void ElfLocalRelocation::Add() {
- iElfExec->AddToLocalRelocations(this);
-}
-
-/**
-This function adjusts the fixup for the relocation entry.
-@return - Relocation type
-@internalComponent
-@released
-*/
-PLUINT16 ElfLocalRelocation::Fixup()
-{
- if(!ExportTableReloc() && !iVeneerSymbol)
- {
- Elf32_Word * aLoc = iElfExec->GetFixupLocation(this, iAddr);
- Elf32_Word aLocVal = * aLoc;
-
- if (iRelType == R_ARM_ABS32 || iRelType == R_ARM_GLOB_DAT )
- {
-
- Elf32_Word aFixedVal = aLocVal + iSymbol->st_value;
- *aLoc = aFixedVal;
- }
- }
-
- ESegmentType aType;
- if( iSymbol )
- aType = iElfExec->Segment(iSymbol);
- else
- aType = iSegmentType;
-
- if (aType == ESegmentRO)
- return KTextRelocType;
- else if (aType == ESegmentRW)
- return KDataRelocType;
-
- // maybe this should be an error
- return KInferredRelocType;
-}
-
-/**
-Function for export table relocation
-@return - True
-@internalComponent
-@released
-*/
-bool ElfLocalRelocation::ExportTableReloc()
-{
- return iRel == 0;
-}
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elflocalrelocation.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfLocalRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFLOCALRELOCATION_H)
-#define _PL_ELFLOCALRELOCATION_H
-
-#include "pl_elfrelocation.h"
-
-/**
-This class represents relocations generated by the linker that need to be interpreted into
-the E32 image.
-@internalComponent
-@released
-*/
-class ElfLocalRelocation : public ElfRelocation
-{
-
-public:
- ElfLocalRelocation(ElfExecutable *aElfExec,PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel, bool aVeneerSymbol=false);
- ElfLocalRelocation(ElfExecutable *aElfExec,PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel, ESegmentType aSegmentType, Elf32_Sym* aSym, bool aDelSym, bool aVeneerSymbol=false);
- ~ElfLocalRelocation();
- bool IsImportRelocation();
- void Add();
-
- bool ExportTableReloc();
- PLUINT16 Fixup();
- bool iDelSym;
- bool iVeneerSymbol;
-};
-
-
-
-
-#endif // !defined(_PL_ELFLOCALRELOCATION_H)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfproducer.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,688 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfProducer for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfproducer.h"
-#include "pl_dllsymbol.h"
-#include <stdio.h>
-#include <string>
-#include "errorhandler.h"
-
-/**
- * Following array is indexed on the SECTION_INDEX enum
- */
-char* SECTION_NAME[] = {
- "",
- "ER_RO",
- ".dynamic",
- ".hash",
- ".version_d",
- ".version",
- ".strtab",
- ".dynsym",
- ".shstrtab"
-};
-
-
-/**
-Constructor for class ElfProducer
-@param aParameterListInterface - instance of class ParameterListInterface
-@internalComponent
-@released
-*/
-ElfProducer::ElfProducer(ParameterListInterface *aParameterListInterface): ElfExecutable(aParameterListInterface) , \
- iDSONameOffset(0),\
- iLinkAsOffset(0),\
- iSymbolsList(NULL),
- iDSODaux(NULL), \
- iDSOBuckets(NULL), \
- iDSOChains(NULL),\
- iCodeSectionData(NULL),\
- iElfFileOffset(0)
-{
-}
-
-
-
-/**
-Destructor for class ElfProducer to release allocated memory
-@internalComponent
-@released
-*/
-ElfProducer::~ElfProducer(){
- Cleanup();
-}
-
-
-/**
-This function sets the export Symbol list
-@internalComponent
-@released
-@param aSymbolList The export Symbol list.
-*/
-void ElfProducer::SetSymbolList(SymbolList& aSymbolList){
- iSymbolsList = &aSymbolList;
- if (iSymbolsList)
- {
- SymbolList::iterator aPos, aEnd;
- aPos = iSymbolsList->begin();
- aEnd = iSymbolsList->end();
- char *aAbsentSymbol = "_._.absent_export_";
- int length = strlen(aAbsentSymbol);
- while(aPos != aEnd)
- {
- /* If a symbol is marked as Absent in the DEF file, replace the
- * symbol name with "_._.absent_export_<Ordinal Number>"
- */
- if((*aPos)->Absent())
- {
- int aOrdinalNo = (*aPos)->OrdNum();
- // Ordinal Number can be upto 0xffff which is 6 digits
- char * aSymName = new char[length+7];
- sprintf(aSymName, "_._.absent_export_%d", aOrdinalNo);
- (*aPos)->SetSymbolName(aSymName);
- delete[] aSymName;
- }
- aPos++;
- }
- }
- iNSymbols = iSymbolsList->size() + 1;
-}
-
-/**
-This function takes the file names and generates the proxy dso library.
-@internalComponent
-@released
-@param aDsoFullName The full path and proxy-dso file name
-@param aDsoFileName The proxy-dso file name
-@param aLinkAs The DLL that defines the export Symbols
-*/
-void ElfProducer::WriteElfFile(char* aDsoFullName, char* aDsoFileName , char* aLinkAs){
-
- //This includes the full path followed by the file name
- iDsoFullName = aDsoFullName;
-
- iDSOName = aDsoFileName;
- iLinkAs = aLinkAs;
-
- InitElfContents();
-
- WriteElfContents();
-}
-
-/**
-This function initializes the Elf members
-@internalComponent
-@released
-*/
-void ElfProducer::InitElfContents() {
-
- iElfHeader = new Elf32_Ehdr;
- iSections = new Elf32_Shdr[MAX_SECTIONS+1];
-
- iElfDynSym = new Elf32_Sym[iNSymbols];
- iVersionTbl = new Elf32_Half[iNSymbols];
- iVersionDef = new Elf32_Verdef[2];
- iDSODaux = new Elf32_Verdaux[2];
-
- iProgHeader = new Elf32_Phdr[2];
- iCodeSectionData = new PLUINT32[iNSymbols];
-
- iHashTbl = new Elf32_HashTable;
-
- //premeditated
- iHashTbl->nBuckets = (iNSymbols /3) + (iNSymbols % 0x3);
-
- iHashTbl->nChains = iNSymbols;
-
- iDSOBuckets = new Elf32_Sword[iHashTbl->nBuckets];
- iDSOChains = new Elf32_Sword[iHashTbl->nChains];
-
- Elf32_Sword aNullPtr = 0;
-
- memset(iDSOBuckets, aNullPtr, sizeof(Elf32_Sword)*iHashTbl->nBuckets);
- memset(iDSOChains, aNullPtr, sizeof(Elf32_Sword)*iHashTbl->nChains);
- memset(iCodeSectionData, 0, sizeof(PLUINT32)*iNSymbols);
-
- CreateElfHeader();
-
- SymbolList::iterator aItr = iSymbolsList->begin();
- SymbolList::iterator aEnd = iSymbolsList->end();
- Symbol *aSym;
- PLUINT32 aIdx = 1;
-
- memset( &iElfDynSym[0], 0, sizeof(Elf32_Sym));
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);
-
- while(aItr != aEnd) {
- String aSymName("");
- aSym = *aItr;
- aSymName = aSym->SymbolName();
- //set symbol info..
- iElfDynSym[aIdx].st_name = iDSOSymNameStrTbl.size();
-
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), aSymName.begin(), aSymName.end() );
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);
-
- SetSymolFields( aSym, &iElfDynSym[aIdx], aIdx);
-
- //set version table info...
- iVersionTbl[aIdx] = DEFAULT_VERSION;
- AddToHashTable(aSym->SymbolName(), aIdx);
- aItr++;aIdx++;
- }
-
- CreateVersionTable();
-
- //Fill section headers...
- CreateSections();
-
- //Copy dyn entries..
- CreateDynamicEntries();
-
- //create code section data - this has the ordinal numbers...
- CreateProgHeader();
-}
-
-/**
-This function creates the version definition table
-@internalComponent
-@released
-*/
-void ElfProducer::CreateVersionTable()
-{
- //Fill verdef table...
- iVersionDef[0].vd_ndx = 1;
- iVersionDef[0].vd_cnt = 1;
- iVersionDef[0].vd_flags = 1;
- iVersionDef[0].vd_hash = Util::elf_hash((const PLUCHAR*) iDSOName.c_str());
- iVersionDef[0].vd_version = 1;
-
- iVersionDef[0].vd_aux = sizeof(Elf32_Verdef);
- iVersionDef[0].vd_next = sizeof(Elf32_Verdef) + sizeof(Elf32_Verdaux);
-
- iDSONameOffset = iDSOSymNameStrTbl.size();
-
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(),iDSOName.begin(), iDSOName.end());
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);
-
- iDSODaux[0].vda_name = iDSONameOffset;
- iDSODaux[0].vda_next = 0;
-
- iVersionDef[1].vd_ndx = DEFAULT_VERSION;
- iVersionDef[1].vd_cnt = 1;
- iVersionDef[1].vd_flags = 0;
- iVersionDef[1].vd_hash = Util::elf_hash((const PLUCHAR*)iLinkAs.c_str());
- iVersionDef[1].vd_version = 1;
-
- iVersionDef[1].vd_aux = sizeof(Elf32_Verdef);
- iVersionDef[1].vd_next = 0;
-
- iLinkAsOffset = iDSOSymNameStrTbl.size();
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(),iLinkAs.begin(), iLinkAs.end());
- iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);
-
- iDSODaux[1].vda_name = iLinkAsOffset;
- iDSODaux[1].vda_next = 0;
-
-}
-
-/**
-This function sets the Elf Symbol fields
-@internalComponent
-@released
-@param aSym The Symbol representation
-@param aElfSym The Elf Symbol
-@param aCodeIndex The index at which this Symbol refers to in the code section where, we have the ordinal number
-*/
-void ElfProducer::SetSymolFields(Symbol *aSym, Elf32_Sym* aElfSym, PLUINT32 aCodeIndex) {
-
- aElfSym->st_other = STV_DEFAULT;
-
- aElfSym->st_info = (PLUCHAR) (ELF32_ST_INFO(STB_GLOBAL, aSym->CodeDataType()));
- aElfSym->st_value = (aCodeIndex - 1)*sizeof(Elf32_Word);
-
- if(aSym->CodeDataType() == SymbolTypeCode){
- aElfSym->st_size = sizeof(Elf32_Word);
- }else{
- aElfSym->st_size = aSym->SymbolSize();
- }
- aElfSym->st_shndx = CODE_SECTION;
-}
-
-/**
-This function adds an entry into the hash table based on the symbol name.
-@internalComponent
-@released
-@param aSymName The Symbol name
-@param aIndex The Symbol index in the Symbol table
-*/
-void ElfProducer::AddToHashTable(const char* aSymName, PLUINT32 aIndex)
-{
- Elf32_Sword aNullPtr = 0;
-
- PLULONG aHash = Util::elf_hash((PLUCHAR*)aSymName);
- PLUINT32 aBIdx = aHash % iHashTbl->nBuckets;
-
- if(iDSOBuckets[aBIdx] == aNullPtr)
- {
- iDSOBuckets[aBIdx] = aIndex;
- }
- else
- {
- PLUINT32 aCIdx = iDSOBuckets[aBIdx];
-
- while(iDSOChains[aCIdx] != aNullPtr){
-
- /* If the entry is already added into the hash table*/
- if((PLUINT32)iDSOChains[aCIdx] == aIndex) {
- return;
- }
- aCIdx = iDSOChains[aCIdx];
- }
- iDSOChains[aCIdx] = aIndex;
- }
-}
-
-/**
-This function creates the different sections of the Elf file
-@internalComponent
-@released
-*/
-void ElfProducer::CreateSections() {
- PLUINT32 aIdx = 0;
-
- //clear the first section...
- memset(&iSections[0], 0, sizeof(Elf32_Shdr));
- iDSOSectionNames.insert(iDSOSectionNames.begin(), 0);
-
- // Set the ELF file offset.
- // This indicates the start of sections.
- iElfFileOffset = sizeof(Elf32_Ehdr);
-
- iElfFileOffset += (sizeof(Elf32_Shdr) * iElfHeader->e_shnum);
-
- //Check if the string table is 4-byte aligned..
- AlignString(iDSOSymNameStrTbl);
-
- for(aIdx = 1; aIdx <= MAX_SECTIONS; aIdx++) {
- switch(aIdx)
- {
- case SYMBOL_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_DYNSYM, \
- sizeof(Elf32_Sym), (iNSymbols * sizeof(Elf32_Sym)),\
- STRING_SECTION, CODE_SECTION, 4, 0, 0);
- break;
- case STRING_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_STRTAB, \
- 1, iDSOSymNameStrTbl.size(), 0, \
- 0, 0, 0,0);
- break;
- case VERSION_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx], 0x6fffffff, \
- sizeof(Elf32_Half), (iNSymbols * sizeof(Elf32_Half)), SYMBOL_SECTION, \
- 0, 2, 0, 0);
- break;
- case VER_DEF_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx],0x6ffffffd, \
- sizeof(Elf32_Verdaux), (2*(sizeof(Elf32_Verdef) + sizeof(Elf32_Verdaux))),\
- STRING_SECTION, DYNAMIC_SECTION, 4, 0, 0);
- break;
- case HASH_TBL_SECTION:
- {
- PLUINT32 aSize = sizeof(Elf32_HashTable) + \
- (sizeof(Elf32_Sword) * (iHashTbl->nBuckets + iHashTbl->nChains));
-
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_HASH, \
- 0, aSize, SYMBOL_SECTION, 0, 4, 0, 0);
- }
- break;
- case DYNAMIC_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_DYNAMIC, \
- sizeof(Elf32_Dyn), ((MAX_DYN_ENTS + 1) *sizeof(Elf32_Dyn)),\
- STRING_SECTION, 0, 4, 0,0);
- break;
- case CODE_SECTION:
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_PROGBITS, \
- 0, (iNSymbols *sizeof(PLUINT32)),\
- 0, 0, 4, (SHF_ALLOC | SHF_EXECINSTR),0);
- break;
- case SH_STR_SECTION:
- {
- PLUINT32 aSize = iDSOSectionNames.size() + strlen(SECTION_NAME[aIdx]);
- SetSectionFields(aIdx, SECTION_NAME[aIdx], SHT_STRTAB, \
- 1, aSize, 0, \
- 0, 0, 0, 0);
- //Check if the string table is 4-byte aligned..
- AlignString(iDSOSectionNames);
- iSections[aIdx].sh_size = iDSOSectionNames.size();
-
- }
- break;
- default:
- break;
- }
- iSections[aIdx].sh_offset = iElfFileOffset;
- iElfFileOffset += iSections[aIdx].sh_size;
-
- if(iElfFileOffset %4) {
- iElfFileOffset += (4 - (iElfFileOffset %4));
- }
- }
-}
-
-/**
-This function sets the section header fields.
-@internalComponent
-@released
-@return Error status
-@param aSectionIndex The index of the section
-@param aSectionName The name of the section
-@param aType The type of the section
-@param aEntSz The size of each entry of the section
-@param aSectionSize The size of the section
-@param aLink The section this section is linked to
-@param aInfo Extra information. Depends on the section type of this section.
-@param aAddrAlign The address alignment of this section.
-@param aFlags Section flags
-@param aAddr The address of this section in memory(Here it remains 0)
-*/
-void ElfProducer::SetSectionFields(PLUINT32 aSectionIndex, char* aSectionName, PLUINT32 aType, \
- PLUINT32 aEntSz, PLUINT32 aSectionSize, PLUINT32 aLink, \
- PLUINT32 aInfo, PLUINT32 aAddrAlign, PLUINT32 aFlags, \
- PLUINT32 aAddr)
-{
- String aSecName = aSectionName;
-
- iSections[aSectionIndex].sh_name = iDSOSectionNames.size();
- iDSOSectionNames.insert(iDSOSectionNames.end(), aSecName.begin(), aSecName.end());
- iDSOSectionNames.insert(iDSOSectionNames.end(), 0);
-
- iSections[aSectionIndex].sh_type = aType;
- iSections[aSectionIndex].sh_entsize = aEntSz;
- iSections[aSectionIndex].sh_size = aSectionSize;
- iSections[aSectionIndex].sh_link = aLink;
- iSections[aSectionIndex].sh_flags = aFlags;
- iSections[aSectionIndex].sh_addralign = aAddrAlign;
- iSections[aSectionIndex].sh_info = aInfo;
- iSections[aSectionIndex].sh_addr = aAddr;
-}
-
-/**
-This function cleans up the memory allocated to the Elf fields.
-@internalComponent
-@released
-*/
-void ElfProducer::Cleanup()
-{
- DELETE_PTR(iElfHeader);
- DELETE_PTR_ARRAY(iSections);
- DELETE_PTR_ARRAY(iElfDynSym);
- DELETE_PTR_ARRAY(iVersionTbl);
- DELETE_PTR_ARRAY(iVersionDef);
- DELETE_PTR_ARRAY(iDSODaux);
-
- DELETE_PTR_ARRAY(iProgHeader);
- DELETE_PTR_ARRAY(iCodeSectionData);
- DELETE_PTR_ARRAY(iHashTbl);
- DELETE_PTR_ARRAY(iDSOBuckets);
- DELETE_PTR_ARRAY(iDSOChains);
-}
-
-/**
-This function creates the dynamic sections.
-@internalComponent
-@released
-*/
-void ElfProducer::CreateDynamicEntries()
-{
- for(PLUINT32 aIdx = 0; aIdx <= MAX_DYN_ENTS; aIdx++ ) {
- switch(aIdx) {
- case DSO_DT_DSONAME:
- iDSODynTbl[aIdx].d_tag = DT_SONAME;
- iDSODynTbl[aIdx].d_val = iDSONameOffset;
- break;
- case DSO_DT_SYMTAB:
- iDSODynTbl[aIdx].d_tag = DT_SYMTAB;
- iDSODynTbl[aIdx].d_val = iSections[SYMBOL_SECTION].sh_offset;
- break;
- case DSO_DT_SYMENT:
- iDSODynTbl[aIdx].d_tag = DT_SYMENT;
- iDSODynTbl[aIdx].d_val = iSections[SYMBOL_SECTION].sh_entsize;
- break;
- case DSO_DT_STRTAB:
- iDSODynTbl[aIdx].d_tag = DT_STRTAB;
- iDSODynTbl[aIdx].d_val = iSections[STRING_SECTION].sh_offset;
- break;
- case DSO_DT_STRSZ:
- iDSODynTbl[aIdx].d_tag = DT_STRSZ;
- iDSODynTbl[aIdx].d_val = iDSOSymNameStrTbl.size();
- break;
- case DSO_DT_VERSYM:
- iDSODynTbl[aIdx].d_tag = DT_VERSYM;
- iDSODynTbl[aIdx].d_val = iSections[VERSION_SECTION].sh_offset;
- break;
- case DSO_DT_VERDEF:
- iDSODynTbl[aIdx].d_tag = DT_VERDEF;
- iDSODynTbl[aIdx].d_val = iSections[VER_DEF_SECTION].sh_offset;
- break;
- case DSO_DT_VERDEFNUM:
- iDSODynTbl[aIdx].d_tag = DT_VERDEFNUM;
- iDSODynTbl[aIdx].d_val = 2;
- break;
- case DSO_DT_HASH:
- iDSODynTbl[aIdx].d_tag = DT_HASH;
- iDSODynTbl[aIdx].d_val = iSections[HASH_TBL_SECTION].sh_offset;
- break;
- case DSO_DT_NULL:
- iDSODynTbl[aIdx].d_tag = DT_NULL;
- iDSODynTbl[aIdx].d_val = 0;
- break;
- default:
- break;
- }
- }
-}
-
-/**
-This function creates the Elf header.
-@internalComponent
-@released
-*/
-void ElfProducer::CreateElfHeader()
-{
- //create ELF header
- unsigned char c[EI_NIDENT] = {0x7f, 'E', 'L', 'F', \
- ELFCLASS32, ELFDATA2LSB, 1, 0, \
- 0, 0, 0, 0, \
- 0, 0, 0, 0}; // e_ident
-
- for (PLUINT32 i=0; i <EI_NIDENT;i++)
- iElfHeader->e_ident[i] = c[i];
-
- iElfHeader->e_type = ET_DYN;
- iElfHeader->e_machine = EM_ARM;
- iElfHeader->e_version = EV_CURRENT;
- iElfHeader->e_entry = 0;
- iElfHeader->e_shoff = sizeof(Elf32_Ehdr);
- iElfHeader->e_flags = EF_ARM_BPABI_VERSION | EF_ARM_SYMSARESORTED;
- iElfHeader->e_ehsize = sizeof(Elf32_Ehdr);
- iElfHeader->e_phentsize = sizeof(Elf32_Phdr);
- iElfHeader->e_shentsize = sizeof(Elf32_Shdr);
- iElfHeader->e_shnum = MAX_SECTIONS + 1;
- iElfHeader->e_shstrndx = SH_STR_SECTION;
- iElfHeader->e_phnum = 2;
-}
-
-/**
-This function creates the program header
-@internalComponent
-@released
-*/
-void ElfProducer::CreateProgHeader()
-{
- //Update the program header offset..
- iElfHeader->e_phoff = iElfFileOffset;
-
- // Update code section data..
- SymbolList::iterator aItr = iSymbolsList->begin();
- SymbolList::iterator end = iSymbolsList->end();
-
- Symbol *aSym;
- PLUINT32 aPos = 0;
- while(aItr != end) {
- aSym = *aItr;
-
- iCodeSectionData[aPos] = aSym->OrdNum();
- aItr++;aPos++;
- }
-
- //Create program header
- iProgHeader[0].p_align = 4;
- iProgHeader[0].p_offset = iSections[CODE_SECTION].sh_offset;
- iProgHeader[0].p_type = PT_LOAD;
- iProgHeader[0].p_flags = (PF_X | PF_ARM_ENTRY);
- iProgHeader[0].p_filesz = iSections[CODE_SECTION].sh_size;
- iProgHeader[0].p_paddr = 0;
- iProgHeader[0].p_vaddr = 0;
- iProgHeader[0].p_memsz = iSections[CODE_SECTION].sh_size;
-
- iProgHeader[1].p_align = 4;
- iProgHeader[1].p_offset = iSections[DYNAMIC_SECTION].sh_offset;
- iProgHeader[1].p_type = PT_DYNAMIC;
- iProgHeader[1].p_flags = (PF_R );
- iProgHeader[1].p_filesz = iSections[DYNAMIC_SECTION].sh_size;
- iProgHeader[1].p_paddr = 0;
- iProgHeader[1].p_vaddr = 0;
- iProgHeader[1].p_memsz = 0;
-
-}
-
-/**
-This function aligns the string table to a 4-byte boundary
-@internalComponent
-@released
-@return Error status
-@param aStr - string to be aligned
-*/
-void ElfProducer::AlignString(String& aStr) {
-
- if( aStr.size() %4 ){
- PLUCHAR aPad = (PLUCHAR)(4 - (aStr.size() %4));
-
- while(aPad--) {
- aStr.insert(aStr.end(), 0);
- }
- }
-}
-
-/**
-This function writes the Elf file contents.
-@internalComponent
-@released
-*/
-void ElfProducer::WriteElfContents()
-{
- FILE *aElfFd;
- PLUINT32 aIndex;
-
- if((aElfFd = fopen(iDsoFullName.c_str(), "wb")) == NULL ) {
- throw FileError(FILEOPENERROR, (char*)iDsoFullName.c_str());
- }
-
- // The ELF header..
- fwrite(iElfHeader, 1, sizeof(Elf32_Ehdr), aElfFd);
-
- //Section headers
- for(aIndex = 0; aIndex <= MAX_SECTIONS; aIndex++) {
- fwrite(&iSections[aIndex], 1, sizeof(Elf32_Shdr), aElfFd);
- }
-
-
- //Each section..
-
- //code
- for(aIndex = 0; aIndex < iNSymbols; aIndex++) {
- fwrite(&iCodeSectionData[aIndex], 1, sizeof(PLUINT32), aElfFd );
- }
-
- //dyn table
- for(aIndex = 0; aIndex <= MAX_DYN_ENTS; aIndex++) {
- fwrite(&iDSODynTbl[aIndex], 1, sizeof(Elf32_Dyn), aElfFd);
- }
-
- //hash table
- fwrite(&iHashTbl->nBuckets, 1, sizeof(Elf32_Word), aElfFd);
- fwrite(&iHashTbl->nChains, 1, sizeof(Elf32_Word), aElfFd);
-
- for(aIndex=0; aIndex < iHashTbl->nBuckets; aIndex++) {
- fwrite(&iDSOBuckets[aIndex], 1, sizeof(Elf32_Sword), aElfFd);
-
- }
- for(aIndex=0; aIndex < iHashTbl->nChains; aIndex++) {
- fwrite(&iDSOChains[aIndex], 1, sizeof(Elf32_Sword), aElfFd);
-
- }
-
- //version def table
- for(aIndex = 0; aIndex < 2; aIndex++) {
- fwrite(&iVersionDef[aIndex], 1, sizeof(Elf32_Verdef), aElfFd);
- fwrite(&iDSODaux[aIndex], 1, sizeof(Elf32_Verdaux), aElfFd);
- }
-
- //version table
- for(aIndex = 0; aIndex < iNSymbols; aIndex++) {
- fwrite(&iVersionTbl[aIndex], 1, sizeof(Elf32_Half), aElfFd );
- }
-
- if( iSections[VERSION_SECTION].sh_size %4 ) {
- PLUINT32 aNPads = 4 - (iSections[VERSION_SECTION].sh_size %4);
- PLUCHAR aPad = '\0';
- while(aNPads--) {
- fwrite(&aPad, 1, 1, aElfFd);
- }
- }
-
- //string table
- PLUINT32 aSz = iDSOSymNameStrTbl.size();
- char *aData = new char[aSz];
- memcpy(aData, iDSOSymNameStrTbl.data(), aSz);
- fwrite(aData, 1, aSz, aElfFd);
-
- DELETE_PTR_ARRAY(aData);
-
- //Sym table
- for(aIndex = 0; aIndex < iNSymbols; aIndex ++) {
- fwrite(&iElfDynSym[aIndex], 1, sizeof(Elf32_Sym), aElfFd);
- }
-
- //section header name table
- aSz = iDSOSectionNames.size();
- char *aData1 = new char[ aSz];
- memcpy(aData1, iDSOSectionNames.data(), aSz);
- fwrite(aData1, 1, aSz, aElfFd);
- DELETE_PTR_ARRAY(aData1);
-
- //program header
- for(aIndex = 0; aIndex < 2; aIndex++) {
- fwrite(&iProgHeader[aIndex], 1, sizeof(Elf32_Phdr), aElfFd );
- }
-
- fclose(aElfFd);
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfproducer.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfProducer for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFPRODUCER_H_)
-#define _PL_ELFPRODUCER_H_
-
-#include "pl_elfexecutable.h"
-#include <string>
-
-//enum for section index
-typedef enum _SECTION_INDEX_ {
- DUMMY_SECTION=0,
- CODE_SECTION,
- DYNAMIC_SECTION,
- HASH_TBL_SECTION,
- VER_DEF_SECTION,
- VERSION_SECTION,
- STRING_SECTION,
- SYMBOL_SECTION,
- SH_STR_SECTION,
- MAX_SECTIONS=SH_STR_SECTION
-}SECTION_INDEX;
-
-//enum for DYN entries
-typedef enum _DYN_ENTRIES_ {
- DSO_DT_DSONAME=0,
- DSO_DT_SYMTAB,
- DSO_DT_SYMENT,
- DSO_DT_STRTAB,
- DSO_DT_STRSZ,
- DSO_DT_VERSYM,
- DSO_DT_VERDEF,
- DSO_DT_VERDEFNUM,
- DSO_DT_HASH,
- DSO_DT_NULL,
- MAX_DYN_ENTS=DSO_DT_NULL,
-}DYN_ENTRIES;
-
-#define DEFAULT_VERSION 2
-/**
-This class provides elf contents for the dso file creation. It generates the
-elf header, sections, dynamic array and the relocatrion entries.
-@internalComponent
-@released
-*/
-class ElfProducer : public ElfExecutable
-{
-
- typedef std::list<Symbol*> SymbolList;
-public:
- ElfProducer(ParameterListInterface *aParameterListInterface);
- ~ElfProducer();
-
- void SetSymbolList(SymbolList& aSymbolList);
- void WriteElfFile(char* aDsoFullName,char* aDsoFileName, char* aLinkAs);
-
-private:
- /**
- * This list is passed from the UseCaseHandler via the DSOHandler to this class.
- * This is used to create the export info when only a def file is available and
- * the DSO needs to be generated for that.
- */
- typedef std::string String;
- /** The proxy DSO file name*/
- String iDSOName;
-
- /** The offset of the file name within the string table of the ELF file*/
- PLUINT32 iDSONameOffset;
-
- /** The DLL name that defines the export Symbols*/
- String iLinkAs;
-
- /** The offset of the DLL name within the string table within the ELF file*/
- PLUINT32 iLinkAsOffset;
-
- /** The export Symbol list*/
- SymbolList *iSymbolsList;
-
- /** The number of export Symbols*/
- PLUINT32 iNSymbols;
-
- /** The proxy DSO full file name*/
- String iDsoFullName;
-
- /*DSO content Fields*/
-
- /** The Elf version definition auxiliary section*/
- Elf32_Verdaux *iDSODaux;
-
- /** The Buckets for the hash table*/
- Elf32_Sword *iDSOBuckets;
-
- /** The chains pointed to by the buckets belonging to the hash table*/
- Elf32_Sword *iDSOChains;
-
- /** The Elf Dynamic section table*/
- Elf32_Dyn iDSODynTbl[MAX_DYN_ENTS+1];
-
- /** The code section*/
- PLUINT32 *iCodeSectionData;
-
- /** The Elf file offset maintained for writing the different sections of the Elf file*/
- PLUINT32 iElfFileOffset;
-
- /** The Elf String table*/
- String iDSOSymNameStrTbl;
-
- /** The Elf Section-header String table*/
- String iDSOSectionNames;
-
-
- void InitElfContents();
- void Cleanup();
- void SetSymolFields(Symbol *aSym, Elf32_Sym* aElfSym, PLUINT32 aIndex);
- void AddToHashTable(const char* aSymName, PLUINT32 aIndex);
- void CreateVersionTable();
- void CreateElfHeader();
- void CreateSections();
- void SetSectionFields(PLUINT32 aSectionIndex, char* aSectionName, PLUINT32 aType, \
- PLUINT32 aEntSz, PLUINT32 aSectionSize, PLUINT32 aLink, \
- PLUINT32 aInfo, PLUINT32 aAddrAlign, PLUINT32 aFlags, \
- PLUINT32 aAddr);
- void CreateDynamicEntries();
- void CreateProgHeader();
-
- void WriteElfContents();
- void AlignString(String& aStr);
-
-};
-
-
-
-
-#endif // !defined(_PL_ELFPRODUCER_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfrelocation.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfrelocation.h"
-#include "pl_elfimportrelocation.h"
-#include "pl_elflocalrelocation.h"
-#include "pl_dllsymbol.h"
-
-/**
-Constructor for class ElfRelocation
-@param aElfExec - Instance of class ELfExecutable
-@param aAddr
-@param aAddend
-@param aIndex
-@param aRelType - Relocation type
-@param aRel
-@internalComponent
-@released
-*/
-ElfRelocation::ElfRelocation(ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- Elf32_Rel* aRel) : iAddr(aAddr), iAddend(aAddend), \
- iSymNdx(aIndex), iRelType(aRelType), iRel(aRel), iElfExec(aElfExec)
-{
-}
-
-
-
-/**
-Destructor for class ElfRelocation
-@internalComponent
-@released
-*/
-ElfRelocation::~ElfRelocation(){
-
-}
-
-
-/**
-Function to create new relocation entry
-@param aElfExec - Instance of class ElfExecutable
-@param aAddr - location where the relocation refers to.
-@param aAddend - addend for the relocation entry
-@param aIndex - symbol index
-@param aRelType - Relocation type
-@param aRel - Elf relocation entry
-@param aImportRel - Import relocation
-@internalComponent
-@released
-*/
-ElfRelocation* ElfRelocation::NewRelocEntry(ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, \
- void* aRel, bool aImportRel)
-{
- ElfRelocation *aReloc = NULL;
- if(aImportRel)
- aReloc = new ElfImportRelocation(aElfExec, aAddr, aAddend, aIndex, aRelType, (Elf32_Rel*)aRel);
- else
- aReloc = new ElfLocalRelocation(aElfExec, aAddr, aAddend, aIndex, aRelType, (Elf32_Rel*)aRel);
-
- return aReloc;
-}
-
-
-/**
-This function verifies if the relocation entry is required to be
-handled by the postlinker.
-@param aType - type of relocation
-@return - True if valid relocation type, otherwise false
-@internalComponent
-@released
-*/
-bool ElfRelocation::ValidRelocEntry(PLUCHAR aType) {
-
- switch(aType)
- {
- case R_ARM_ABS32:
- case R_ARM_GLOB_DAT:
- case R_ARM_JUMP_SLOT:
- case R_ARM_RELATIVE:
- case R_ARM_GOT_BREL:
- return true;
- case R_ARM_NONE:
- return false;
- default:
- return false;
- }
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfrelocation.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfRelocation for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFRELOCATION_H_)
-#define _PL_ELFRELOCATION_H_
-
-#include "pl_common.h"
-
-class DllSymbol;
-class ElfExecutable;
-
-/**
-This class is for Elf relocation.
-
-@internalComponent
-@released
-*/
-class ElfRelocation
-{
-
-public:
- ElfRelocation(ElfExecutable *aElfExec, PLMemAddr32 aAddr, PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType, Elf32_Rel* aRel);
- virtual ~ElfRelocation();
-
- static bool ValidRelocEntry(PLUCHAR aType);
- static ElfRelocation* NewRelocEntry( ElfExecutable *aElfExec, PLMemAddr32 aAddr, \
- PLUINT32 aAddend, PLUINT32 aIndex, PLUCHAR aRelType,\
- void* aRel, bool aImportRel);
-
- virtual bool IsImportRelocation() =0;
- virtual void Add() = 0;
-
- PLMemAddr32 iAddr;
- PLUINT32 iAddend;
- PLUINT32 iSymNdx;
- PLUCHAR iRelType;
- Elf32_Rel *iRel;
- Elf32_Sym *iSymbol;
- ElfExecutable *iElfExec;
- Elf32_Phdr *iSegment;
- ESegmentType iSegmentType;
-};
-
-
-
-
-#endif // !defined(_PL_ELFRELOCATION_H_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfrelocations.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfRelocations for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_elfrelocations.h"
-#include "pl_elflocalrelocation.h"
-
-/**
-Constructor for class ElfRelocations
-@internalComponent
-@released
-*/
-ElfRelocations::ElfRelocations() : \
- iCodeSortedP(false), iDataSortedP(false)
-{
-}
-
-/**
-Destructor for class ElfRelocations to release allocated memory
-@internalComponent
-@released
-*/
-ElfRelocations::~ElfRelocations()
-{
- if(iCodeRelocations.size())
- {
- RelocationList::iterator aItr = iCodeRelocations.begin();
- RelocationList::iterator last = iCodeRelocations.end();
- ElfLocalRelocation *temp;
-
- while( aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- iCodeRelocations.clear();
- }
- if(iDataRelocations.size())
- {
- RelocationList::iterator aItr = iDataRelocations.begin();
- RelocationList::iterator last = iDataRelocations.end();
- ElfLocalRelocation *temp;
-
- while( aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- iDataRelocations.clear();
- }
-}
-
-
-/**
-Function for adding Elf local Relocations.
-@internalComponent
-@released
-@return 0 if therelocation is valid.
-*/
-PLUINT32 ElfRelocations::Add(ElfLocalRelocation* aReloc){
- if(!aReloc) return 1;
-
- switch (aReloc->iSegmentType)
- {
- case ESegmentRO:
- iCodeSortedP = false;
- iCodeRelocations.push_back(aReloc);
- break;
- case ESegmentRW:
- iDataSortedP = false;
- iDataRelocations.push_back(aReloc);
- break;
- default:
- ;
- }
-
- return 0;
-}
-
-/**
-Function for getting code relocations. The reloc entries are
-sorted on the address they refer to.
-@internalComponent
-@released
-@return list of code relocation
-*/
-ElfRelocations::RelocationList & ElfRelocations::GetCodeRelocations()
-{
- if (!iCodeSortedP)
- {
- iCodeRelocations.sort(Cmp());
- iCodeSortedP = true;
- }
- return iCodeRelocations;
-}
-
-/**
-Function for getting data relocations. The reloc entries are
-sorted on the address they refer to.
-@internalComponent
-@released
-@return list of code relocation
-*/
-ElfRelocations::RelocationList & ElfRelocations::GetDataRelocations()
-{
- if (!iDataSortedP)
- {
- iDataRelocations.sort(Cmp());
- iDataSortedP = true;
- }
- return iDataRelocations;
-}
-
-/**
-Overloaded operator for comparing location the relocations refer to.
-@internalComponent
-@released
-@return comparison of both relocation
-*/
-bool ElfRelocations::Cmp::operator()(ElfRelocation * x, ElfRelocation * y)
-{
- return x->iAddr < y->iAddr;
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfrelocations.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class ElfRelocations for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(_PL_ELFRELOCATIONS_H)
-#define _PL_ELFRELOCATIONS_H
-
-#include "pl_common.h"
-#include <list>
-
-class ElfRelocation;
-class ElfLocalRelocation;
-
-/**
-This class is for Elf relocations.
-
-@internalComponent
-@released
-*/
-class ElfRelocations
-{
-public:
- typedef std::list<ElfLocalRelocation*> RelocationList;
-
- ElfRelocations();
- ~ElfRelocations();
- PLUINT32 Add(ElfLocalRelocation* aReloc);
-
- RelocationList & GetCodeRelocations();
- RelocationList & GetDataRelocations();
- struct Cmp {
- bool operator()(ElfRelocation * x, ElfRelocation * y);
- };
-private:
- bool iCodeSortedP;
- RelocationList iCodeRelocations;
- bool iDataSortedP;
- RelocationList iDataRelocations;
-
-};
-
-
-
-
-#endif // !defined(_PL_ELFRELOCATIONS_H)
--- a/toolsandutils/e32tools/elf2e32/source/pl_sym_type.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the enumeration SymbolType for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#if !defined(EA_37C067EA_9B6B_4d95_84A3_ABBE88E7AD8F__INCLUDED_)
-#define EA_37C067EA_9B6B_4d95_84A3_ABBE88E7AD8F__INCLUDED_
-
-#include <tools/elfdefs.h>
-
-enum SymbolType
-{
- SymbolTypeNotDefined = STT_NOTYPE,
- SymbolTypeData = STT_OBJECT,
- SymbolTypeCode = STT_FUNC
-};
-
-
-
-
-#endif // !defined(EA_37C067EA_9B6B_4d95_84A3_ABBE88E7AD8F__INCLUDED_)
--- a/toolsandutils/e32tools/elf2e32/source/pl_symbol.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class Symbol for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "pl_symbol.h"
-
-
-/**
-This constructor sets the symbol members.
-@internalComponent
-@released
-*/
-Symbol::Symbol(char* aName, SymbolType aCodeDataType, char* aExportName, PLUINT32 aOrd, \
- char* aComment , bool aR3Unused, bool aAbsent, PLUINT32 aSz) :\
- iSymbolName(aName), iExportName(aExportName),iSymbolType(aCodeDataType),\
- iOrdinalNumber(aOrd),iComment(aComment),iAbsent(aAbsent), iR3Unused(aR3Unused), \
- iSize (aSz)
-{
-
-}
-
-/**
-This constructor sets the symbol members.
-@internalComponent
-@released
-*/
-Symbol::Symbol(Symbol& aSymbol, SymbolType aCodeDataType, bool aAbsent)
- : iExportName(NULL), \
- iSymbolType(aCodeDataType),iComment(NULL), iR3Unused(false), iAbsent(aAbsent)
-{
- iSymbolName = new char[strlen(aSymbol.SymbolName()) + 1];
- strcpy(iSymbolName, aSymbol.SymbolName());
- iOrdinalNumber = aSymbol.OrdNum();
-}
-
-/**
-This copy constructor copies the symbol members from the input symbol.
-@param aSymbol - The symbol from which the members are to be copied.
-@internalComponent
-@released
-*/
-Symbol::Symbol(Symbol& aSymbol)
-{
- memcpy(this, &aSymbol, sizeof(aSymbol));
-
- iSymbolName = new char[strlen(aSymbol.SymbolName()) + 1];
- strcpy(iSymbolName, aSymbol.SymbolName());
-
- if(aSymbol.Comment())
- {
- iComment = new char[strlen(aSymbol.Comment()) + 1];
- strcpy(iComment, aSymbol.Comment());
- }
-
- if(aSymbol.ExportName())
- {
- iExportName = new char[strlen(aSymbol.ExportName()) + 1];
- strcpy(iExportName, aSymbol.ExportName());
- }
-}
-
-/**
-This constructor sets the symbol members.
-@internalComponent
-@released
-*/
-Symbol::Symbol(int symbolStatus,char *name,char *exportName,int ordinalNo,bool r3unused,bool absent,int symbolType,char *comment, PLUINT32 aSz)\
- :iSize (aSz)
-{
- if(symbolStatus==0)
- {
- iSymbolStatus=Matching;
- }
- else if(symbolStatus==1)
- {
- iSymbolStatus=Missing;
- }
- else
- {
- iSymbolStatus=New;
- }
- iSymbolName=name;
- iExportName=exportName;
- iOrdinalNumber=ordinalNo;
- iR3Unused=r3unused;
- iAbsent=absent;
- if(symbolType==0)
- {
- iSymbolType=SymbolTypeCode;
- }
- else if(symbolType==1)
- {
- iSymbolType=SymbolTypeData;
- }
- else
- {
- iSymbolType=SymbolTypeNotDefined;
- }
- iComment=comment;
-}
-
-/**
-This destructor frees the symbol members.
-@internalComponent
-@released
-*/
-Symbol::~Symbol()
-{
- delete [] iSymbolName;
- delete [] iExportName;
- delete [] iComment;
-}
-
-/**
-This function sets the symbol name.
-@param aSymbolName - The symbol name
-@internalComponent
-@released
-*/
-void Symbol::SetSymbolName(char *aSymbolName)
-{
- iSymbolName = new char[strlen(aSymbolName)+1];
- strcpy(iSymbolName, aSymbolName);
-}
-
-/**
-This function compares the symbol for equality.
-@param aSym - The symbol that is compared with this symbol
-Return - It returns true if the 2 symbols are equal.
-@internalComponent
-@released
-*/
-bool Symbol::operator==(const Symbol* aSym) const {
- if(strcmp(iSymbolName, aSym->iSymbolName))
- return false;
- if( iSymbolType != aSym->iSymbolType )
- return false;
-
- return true;
-}
-
-/**
-This function returns the symbol name.
-@internalComponent
-@released
-*/
-const char* Symbol::SymbolName() const {
- return iSymbolName;
-}
-
-/**
-This function returns the aliased symbol name.
-@internalComponent
-@released
-*/
-const char* Symbol::ExportName() {
- return iExportName;
-}
-
-/**
-This function returns the ordinal number of the symbol.
-@internalComponent
-@released
-*/
-PLUINT32 Symbol::OrdNum() const {
- return iOrdinalNumber;
-}
-
-/**
-This function returns if the symbol is code or a data symbol.
-@internalComponent
-@released
-*/
-SymbolType Symbol::CodeDataType() {
- return iSymbolType;
-}
-
-/**
-This function returns if r3unused is true.
-@internalComponent
-@released
-*/
-bool Symbol::R3unused() {
- return iR3Unused;
-}
-
-/**
-This function returns if the symbol is marked absent in the def file.
-@internalComponent
-@released
-*/
-bool Symbol::Absent() {
- return iAbsent;
-}
-
-/**
-This function sets the symbol to be absent.
-@param aAbsent - bool value
-@internalComponent
-@released
-*/
-void Symbol::SetAbsent(bool aAbsent) {
- iAbsent = aAbsent;
-}
-
-/**
-This function returns the comment against this def file.
-@internalComponent
-@released
-*/
-char* Symbol::Comment() {
- return iComment;
-}
-
-/**
-This function returns the symbol is a matching/missing/new symbol in the def file.
-@internalComponent
-@released
-*/
-int Symbol::GetSymbolStatus() {
- return iSymbolStatus;
-}
-
-/**
-This function sets the ordinal number for this symbol.
-@internalComponent
-@released
-*/
-void Symbol::SetOrdinal(PLUINT32 aOrdinalNum) {
- iOrdinalNumber=aOrdinalNum;
-}
-
-/**
-This function sets the status of the symbol i.e., whether it is
-a matching/missing/new symbol.
-@internalComponent
-@released
-*/
-void Symbol::SetSymbolStatus(SymbolStatus aSymbolStatus) {
- iSymbolStatus = aSymbolStatus;
-}
-
-/**
-This function sets the symbol name.
-@param aSymbolName - Symbol Name
-@internalComponent
-@released
-*/
-void Symbol::SymbolName(char *aSymbolName)
-{
- iSymbolName = aSymbolName;
-}
-/**
-This function sets the export name of the symbol.
-@param aComment - aExportName
-@internalComponent
-@released
-*/
-void Symbol::ExportName(char *aExportName)
-{
- iExportName = aExportName;
-}
-
-/**
-This function sets the comment against the symbol.
-@param aComment - aComment
-@internalComponent
-@released
-*/
-void Symbol::Comment(char *aComment)
-{
- iComment = aComment;
-}
-
-/**
-This function sets the symbol type if it is Code or Data symbol.
-@param aType - Symbol Type
-@internalComponent
-@released
-*/
-void Symbol::CodeDataType(SymbolType aType)
-{
- iSymbolType = aType;
-}
-
-/**
-This function sets if R3Unused is true for this symbol.
-@param aR3Unused - bool value
-@internalComponent
-@released
-*/
-void Symbol::R3Unused(bool aR3Unused)
-{
- iR3Unused = aR3Unused;
-}
-
-/**
-This function sets if R3Unused is true for this symbol.
-@param aSize - size of the symbol
-@internalComponent
-@released
-*/
-void Symbol::SetSymbolSize(PLUINT32 aSize){
- iSize = aSize;
-}
-
-/**
-This function gets the size of this symbol.
-@internalComponent
-@released
-*/
-PLUINT32 Symbol::SymbolSize(){
- return iSize;
-}
--- a/toolsandutils/e32tools/elf2e32/source/pl_symbol.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class Symbol for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#if !defined(_PL_SYMBOL_H_)
-#define _PL_SYMBOL_H_
-
-#include "pl_common.h"
-#include "pl_sym_type.h"
-#include <string>
-
-#define UnAssignedOrdNum -1;
-
-enum SymbolStatus {Matching,Missing,New};
-/**
- * This class is shared among all that use the symbol information. To name them,
- * DefFileHandler, UseCaseController, DSOHandler. To be finaslized by
- * DefFileHandler.
- */
-class Symbol
-{
-
-public:
- Symbol(char* aName,SymbolType aCodeDataType, char* aExportName=NULL, PLUINT32 aOrd = -1,\
- char* aComment=NULL, bool aR3Unused=false, bool aAbsent=false, PLUINT32 aSymbolSz = 0);
-
- Symbol(int symbolStatus,char *name,char *exportName,int ordinalNo,bool r3unused,bool absent,int symbolType,char *comment, PLUINT32 aSymbolSz = 0);
-
- Symbol(Symbol& aSymbol, SymbolType aCodeDataType, bool aAbsent);
-
- Symbol(Symbol& aSymbol);
- /*Symbol(char* aName,CDType aCodeDataType, PLUINT32 aOrd = UnAssignedOrdNum,\
- char* aComment = NULL, bool aAbsent = false);*/
- virtual ~Symbol();
-
- bool operator==(const Symbol* aSym) const;
- const char* SymbolName() const;
- const char* ExportName();
- PLUINT32 OrdNum() const;
- SymbolType CodeDataType();
-
- bool R3unused();
- bool Absent();
- void SetAbsent(bool aAbsent);
- char* Comment();
- int GetSymbolStatus();
- void SetOrdinal(PLUINT32 aOrdinalNum);
- void SetSymbolStatus(SymbolStatus aSymbolStatus);
- void SetSymbolName(char *aSymbolName);
-
- void SymbolName(char *aSymbolName);
- void Comment(char *aComment);
- void CodeDataType(SymbolType aType);
- void R3Unused(bool aR3Unused);
- void ExportName(char *aExportName);
- void SetSymbolSize(PLUINT32 aSz);
- PLUINT32 SymbolSize();
-
-private:
- SymbolStatus iSymbolStatus;
- char* iSymbolName;
- char* iExportName;
- SymbolType iSymbolType;
- PLUINT32 iOrdinalNumber;
- char* iComment;
- bool iAbsent;
- bool iR3Unused;
- PLUINT32 iSize;
-
-};
-
-
-
-
-#endif // !defined(_PL_SYMBOL_H_)
--- a/toolsandutils/e32tools/elf2e32/source/polydll_fb_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class PolyDllFB Target for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "polydll_fb_target.h"
-
-/**
-Constructor for the POLYDLLFBTarget Class
-
-@internalComponent
-@released
-*/
-POLYDLLFBTarget::POLYDLLFBTarget(ParameterListInterface* aParameterListInterface) : ExportTypeFBTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the POLYDLLFBTarget Class
-
-@internalComponent
-@released
-*/
-POLYDLLFBTarget::~POLYDLLFBTarget()
-{
- if(iDefExports)
- {
- SymbolList::iterator aItr = iDefExports->begin();
- SymbolList::iterator last = iDefExports->end();
- Symbol *temp;
-
- while( aItr != last)
- {
- temp = *aItr;
- aItr++;
- delete temp;
- }
- iDefExports->clear();
- }
-}
-
-/**
-Function to process the symbols to be exported. In case of Poly DLL, there might be
-predefined symbols passed to '--sydef' option, need to consider them alongwith the
-symbols coming from the ELF file.
-
-@internalComponent
-@released
-*/
-void POLYDLLFBTarget::ProcessExports()
-{
- int count = iParameterListInterface->SysDefCount();
- ParameterListInterface::Sys aSysDefSymbols[10];
-
- int j=0, i=count;
- while (i)
- {
- aSysDefSymbols[j] = iParameterListInterface->SysDefSymbols(j);
- j++; i--;
- }
-
- typedef SymbolList::iterator Iterator;
-
- Symbol *aSymbolEntry;
-
- iDefExports = new SymbolList;
-
- for (int k=0; k < count; k++)
- {
- SymbolType aType = SymbolTypeCode;
- aSymbolEntry = new Symbol(aSysDefSymbols[k].iSysDefSymbolName, aType);
- aSymbolEntry->SetOrdinal(aSysDefSymbols[k].iSysDefOrdinalNum);
- iDefExports->push_back(aSymbolEntry);
- }
-
- ValidateExports(iDefExports);
- CreateExports();
-}
-
-/**
-Function to generate the output E32 image. Incase of an output DEF file, then the
-DEF file and the corresponding DSO file should be generated.
-
-@internalComponent
-@released
-*/
-void POLYDLLFBTarget::GenerateOutput() {
-
- if( UseCaseBase::DefOutput() ) {
- WriteDefFile();
- }
- if(UseCaseBase::DSOOutput() && UseCaseBase::LinkAsDLLName()) {
- WriteDSOFile();
- }
- WriteE32();
-}
-
-
-
--- a/toolsandutils/e32tools/elf2e32/source/polydll_fb_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// polydllfb_target.h
-// Declaration of Class POLYDLLFBTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef POLYDLLFB_TARGET_H
-#define POLYDLLFB_TARGET_H
-
-#include "export_type_fb_target.h"
-#include <list>
-
-class Symbol;
-
-typedef std::list<Symbol*> SymbolList;
-
-/**
-This class is derived from the class ExportTypeFBTarget and is responsible for creation of
-PolyDll first build.
-
-@internalComponent
-@released
-*/
-class POLYDLLFBTarget : public ExportTypeFBTarget
-{
-
-public:
- POLYDLLFBTarget(ParameterListInterface* aParameterListInterface);
- ~POLYDLLFBTarget();
- void ProcessExports();
- void GenerateOutput();
-
-};
-
-
-#endif // POLYDLLFB_TARGET_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/polydll_rebuild_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class PolyDLL Rebuild Target for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "polydll_rebuild_target.h"
-#include "deffile.h"
-#include "errorhandler.h"
-
-#include <iostream>
-
-using std::list;
-
-/**
-Constructor for the POLYDLLRebuildTarget Class
-
-@internalComponent
-@released
-*/
-POLYDLLRebuildTarget::POLYDLLRebuildTarget(ParameterListInterface* aParameterListInterface) : ExportTypeRebuildTarget(aParameterListInterface) {
-}
-
-/**
-Destructor for the POLYDLLRebuildTarget Class
-
-@internalComponent
-@released
-*/
-POLYDLLRebuildTarget::~POLYDLLRebuildTarget()
-{
-}
-
-/**
-Function to process the symbols to be exported. In case of Poly DLL, there might be
-predefined symbols passed to '--sydef' option, need to consider them alongwith the
-symbols coming from the DEF file and ELF file.
-
-@internalComponent
-@released
-*/
-void POLYDLLRebuildTarget::ProcessExports()
-{
- int count = iParameterListInterface->SysDefCount();
- ParameterListInterface::Sys aSysDefSymbols[10];
-
- int j=0, i=count;
- while (i)
- {
- aSysDefSymbols[j] = iParameterListInterface->SysDefSymbols(j);
- j++; i--;
- }
-
- typedef SymbolList::iterator Iterator;
-
- Symbol *aSymbolEntry;
-
- SymbolList *iSysDefExports = new SymbolList;
-
- iDefExports = iDefFile->ReadDefFile(iParameterListInterface->DefInput());
-
- for (int k=0; k < count; k++)
- {
- SymbolType aType = SymbolTypeCode;
- aSymbolEntry = new Symbol(aSysDefSymbols[k].iSysDefSymbolName, aType);
- aSymbolEntry->SetOrdinal(aSysDefSymbols[k].iSysDefOrdinalNum);
- iSysDefExports->push_back(aSymbolEntry);
- }
-
- // Check if the Sysdefs and the DEF file are matching.
-
- Iterator aBegin = iSysDefExports->begin();
- Iterator aEnd = iSysDefExports->end();
-
- Iterator aDefBegin = iDefExports->begin();
- Iterator aDefEnd = iDefExports->end();
-
- std::list<String> aMissingSysDefList;
-
- while ((aDefBegin != aDefEnd) && (aBegin != aEnd))
- {
- if (strcmp((*aBegin)->SymbolName(), (*aDefBegin)->SymbolName()))
- aMissingSysDefList.push_back((*aBegin)->SymbolName());
- aBegin++;
- aDefBegin++;
- }
-
- if( aMissingSysDefList.size() )
- throw SysDefMismatchError(SYSDEFSMISMATCHERROR, aMissingSysDefList, UseCaseBase::DefInput());
-
- ValidateExports(iDefExports);
- CreateExports();
-}
-
-/**
-Function to generate the output E32 image. Incase of an output DEF file, then the
-DEF file and the corresponding DSO file should be generated.
-
-@internalComponent
-@released
-*/
-void POLYDLLRebuildTarget::GenerateOutput() {
-
- if( UseCaseBase::DefOutput() ) {
- WriteDefFile();
- }
- if(UseCaseBase::DSOOutput() && UseCaseBase::LinkAsDLLName()) {
- WriteDSOFile();
- }
- WriteE32();
-}
--- a/toolsandutils/e32tools/elf2e32/source/polydll_rebuild_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// polydllrebuild_target.h
-// Declaration of Class POLYDLLRebuildTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef POLYDLLREBUILD_TARGET_H
-#define POLYDLLREBUILD_TARGET_H
-
-#include "export_type_rebuild_target.h"
-#include <list>
-
-class Symbol;
-
-typedef std::list<Symbol*> SymbolList;
-
-/**
-This class is derived from the base class ExportTypeRebuildTarget and is responsible for
-PolyDLL rebuild.
-
-@internalComponent
-@released
-*/
-class POLYDLLRebuildTarget : public ExportTypeRebuildTarget
-{
-
-public:
- POLYDLLRebuildTarget(ParameterListInterface* aParameterListInterface);
- ~POLYDLLRebuildTarget();
- void ProcessExports();
- void GenerateOutput();
-};
-
-
-#endif // POLYDLLREBUILD_TARGET_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/staticlibsymbols.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,520 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Header file containing the list of symbols exported by static libraries
-// @internalComponent
-// @released
-//
-//
-
-#if !defined STATICLIBS_SYMBOLS_H
-#define STATICLIBS_SYMBOLS_H
-
-static const char * Unwantedruntimesymbols[] =
-{
-"_ZN10__cxxabiv116__enum_type_infoD0Ev",
-"_ZN10__cxxabiv116__enum_type_infoD1Ev",
-"_ZN10__cxxabiv116__enum_type_infoD2Ev",
-"_ZN10__cxxabiv117__array_type_infoD0Ev",
-"_ZN10__cxxabiv117__array_type_infoD1Ev",
-"_ZN10__cxxabiv117__array_type_infoD2Ev",
-"_ZN10__cxxabiv117__class_type_infoD0Ev",
-"_ZN10__cxxabiv117__class_type_infoD1Ev",
-"_ZN10__cxxabiv117__class_type_infoD2Ev",
-"_ZN10__cxxabiv117__pbase_type_infoD0Ev",
-"_ZN10__cxxabiv117__pbase_type_infoD1Ev",
-"_ZN10__cxxabiv117__pbase_type_infoD2Ev",
-"_ZN10__cxxabiv119__pointer_type_infoD0Ev",
-"_ZN10__cxxabiv119__pointer_type_infoD1Ev",
-"_ZN10__cxxabiv119__pointer_type_infoD2Ev",
-"_ZN10__cxxabiv120__function_type_infoD0Ev",
-"_ZN10__cxxabiv120__function_type_infoD1Ev",
-"_ZN10__cxxabiv120__function_type_infoD2Ev",
-"_ZN10__cxxabiv120__si_class_type_infoD0Ev",
-"_ZN10__cxxabiv120__si_class_type_infoD1Ev",
-"_ZN10__cxxabiv120__si_class_type_infoD2Ev",
-"_ZN10__cxxabiv121__vmi_class_type_infoD0Ev",
-"_ZN10__cxxabiv121__vmi_class_type_infoD1Ev",
-"_ZN10__cxxabiv121__vmi_class_type_infoD2Ev",
-"_ZN10__cxxabiv123__fundamental_type_infoD0Ev",
-"_ZN10__cxxabiv123__fundamental_type_infoD1Ev",
-"_ZN10__cxxabiv123__fundamental_type_infoD2Ev",
-"_ZN10__cxxabiv129__pointer_to_member_type_infoD0Ev",
-"_ZN10__cxxabiv129__pointer_to_member_type_infoD1Ev",
-"_ZN10__cxxabiv129__pointer_to_member_type_infoD2Ev",
-"_ZNKSt13bad_exception4whatEv",
-"_ZNKSt9exception4whatEv",
-"_ZNSt13bad_exceptionC2ERKS_",
-"_ZNSt13bad_exceptionC2Ev",
-"_ZNSt13bad_exceptionD0Ev",
-"_ZNSt13bad_exceptionD2Ev",
-"_ZNSt9exceptionC1ERKS_",
-"_ZNSt9exceptionC1Ev",
-"_ZNSt9exceptionC2ERKS_",
-"_ZNSt9exceptionC2Ev",
-"_ZNSt9exceptionD0Ev",
-"_ZNSt9exceptionD1Ev",
-"_ZNSt9exceptionD2Ev",
-"_ZNSt9exceptionaSERKS_",
-"_ZNSt9type_infoD0Ev",
-"_ZNSt9type_infoD1Ev",
-"_ZNSt9type_infoD2Ev",
-"_ZSt9terminatev",
-"_ZTISt13bad_exception",
-"_ZTISt9exception",
-"_ZTVSt13bad_exception",
-"_ZTVSt9exception",
-"__ARM_dcmp4",
-"__ARM_dcmp4e",
-"__ARM_exceptions_buffer_allocate",
-"__ARM_exceptions_buffer_free",
-"__ARM_exceptions_buffer_init",
-"__ARM_fcmp4",
-"__ARM_fcmp4e",
-"__ARM_isnan",
-"__ARM_vec_cleanup",
-"__Heap_Alloc",
-"__Heap_Alloc_Internal",
-"__Heap_Broken",
-"__Heap_DescSize",
-"__Heap_Free",
-"__Heap_Free_Internal",
-"__Heap_Full",
-"__Heap_Initialize",
-"__Heap_ProvideMemory",
-"__I_use_heap",
-"__aeabi_cdcmpeq",
-"__aeabi_cdcmple",
-"__aeabi_cfcmpeq",
-"__aeabi_cfcmple",
-"__aeabi_d2iz",
-"__aeabi_d2lz",
-"__aeabi_d2uiz",
-"__aeabi_d2ulz",
-"__aeabi_dcmpeq",
-"__aeabi_dcmpge",
-"__aeabi_dcmpgt",
-"__aeabi_dcmple",
-"__aeabi_dcmplt",
-"__aeabi_ddiv",
-"__aeabi_dneg",
-"__aeabi_f2iz",
-"__aeabi_f2lz",
-"__aeabi_f2uiz",
-"__aeabi_f2ulz",
-"__aeabi_fcmpeq",
-"__aeabi_fcmpge",
-"__aeabi_fcmpgt",
-"__aeabi_fcmple",
-"__aeabi_fcmplt",
-"__aeabi_fdiv",
-"__aeabi_fneg",
-"__aeabi_i2d",
-"__aeabi_i2f",
-"__aeabi_l2d",
-"__aeabi_l2f",
-"__aeabi_ui2d",
-"__aeabi_ui2f",
-"__aeabi_ul2d",
-"__aeabi_ul2f",
-"__array_delete_general",
-"__cxa_get_globals",
-"__dcmp4e",
-"__default_signal_handler",
-"__derived_to_base_conversion",
-"__dflt_normalise",
-"__dunder",
-"__dunder_d",
-"__fcmp4e",
-"__fflt_normalise",
-"__fpl_cmpreturn",
-"__fpl_dcheck_NaN1",
-"__fpl_dcheck_NaN2",
-"__fpl_dcmp_InfNaN",
-"__fpl_exception",
-"__fpl_fcheck_NaN1",
-"__fpl_fcheck_NaN2",
-"__fpl_fcmp_InfNaN",
-"__fpl_inf_d2f",
-"__fpl_inf_dadd",
-"__fpl_inf_dcmp",
-"__fpl_inf_ddiv",
-"__fpl_inf_dfix",
-"__fpl_inf_dfix_r",
-"__fpl_inf_dfixu",
-"__fpl_inf_dfixu_r",
-"__fpl_inf_dmul",
-"__fpl_inf_drem",
-"__fpl_inf_drnd",
-"__fpl_inf_dsqrt",
-"__fpl_inf_dsub",
-"__fpl_inf_f2d",
-"__fpl_inf_fadd",
-"__fpl_inf_fcmp",
-"__fpl_inf_fdiv",
-"__fpl_inf_ffix",
-"__fpl_inf_ffix_r",
-"__fpl_inf_ffixu",
-"__fpl_inf_ffixu_r",
-"__fpl_inf_fmul",
-"__fpl_inf_frem",
-"__fpl_inf_frnd",
-"__fpl_inf_fsqrt",
-"__fpl_inf_fsub",
-"__fpl_inf_ll_sfrom_d",
-"__fpl_inf_ll_sfrom_d_r",
-"__fpl_inf_ll_sfrom_f",
-"__fpl_inf_ll_sfrom_f_r",
-"__fpl_inf_ll_ufrom_d",
-"__fpl_inf_ll_ufrom_d_r",
-"__fpl_inf_ll_ufrom_f",
-"__fpl_inf_ll_ufrom_f_r",
-"__fpl_inf_scalbn",
-"__fpl_inf_scalbnf",
-"__fpl_normalise2",
-"__fpl_return_NaN",
-"__funder",
-"__funder_d",
-"__hardfp_acos",
-"__hardfp_asin",
-"__hardfp_atan",
-"__hardfp_atan2",
-"__hardfp_cos",
-"__hardfp_exp",
-"__hardfp_fabs",
-"__hardfp_fmod",
-"__hardfp_log",
-"__hardfp_log10",
-"__hardfp_modf",
-"__hardfp_pow",
-"__hardfp_sin",
-"__hardfp_sqrt",
-"__hardfp_tan",
-"__heap_guard",
-"__ieee754_rem_pio2",
-"__kernel_cos",
-"__kernel_poly",
-"__kernel_sin",
-"__kernel_tan",
-"__mathlib_zero",
-"__softfp_acos",
-"__softfp_asin",
-"__softfp_atan",
-"__softfp_atan2",
-"__softfp_cos",
-"__softfp_exp",
-"__softfp_fabs",
-"__softfp_fmod",
-"__softfp_log",
-"__softfp_log10",
-"__softfp_modf",
-"__softfp_pow",
-"__softfp_sin",
-"__softfp_sqrt",
-"__softfp_tan",
-"_d2f",
-"_dabs",
-"_dadd",
-"_dcmp4e",
-"_dcmpeq",
-"_dcmple",
-"_ddiv",
-"_ddiv_mantissas",
-"_deq",
-"_dfix",
-"_dfix_r",
-"_dfixu",
-"_dfixu_r",
-"_dflt",
-"_dfltu",
-"_dgeq",
-"_dgr",
-"_dleq",
-"_dls",
-"_dmul",
-"_dneg",
-"_dneq",
-"_drcmple",
-"_drdiv",
-"_drsb",
-"_dsub",
-"_dun",
-"_f2d",
-"_fabs",
-"_fadd",
-"_fcmp4e",
-"_fcmpeq",
-"_fcmple",
-"_fdiv",
-"_feq",
-"_ffix",
-"_ffix_r",
-"_ffixu",
-"_ffixu_r",
-"_fflt",
-"_ffltu",
-"_fgeq",
-"_fgr",
-"_fleq",
-"_fls",
-"_fmul",
-"_fneg",
-"_fneq",
-"_fp_trap",
-"_fp_trapveneer",
-"_frcmple",
-"_frdiv",
-"_frsb",
-"_fsub",
-"_fun",
-"_init_alloc",
-"_init_user_alloc",
-"_ll_sfrom_d",
-"_ll_sfrom_d_r",
-"_ll_sfrom_f",
-"_ll_sfrom_f_r",
-"_ll_sto_d",
-"_ll_sto_f",
-"_ll_ufrom_d",
-"_ll_ufrom_d_r",
-"_ll_ufrom_f",
-"_ll_ufrom_f_r",
-"_ll_uto_d",
-"_ll_uto_f",
-"_terminate_user_alloc",
-"_ttywrch",
-"abort",
-"array_new_general",
-"copysign",
-"fabs",
-"malloc",
-"scalbln",
-"scalblnf",
-"scalblnl",
-"scalbn",
-"scalbnf",
-"scalbnl",
-"sqrt",
-"_vfp__fpl_inf_fsqrt",
-"_vfp_dfixu",
-"_vfp__fpl_dcmp_InfNaN",
-"_vfp_fp_trapveneer",
-"_vfp_dread",
-"_vfp__fpl_inf_ddiv",
-"_vfp_ffixu",
-"_vfp_ddiv",
-"_vfp__fflt_normalise",
-"_vfp__fpl_inf_d2f",
-"_vfp__fpl_inf_fdiv",
-"_vfp__fpl_exception",
-"_vfp__fpl_inf_dmul",
-"_vfp_sread",
-"_vfp_f2d",
-"_vfp_fdiv",
-"_vfp_dmul",
-"_vfp__dcmp4",
-"_vfp__fpl_inf_fmul",
-"_vfp_fmul",
-"_vfp__fcmp4",
-"_vfp__fpl_inf_dadd",
-"_vfp_dfltu",
-"_vfp_fcmp4e",
-"_vfp__fpl_inf_dcmp",
-"_vfp_read_fpscr",
-"_vfp_dadd",
-"_vfp__fpl_inf_ffixu_r",
-"_vfp__dunder_d",
-"_vfp__fpl_inf_fadd",
-"_vfp__fcmp4e",
-"_vfp_dfixu_r",
-"_vfp_ffltu",
-"_vfp__fpl_inf_fcmp",
-"_vfp_fadd",
-"_vfp__dflt_normalise",
-"_vfp__fpl_inf_ffix_r",
-"_vfp_drsb",
-"_vfp_dflt",
-"_vfp__funder",
-"_vfp__funder_d",
-"_fcmpge",
-"_vfp__fpl_inf_dfixu",
-"_vfp_frsb",
-"_vfp_fflt",
-"_vfp_ffix_r",
-"_vfp_dsqrt",
-"_vfp__fpl_inf_ffixu",
-"_vfp__fpl_fcheck_NaN1",
-"_vfp_drdiv",
-"_vfp__fpl_fcheck_NaN2",
-"_vfp_fsqrt",
-"_vfp__fpl_normalise2",
-"_vfp_ddiv_mantissas",
-"_vfp__fpl_inf_dfix",
-"_vfp__fpl_return_NaN",
-"_vfp_d2f",
-"_vfp_frdiv",
-"_vfp__fpl_inf_f2d",
-"_vfp_dneg",
-"_vfp_write_fpscr",
-"_vfp_dfix",
-"_vfp__fpl_inf_ffix",
-"_vfp__fpl_inf_dsub",
-"_vfp_swrite",
-"_vfp_dcmp4e",
-"_vfp__fpl_fcmp_InfNaN",
-"_vfp__fpl_inf_dfixu_r",
-"_vfp_fneg",
-"_vfp_ffix",
-"_vfp_dsub",
-"_vfp_dwrite",
-"_vfp__dcmp4e",
-"_vfp__fpl_inf_fsub",
-"_vfp__fpl_cmpreturn",
-"_vfp_fsub",
-"_vfp__fpl_inf_dfix_r",
-"_vfp__dunder",
-"_dcmpge",
-"_vfp_dcmp4",
-"_vfp__fpl_dcheck_NaN1",
-"_vfp__fpl_dcheck_NaN2",
-"_vfp_dabs",
-"_vfp_dfix_r",
-"_vfp__fpl_inf_dsqrt",
-"_vfp_fcmp4",
-"_vfp_ffixu_r",
-"_vfp_fabs",
-
-
-// For RVCT 3.1 vfpsupport.l archive.
-"_vfp_abs_double",
-"_vfp_abs_single",
-"_vfp_add_double",
-"_vfp_add_single",
-"_vfp_call_trap_handler",
-"_vfp_cmp_double",
-"_vfp_cmp_single",
-"_vfp_cmpe_double",
-"_vfp_cmpe_single",
-"_vfp_const_double",
-"_vfp_const_single",
-"_vfp_convert_cmp_result_1",
-"_vfp_convert_cmp_result_2",
-"_vfp_cvt_double",
-"_vfp_cvt_single",
-"_vfp_div_double",
-"_vfp_div_single",
-"_vfp_do_one_instruction_double",
-"_vfp_do_one_instruction_single",
-"_vfp_fix_double",
-"_vfp_fix_single",
-"_vfp_fixhp_double",
-"_vfp_fixhp_single",
-"_vfp_fixp_double",
-"_vfp_fixp_single",
-"_vfp_fixu_double",
-"_vfp_fixu_single",
-"_vfp_fixuhp_double",
-"_vfp_fixuhp_single",
-"_vfp_fixup_double",
-"_vfp_fixup_single",
-"_vfp_flt_double",
-"_vfp_flt_single",
-"_vfp_flthp_double",
-"_vfp_flthp_single",
-"_vfp_fltp_double",
-"_vfp_fltp_single",
-"_vfp_fltu_double",
-"_vfp_fltu_single",
-"_vfp_fltuhp_double",
-"_vfp_fltuhp_single",
-"_vfp_fltup_double",
-"_vfp_fltup_single",
-"_vfp_fp_d2f",
-"_vfp_fp_d2f_quiet",
-"_vfp_fp_dabs",
-"_vfp_fp_dadd",
-"_vfp_fp_dcmp",
-"_vfp_fp_dcmpe",
-"_vfp_fp_ddiv",
-"_vfp_fp_dfcmp",
-"_vfp_fp_dfcmpe",
-"_vfp_fp_dfix",
-"_vfp_fp_dfixll",
-"_vfp_fp_dfixllp",
-"_vfp_fp_dfixu",
-"_vfp_fp_dfixull",
-"_vfp_fp_dflt",
-"_vfp_fp_dfltll",
-"_vfp_fp_dfltll_scaled",
-"_vfp_fp_dfltllp",
-"_vfp_fp_dfltu",
-"_vfp_fp_dfltull",
-"_vfp_fp_dmul",
-"_vfp_fp_dneg",
-"_vfp_fp_drdiv",
-"_vfp_fp_drem",
-"_vfp_fp_drnd",
-"_vfp_fp_drsb",
-"_vfp_fp_dsqrt",
-"_vfp_fp_dsub",
-"_vfp_fp_f2d",
-"_vfp_fp_f2d_quiet",
-"_vfp_fp_fabs",
-"_vfp_fp_fadd",
-"_vfp_fp_fcmp",
-"_vfp_fp_fcmpe",
-"_vfp_fp_fdcmp",
-"_vfp_fp_fdcmpe",
-"_vfp_fp_fdiv",
-"_vfp_fp_ffix",
-"_vfp_fp_ffixll",
-"_vfp_fp_ffixllp",
-"_vfp_fp_ffixu",
-"_vfp_fp_ffixull",
-"_vfp_fp_fflt",
-"_vfp_fp_fflt_scaled",
-"_vfp_fp_ffltll",
-"_vfp_fp_ffltll_scaled",
-"_vfp_fp_ffltllp",
-"_vfp_fp_ffltu",
-"_vfp_fp_ffltull",
-"_vfp_fp_fma",
-"_vfp_fp_fmaf",
-"_vfp_fp_fmul",
-"_vfp_fp_fneg",
-"_vfp_fp_frdiv",
-"_vfp_fp_frem",
-"_vfp_fp_frnd",
-"_vfp_fp_frsb",
-"_vfp_fp_fsqrt",
-"_vfp_fp_fsub",
-"_vfp_fp_ilogb",
-"_vfp_fp_ilogbf",
-"_vfp_fp_logb",
-"_vfp_fp_logbf",
-"_vfp_fp_nextafter",
-"_vfp_fp_nextafterf",
-"_vfp_fp_nexttowardf",
-"_vfp_fp_scalbn",
-"_vfp_fp_scalbnf",
-"_vfp_mul_double",
-"_vfp_mul_single",
-"_vfp_neg_double",
-"_vfp_neg_single",
-"_vfp_process_exceptions",
-"_vfp_sqrt_double",
-"_vfp_sqrt_single",
-"_vfp_sub_double",
-"_vfp_sub_single"
-};
-#endif
--- a/toolsandutils/e32tools/elf2e32/source/stdexe_target.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class StdExeTarget for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include "stdexe_target.h"
-
-/**
-Constructor for the StdExeTarget Class
-
-@internalComponent
-@released
-*/
-StdExeTarget::StdExeTarget(ParameterListInterface* aParameterListInterface):
-ExportTypeFBTarget(aParameterListInterface)
-{
-}
-
-/**
-Destructor for the StdExeTarget Class
-
-@internalComponent
-@released
-*/
-StdExeTarget::~StdExeTarget(){
-
-}
-
-/**
-Function to check if the provided input is a DLL.
-
-@internalComponent
-@released
-
-@result False since StdExe Target is an Exe.
-*/
-bool StdExeTarget::ImageIsDll()
-{
- return false;
-}
-
-/**
-Function to check if writable data is allowed.
-
-@internalComponent
-@released
-
-@result True, since STDEXE targets can have writable data
-*/
-bool StdExeTarget::AllowDllData()
-{
- return true;
-}
-
-/**
-Function to write E32 image. Here, no def file or Dso file is generated.
-
-@internalComponent
-@released
-
-@result void
-*/
-void StdExeTarget::GenerateOutput()
-{
- WriteE32();
-}
-
-bool StdExeTarget::WarnForNewExports()
-{
- return false;
-}
-
-
--- a/toolsandutils/e32tools/elf2e32/source/stdexe_target.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class StdExeTarget of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-
-#ifndef STDEXE_TARGET_H
-#define STDEXE_TARGET_H
-
-#include "export_type_fb_target.h"
-
-/**
-This class is derived from the base class ExportTypeFBTarget and is responsible for
-creation of STDEXE Target.
-
-@internalComponent
-@released
-*/
-class StdExeTarget : public ExportTypeFBTarget
-{
-
-public:
- StdExeTarget(ParameterListInterface* aParameterListInterface);
- virtual ~StdExeTarget();
- bool ImageIsDll();
- bool AllowDllData();
- void GenerateOutput();
- bool WarnForNewExports();
-};
-
-
-
-#endif // STDEXE_TARGET_H
-
-
--- a/toolsandutils/e32tools/elf2e32/source/usecasebase.cpp Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,580 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Class UseCaseBase for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include <iostream>
-
-#include "usecasebase.h"
-#include "e32exporttable.h"
-
-#include "errorhandler.h"
-
-UseCaseBase::UseCaseBase(ParameterListInterface *aParameterListInterface)
-{
- iParameterListInterface = aParameterListInterface;
-}
-
-
-UseCaseBase::~UseCaseBase()
-{
-}
-
-/**
-This function calls the DefInput() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@return the name of the input DEF file if provided as input through --definput or 0.
-
-*/
-char * UseCaseBase::DefInput()
-{
- return (iParameterListInterface->DefInput());
-}
-
-/**
-This function calls the DSOOutput() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@return the name of the outut DSO file if provided as input through --dso or 0.
-
-*/
-char * UseCaseBase::DSOOutput()
-{
- return (iParameterListInterface->DSOOutput());
-}
-
-/**
-This function calls the LinkAsDLLName() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@return the name of the DLL to be linked with if provided as input through --linkas or 0.
-
-*/
-char * UseCaseBase::LinkAsDLLName()
-{
- return (iParameterListInterface->LinkAsDLLName());
-}
-
-/**
-This function calls the FileName() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@param aFileName
-The filename alongwith the absolute path.
-
-@return the filename (without the absolute path) for valid input else 0.
-
-*/
-char * UseCaseBase::FileName(char * aFileName)
-{
- return (iParameterListInterface->FileName(aFileName));
-}
-
-/**
-This function calls the DefOutput() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@return the name of the output DEF file if provided as input through --defoutput or 0.
-
-*/
-char * UseCaseBase::DefOutput()
-{
- return iParameterListInterface->DefOutput();
-}
-
-/**
-This function calls the ElfInput() from ParameterManager through the interface.
-
-@internalComponent
-@released
-
-@return the name of the Input ELF file if provided as input through --elfinput or 0.
-
-*/
-char * UseCaseBase::InputElfFileName()
-{
- return iParameterListInterface->ElfInput();
-}
-
-/**
-This function gets DSO file name from the parameter manager
-
-@internalComponent
-@released
-
-@return DSO file name
-
-*/
-const char * UseCaseBase::OutputDSOFileName()
-{
- return iParameterListInterface->DSOOutput();
-}
-
-/**
-This function gets the E32 image file name freom the parameter manager
-
-@internalComponent
-@released
-
-@return E32 image file name
-
-*/
-const char * UseCaseBase::OutputE32FileName()
-{
- return iParameterListInterface->E32ImageOutput();
-}
-
-/**
-This function returns if data in a DLL is allowed.
-
-@internalComponent
-@released
-
-@return if data in a DLL is allowed.
-
-*/
-bool UseCaseBase::AllowDllData()
-{
- return iParameterListInterface->DllDataP();
-}
-
-/**
-This function returns committed heap size
-
-@internalComponent
-@released
-
-@return committed heap size
-
-*/
-size_t UseCaseBase::HeapCommittedSize()
-{
- return iParameterListInterface->HeapCommittedSize();
-}
-
-/**
-This function returns reserved heap size
-
-@internalComponent
-@released
-
-@return reserved heap size
-
-*/
-size_t UseCaseBase::HeapReservedSize()
-{
- return iParameterListInterface->HeapReservedSize();
-}
-
-/**
-This function returns committed stack size
-
-@internalComponent
-@released
-
-@return committed stack size
-
-*/
-size_t UseCaseBase::StackCommittedSize()
-{
- return iParameterListInterface->StackCommittedSize();
-}
-
-/**
-This function returns if the def file is unfrozen
-
-@internalComponent
-@released
-
-@return if the def file is unfrozen
-
-*/
-bool UseCaseBase::Unfrozen()
-{
- return iParameterListInterface->Unfrozen();
-}
-
-/**
-This function returns Uid1
-
-@internalComponent
-@released
-
-@return Uid1
-
-*/
-unsigned int UseCaseBase::GetUid1()
-{
- return iParameterListInterface->Uid1();
-}
-
-/**
-This function returns Uid2
-
-@internalComponent
-@released
-
-@return Uid2
-
-*/
-unsigned int UseCaseBase::GetUid2()
-{
- return iParameterListInterface->Uid2();
-}
-
-/**
-This function returns Uid3
-
-@internalComponent
-@released
-
-@return Uid3
-
-*/
-unsigned int UseCaseBase::GetUid3()
-{
- return iParameterListInterface->Uid3();
-}
-
-/**
-This function returns secure Id
-
-@internalComponent
-@released
-
-@return secure Id
-
-*/
-unsigned int UseCaseBase::GetSecureId()
-{
- return iParameterListInterface->SecureId();
-}
-
-/**
-This function returns true if the --sid option is enabled.
-
-@internalComponent
-@released
-
-@return true if --sid option is passed in.
-
-*/
-bool UseCaseBase::GetSecureIdOption()
-{
- return iParameterListInterface->SecureIdOption();
-}
-
-/**
-This function returns vendor Id
-
-@internalComponent
-@released
-
-@return Vendor Id
-
-*/
-unsigned int UseCaseBase::GetVendorId()
-{
- return iParameterListInterface->VendorId();
-}
-
-/**
-This function returns version
-
-@internalComponent
-@released
-
-@return version
-
-*/
-unsigned int UseCaseBase::GetVersion()
-{
- return iParameterListInterface->Version();
-}
-
-/**
-This function returns call entry point
-
-@internalComponent
-@released
-
-@return call entry point
-
-*/
-bool UseCaseBase::GetCallEntryPoints()
-{
- return iParameterListInterface->CallEntryPoint();
-}
-
-/**
-This function returns capability
-
-@internalComponent
-@released
-
-@return capability
-
-*/
-SCapabilitySet UseCaseBase::GetCapability()
-{
- return iParameterListInterface->Capability();
-}
-
-/**
-This function returns priority
-
-@internalComponent
-@released
-
-@return priority
-
-*/
-TProcessPriority UseCaseBase::GetPriority()
-{
- return iParameterListInterface->Priority();
-}
-
-/**
-This function returns if fixed address is enabled.
-
-@internalComponent
-@released
-
-@return if fixed address is enabled.
-
-*/
-bool UseCaseBase::GetFixedAddress()
-{
- return iParameterListInterface->FixedAddress();
-}
-
-/**
-This function returns if compression is enabled.
-
-@internalComponent
-@released
-
-@return if compression is enabled.
-
-*/
-bool UseCaseBase::GetCompress()
-{
- return iParameterListInterface->Compress();
-}
-
-/**
-This function returns compression method
-
-@internalComponent
-@released
-
-@return UID of compression method
-
-*/
-unsigned int UseCaseBase::GetCompressionMethod()
-{
- return iParameterListInterface->CompressionMethod();
-}
-
-/**
-This function returns the FPU type.
-
-@internalComponent
-@released
-
-@return FPU type.
-
-*/
-unsigned int UseCaseBase::GetFPU()
-{
- return iParameterListInterface->FPU();
-}
-
-/**
-This function returns the library search path.
-
-@internalComponent
-@released
-
-@return libpath
-
-*/
-ParameterListInterface::LibSearchPaths & UseCaseBase::GetLibSearchPaths()
-{
- return iParameterListInterface->LibPath();
-}
-
-/**
-This function returns the logfile name
-
-@internalComponent
-@released
-
-@return log file name
-
-*/
-char * UseCaseBase::LogFile()
-{
- return (iParameterListInterface->LogFile());
-}
-
-/**
-This function returns if the logging option is enabled
-
-@internalComponent
-@released
-
-@return logging option enabled.
-
-*/
-bool UseCaseBase::LogFileOption()
-{
- return (iParameterListInterface->LogFileOption());
-}
-
-/**
-This function returns if export library is enabled.
-
-@internalComponent
-@released
-
-@return if the export library is enabled.
-
-*/
-bool UseCaseBase::GetIgnoreNonCallable()
-{
- return iParameterListInterface->IgnoreNonCallable();
-}
-
-/**
-This function returns the directory separator
-
-@internalComponent
-@released
-
-@return directory separator
-
-*/
-char UseCaseBase::GetDirectorySeparator()
-{
- return iParameterListInterface->DirectorySeparator();
-}
-
-
-bool UseCaseBase::IsCodePaged()
-{
- return (iParameterListInterface->IsCodePaged());
-}
-
-bool UseCaseBase::IsCodeUnpaged()
-{
- return (iParameterListInterface->IsCodeUnpaged());
-}
-
-bool UseCaseBase::IsCodeDefaultPaged()
-{
- return (iParameterListInterface->IsCodeDefaultPaged());
-}
-
-bool UseCaseBase::IsDataPaged()
-{
- return (iParameterListInterface->IsDataPaged());
-}
-
-bool UseCaseBase::IsDataUnpaged()
-{
- return (iParameterListInterface->IsDataUnpaged());
-}
-
-bool UseCaseBase::IsDataDefaultPaged()
-{
- return (iParameterListInterface->IsDataDefaultPaged());
-}
-
-/**
-This function returns whether the debuggable option is enabled or not.
-
-@internalComponent
-@released
-
-@return whether debuggable option is enabled.
-
-*/
-bool UseCaseBase::IsDebuggable()
-{
- return (iParameterListInterface->IsDebuggable());
-}
-
-
-bool UseCaseBase::IsSmpSafe()
-{
- return iParameterListInterface->IsSmpSafe();
-}
-
-/**
-This function returns if the unwanted exports are to be ignored
-
-@internalComponent
-@released
-
-@return if the unwanted exports are to be ignored
-
-*/
-bool UseCaseBase::ExcludeUnwantedExports()
-{
- return iParameterListInterface->ExcludeUnwantedExports();
-}
-
-/**
-This function returns if the target is a custom dll
-
-@internalComponent
-@released
-
-@return if target is a custom dll
-
-*/
-bool UseCaseBase::IsCustomDllTarget()
-{
- return iParameterListInterface->IsCustomDllTarget();
-}
-
-/**
-This function returns whether named lookup of symbols is enabled or not.
-
-@internalComponent
-@released
-
-@return default named symbol lookup enabled.
-
-*/
-bool UseCaseBase::GetNamedSymLookup()
-{
- return (iParameterListInterface->SymNamedLookup());
-}
-
--- a/toolsandutils/e32tools/elf2e32/source/usecasebase.h Fri Jun 25 18:24:47 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Implementation of the Header file for Class UseCaseBase of the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#ifndef USECASEBASE_H
-#define USECASEBASE_H
-
-#include "pl_symbol.h"
-#include "e32imagefile.h"
-#include "parameterlistinterface.h"
-
-class E32ImageFile;
-
-/**
-This class is the base class for the use cases. The appropriate usecases like LibraryTarget,
-DLLTarget, EXETarget are derived from this class.
-
-Other classes like ParameterManager are dependant on this class.
-
-@internalComponent
-@released
-*/
-class UseCaseBase
-{
-
-public:
- UseCaseBase(ParameterListInterface* aParameterListInterface);
- virtual ~UseCaseBase();
- char * DefInput();
- char * DSOOutput();
- char * LinkAsDLLName();
- char * FileName(char *aFileName);
-
-//const char * DefOutput();
- char *DefOutput();
-
- char *LogFile();
- bool LogFileOption();
-
-char * InputElfFileName();
-
-const char * OutputDSOFileName();
-
-const char * OutputE32FileName();
-
-bool AllowDllData();
-
-size_t HeapCommittedSize();
-
-size_t HeapReservedSize();
-
-size_t StackCommittedSize();
-
-unsigned int GetUid1();
-
-unsigned int GetUid2();
-
-unsigned int GetUid3();
-
-unsigned int GetSecureId();
-bool GetSecureIdOption();
-
-unsigned int GetVendorId();
-
-unsigned int GetVersion();
-
-bool GetCallEntryPoints();
-
-SCapabilitySet GetCapability();
-bool Unfrozen();
-
-TProcessPriority GetPriority();
-
-bool GetFixedAddress();
-
-bool GetCompress();
-unsigned int GetCompressionMethod();
-
-unsigned int GetFPU();
-
-ParameterListInterface::LibSearchPaths & GetLibSearchPaths();
-
-
-bool GetIgnoreNonCallable();
-
-char GetDirectorySeparator();
-
-bool IsCodePaged();
-bool IsCodeUnpaged();
-bool IsCodeDefaultPaged();
-
-bool IsDataPaged();
-bool IsDataUnpaged();
-bool IsDataDefaultPaged();
-
-bool ExcludeUnwantedExports();
-bool IsCustomDllTarget();
-bool GetNamedSymLookup();
-
-bool IsDebuggable();
-
-bool IsSmpSafe();
-
-SymbolType SymbolTypeF(char * aName);
-/**
-This function creates the appropriate target.
-
-@internalComponent
-@released
-
-@return EXIT_SUCCESS if the generation of the target is successful, else EXIT_FAILURE
-*/
- virtual int Execute() = 0;
-
-protected:
- /** Pointer to the ParameterListInterface */
- ParameterListInterface *iParameterListInterface;
-
-
-};
-
-
-
-
-#endif // USECASEBASE_H
--- a/toolsandutils/e32tools/group/bld.inf Fri Jun 25 18:24:47 2010 +0100
+++ b/toolsandutils/e32tools/group/bld.inf Sun Jun 27 13:33:42 2010 +0100
@@ -11,7 +11,7 @@
// Contributors:
//
// Description:
-// Base tools (e.g. petran)
+// Base tools, excluding those now built from sftools/dev/build
//
//
@@ -29,14 +29,7 @@
../tranasm/tranasm.bat /epoc32/tools/tranasm.bat
../tranasm/tranasm.pl /epoc32/tools/tranasm.pl
../tranasm/tranasm_x86.pl /epoc32/tools/tranasm_x86.pl
-../elftools/elf2inf.pl /epoc32/tools/elf2inf.pl
-../elftools/def2dll.bat /epoc32/tools/def2dll.bat
-../elftools/def2dll.pl /epoc32/tools/def2dll.pl
-../elftools/deputil.pl /epoc32/tools/deputil.pl
-../elftools/deputil.pm /epoc32/tools/deputil.pm
../elftools/inc/elfdefs.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(tools/elfdefs.h)
-../checklib/tag/tag_elf /epoc32/tools/tag/tag_elf
-../checklib/tag/tag_coff /epoc32/tools/tag/tag_coff
../inc/seclib.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(seclib.h)
@@ -44,24 +37,15 @@
#ifdef TOOLS
eruntest
etouch
-../pe_dump/pe_dump.mmp
pediff
readtype
rommask
w32repro
wveconv
bin2coff
-genstubs
-getexports
-elftran
seclib
secdump
petran
-#else
-checklib.mmp
-../elf2e32/group/elf2e32.mmp
-elfdump
-seclib
#endif
PRJ_TESTMMPFILES