--- a/sbsv1_os/e32toolp/e32util/armasm2as.pl Tue Jul 13 16:41:02 2010 +0100
+++ b/sbsv1_os/e32toolp/e32util/armasm2as.pl Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
# Nokia Corporation - initial contribution.
#
# Contributors:
+# Mike Kinghan, mikek@symbian.org, for Symbian Foundation
#
# Description:
# e32toolp\e32util\armasm2as.pl
@@ -288,12 +289,14 @@
$val =~ s/\{TRUE\}/(1)/g;
$val =~ s/\{FALSE\}/(0)/g;
- my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*)/, $val );
+ my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*|\s*\(\s*|\s*\)\s*)/, $val );
foreach (@lops) {
s/\s*\:LAND\:\s*/\:LAND\:/go;
s/\s*\:LOR\:\s*/\:LOR\:/go;
s/\s*\:LNOT\:\s*/\:LNOT\:/go;
s/\s*\:DEF\:\s*/\:DEF\:/go;
+ s/\s*\(\s*/\(/go;
+ s/\s*\)\s*/\)/go;
}
my @lops2;
while (scalar (@lops)) {
@@ -306,7 +309,7 @@
push @$outref, "\t.ifdef $sym\n\t.set __defined__$sym, 1\n\t.else\n\t.set __defined__$sym, 0\n\t.endif\n";
push @lops2, " __defined__$sym ";
} else {
- die "Bad :DEF: operand\n";
+ die "Bad :DEF: operand $sym\n";
}
} elsif ($x eq ':LAND:') {
push @lops2, ' && ';
@@ -320,12 +323,28 @@
while (scalar (@lops2)) {
my $x = shift @lops2;
if ($x eq ':LNOT:') {
- my $operand;
- while (1) {
+ my $operand = shift @lops2;
+ while (@lops2 && $operand =~ /^\s*$/) {
$operand = shift @lops2;
- last if ($operand !~ /^\s*$/);
}
- push @lops3, "(0==($operand))";
+ if ($operand eq '(') {
+ my $balance = 1;
+ my $compound = $operand;
+ while($balance > 0 && @lops2) {
+ $operand = shift @lops2;
+ if ($operand eq '(') {
+ ++$balance;
+ }
+ elsif ($operand eq ')') {
+ --$balance;
+ }
+ $compound .= $operand;
+ }
+ push @lops3, "(0==$compound)";
+ }
+ else {
+ push @lops3, "(0==($operand))";
+ }
} else {
push @lops3, $x;
}
--- a/toolsandutils/buildsystem/extension/base/bootstrap.mk Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/buildsystem/extension/base/bootstrap.mk Thu Jul 22 16:44:43 2010 +0100
@@ -13,10 +13,15 @@
# Description:
#
-# To ensure that EPOCROOT always ends with a forward slash.
+# To ensure that EPOCROOT always ends with a forward slash.
TMPROOT:=$(subst \,/,$(EPOCROOT))
EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+HOST_PLATFORM := $(patsubst linux%,linux,$(HOSTPLATFORM_DIR))
+ifeq (linux,$(HOST_PLATFORM))
+INC_PATH := $(EPOCROOT)epoc32/include/platform
+endif
+
ifndef CPU
CPU := arm
endif
@@ -75,6 +80,8 @@
endif
ifeq "$(CPU)" "arm"
+
+ifdef ARMCC
ASMINCPATH := . $(EPOCBLDABS) $(ASMINCPATH) $(EXTENSION_ROOT) $(EPOCCPUINC)
ARMASM_OUT := $(shell armasm 2>&1)
ARMASM_OUT_RVCT := $(wordlist 1,6,$(ARMASM_OUT))
@@ -95,6 +102,28 @@
endif
endif
+ifdef GCCE
+TOOLVER := GCCE
+ASMINCPATH := . $(EPOCBLDABS) $(ASMINCPATH) $(EXTENSION_ROOT) $(EPOCCPUINC)
+ifeq (linux,$(HOST_PLATFORM))
+EXE_SUFFIX :=
+else
+EXE_SUFFIX := .exe
+endif
+ifdef SBS_GCCE441BIN
+GCCEBIN := $(SBS_GCCE441BIN)
+else ifdef SBS_GCCE433BIN
+GCCEBIN := $(SBS_GCCE433BIN)
+else ifdef SBS_GCCE432BIN
+GCCEBIN := $(SBS_GCCE432BIN)
+endif
+GCCEASM := $(GCCEBIN)/arm-none-symbianelf-as$(EXE_SUFFIX)
+GCCELD := $(GCCEBIN)/arm-none-symbianelf-ld$(EXE_SUFFIX)
+GCCESTRIP := $(GCCEBIN)/arm-none-symbianelf-strip$(EXE_SUFFIX)
+endif
+
+endif
+
ifeq "$(MEMMODEL)" "direct"
CFG_MM := CFG_MMDirect
endif
@@ -242,6 +271,41 @@
$(ERASE) $(call slash2generic,$(TEMPTRG))
endef
endif
+ ifeq "$(TOOLVER)" "GCCE"
+ ASM_MACROS += USE_CXSF GNU_ASM
+ ASM := $(GCCEASM)
+ ASM_LIST_OPTS := -acdhlms
+ LINK := $(GCCELD)
+ STRIP := $(GCCESTRIP)
+ SRCEXT := s
+ INCEXT := ginc
+ OBJEXT := o
+ EXEEXT := in
+ ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join -I ,$(dir)))
+ ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),--defsym $(macro)=1 )
+ AFLAGS := -g --keep-locals $(ASM_MACRO_CMD) $(ASMINCPATHCMD)
+ LFLAGS := -Ttext $(LINKBASE) --entry $(LINKBASE) --print-map
+ ASMTYP := AS
+ PROCESS_INCLUDES := 1
+ ifndef LINKFILE
+ LINKFILE := bootstrap.lnk
+ endif
+ define do_asm
+ perl $(EPOCROOT)/epoc32/tools/armasm2as.pl $< $(join $(basename $@),.ss)
+ $(ASM) $(AFLAGS) -o $@ $(ASM_LIST_OPTS)=$(join $(basename $@),.lst) $(join $(basename $@),.ss)
+ endef
+ define do_link
+ $(call ifexistf,$(join $(basename $@),.lnk),$(ERASE) $(call slash2generic,$(join $(basename $@),.lnk)) )
+ $(COPY) $(call normalise_path,$(filter %.lnk,$^)) $(join $(basename $@),.lnk)
+ $(LINK) $(LFLAGS) -o $@ $(filter %.$(OBJEXT),$^)
+ $(COPY) $@ $(join $(basename $(TRG)),.sym)
+ endef
+ define do_strip
+ $(STRIP) -O binary -o $(TEMPTRG) $<
+ $(COPY) $(TEMPTRG) $@
+ $(ERASE) $(call slash2generic,$(TEMPTRG))
+ endef
+ endif
endif
@@ -273,7 +337,7 @@
BASEINCLUDES := bootcpu.inc bootmacro.inc
endif
BASEINCLUDES := $(foreach f,$(BASEINCLUDES),$(basename $(f)).$(INCEXT))
-INCLUDES := $(foreach f,$(INCLUDES),$(basename $(f)).$(INCEXT))
+INCLUDES := $(foreach f,$(INCLUDES),$(basename $(notdir $(f))).$(INCEXT))
# Generic object files
BASEOBJECTS = $(foreach src, $(BASESOURCES), $(basename $(src)).$(OBJEXT))
@@ -298,7 +362,7 @@
vpath %.lnk . $(EXTENSION_ROOT) $(EPOCCPUINC)
# How to link the object files
-$(EPOCBLDABS)/$(NAME).$(EXEEXT): $(LINKOBJECTS) $(LINKFILE) $(call pipe,$(EPOCBLDABS))
+$(EPOCBLDABS)/$(NAME).$(EXEEXT): $(LINKOBJECTS) $(LINKFILE) $(call pipe,$(EPOCBLDABS))
$(do_link)
# How to strip linked object to binary
@@ -314,7 +378,7 @@
perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $@
$(FULLINCLUDES) : $(EPOCBLDABS)/%.$(INCEXT) : %.inc $(call pipe,$(EPOCBLDABS))
- perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $@
+ perl $(EPOCROOT)/epoc32/tools/armasm2as.pl $< $@
$(FULLBASEOBJECTS) : $(EPOCBLDABS)/%.$(OBJEXT) : %.$(SRCEXT) $(FULLINCLUDES) $(FULLBASEINCLUDES) $(FULLGENINCLUDES) $(call pipe,$(EPOCBLDABS))
$(do_asm)
--- a/toolsandutils/buildsystem/shell/cmd.mk Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/buildsystem/shell/cmd.mk Thu Jul 22 16:44:43 2010 +0100
@@ -132,5 +132,16 @@
1
endef
+# Macro to execute a command if a file exists.
+define ifexistf
+if exist $(1) $(2)
+endef
+
+# Macro ensure path delimiters are the right sort.
+define normalise_path
+$(subst /,\,$(1))
+endef
+
+
# Configuration needs to be returned as upper case for abld
CONFIGURATION:=REL
--- a/toolsandutils/buildsystem/shell/sh.mk Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/buildsystem/shell/sh.mk Thu Jul 22 16:44:43 2010 +0100
@@ -113,5 +113,15 @@
-$(ERASE) -f $(1)
endef
+# Macro to execute a command if a file exists.
+define ifexistf
+if [ -f $(1) ]; then $(2); fi
+endef
+
+# Macro ensure path delimiters are the right sort.
+define normalise_path
+$(subst \,/,$(1))
+endef
+
# Configuration needs to be returned as upper case for abld
CONFIGURATION:=rel
--- a/toolsandutils/e32tools/checklib/library/library.cpp Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 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 Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/group/elf2e32.mmp Thu Jul 22 16:44:43 2010 +0100
@@ -27,9 +27,9 @@
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
+OS_LAYER_SYSTEMINCLUDE
+systeminclude /epoc32/include /epoc32/include/tools
+userinclude ../source ../include
option GCC -w
--- a/toolsandutils/e32tools/elf2e32/source/deflatecompress.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/deflatecompress.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -29,14 +29,6 @@
const TUint KDeflateHashMultiplier=0xAC4B9B19u;
const TInt KDeflateHashShift=24;
-#define COMPILE_TIME_ASSERT(e) \
- switch (0) \
- { \
- case 0: \
- case e: \
- ; \
- }
-
/**
Class HDeflateHash
@internalComponent
@@ -133,30 +125,8 @@
*/
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(HMem::Alloc(0,_FOFF(HDeflateHash,iOffset[Min(aLinks,KDeflateMaxDistance)]))) HDeflateHash;
return new(new char[_FOFF(HDeflateHash,iOffset[Min(aLinks,KDeflateMaxDistance)])]) HDeflateHash;
-#endif
}
/**
--- a/toolsandutils/e32tools/elf2e32/source/e32exporttable.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/e32exporttable.h Thu Jul 22 16:44:43 2010 +0100
@@ -20,7 +20,7 @@
#ifndef __E32EXPORTTABLE__
#define __E32EXPORTTABLE__
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
#include "pl_elfexports.h"
--- a/toolsandutils/e32tools/elf2e32/source/e32imagefile.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/e32imagefile.h Thu Jul 22 16:44:43 2010 +0100
@@ -23,7 +23,7 @@
#include "pl_elfrelocation.h"
#include "pl_elfrelocations.h"
#include "e32imagedefs.h"
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
#include <fstream>
#include <vector>
--- a/toolsandutils/e32tools/elf2e32/source/elffilesupplied.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/elffilesupplied.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -235,9 +235,13 @@
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;
+ // Ignore the non callable exports
+ if ((strncmp("_ZTI", (*aResultPos)->SymbolName(), len)) &&
+ (strncmp("_ZTV", (*aResultPos)->SymbolName(), len)))
+ {
+ iSymList.insert(iSymList.end(), *aResultPos);
+ cout << "Elf2e32: Warning: Symbol " << (*aResultPos)->SymbolName() << " absent in the DEF file, but present in the ELF file" << endl;
+ }
aResultPos++;
}
}
--- a/toolsandutils/e32tools/elf2e32/source/filedump.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/filedump.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
// Nokia Corporation - initial contribution.
//
// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
//
// Description:
// FileDump Operations of elf2e32 tool to dump E32Image and generate ASM File.
@@ -23,7 +24,9 @@
#include "h_utl.h"
#include "deffile.h"
#include "errorhandler.h"
-#include <stdio.h>
+#include <cstdio>
+#include <cassert>
+
/**
Constructor for class FileDump
@param aParameterListInterface - Instance of class ParameterListInterface
@@ -63,7 +66,7 @@
if(!iParameterListInterface->DefInput())
throw ParameterParserError(NOREQUIREDOPTIONERROR,"--definput");
- GenerateAsmFile(iParameterListInterface->E32ImageOutput());
+ GenerateAsmFile();
}
else
{
@@ -71,7 +74,7 @@
throw ParameterParserError(NOREQUIREDOPTIONERROR,"--e32input");
if(iParameterListInterface->DumpOptions() & EDumpAsm )
throw InvalidArgumentError(INVALIDARGUMENTERROR,iParameterListInterface->FileDumpSubOptions() ,"--dump");
- DumpE32Image(iParameterListInterface->E32Input());
+ DumpE32Image();
}
return 0;
}
@@ -83,11 +86,34 @@
@internalComponent
@released
*/
-int FileDump::GenerateAsmFile(const char* afileName)//DumpAsm
+int FileDump::GenerateAsmFile() //DumpAsm
+{
+ EAsmDialect asmDialect = iParameterListInterface->AsmDialect();
+ switch(asmDialect)
+ {
+ case EGas:
+ return GenerateGasAsmFile();
+ case EArmas:
+ return GenerateArmasAsmFile();
+ default:
+ assert(false);
+ }
+ return 0;
+}
+
+/**
+Function to generate an RVCT armas ASM File.
+@param afileName - ASM File name
+@return 0 on success, otherwise throw error
+@internalComponent
+@released
+*/
+int FileDump::GenerateArmasAsmFile()
{
DefFile *iDefFile = new DefFile();
SymbolList *aSymList;
aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput());
+ char const *afileName = iParameterListInterface->E32ImageOutput();
FILE *fptr;
@@ -155,14 +181,62 @@
}
/**
+Function to generate a GNU as ASM File.
+@param afileName - ASM File name
+@return 0 on success, otherwise throw error
+@internalComponent
+@released
+*/
+int FileDump::GenerateGasAsmFile()
+{
+ DefFile *iDefFile = new DefFile();
+ SymbolList *aSymList;
+ aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput());
+ char const *afileName = iParameterListInterface->E32ImageOutput();
+
+ 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("\t.extern ",fptr);
+ fputs(aSym->SymbolName(),fptr);
+ fputs("\n",fptr);
+ aItr++;
+ }
+
+ 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)
+int FileDump::DumpE32Image()
{
+ char const *afileName = iParameterListInterface->E32Input();
E32ImageFile *aE32Imagefile=new E32ImageFile();
TInt result = aE32Imagefile->Open(afileName);
--- a/toolsandutils/e32tools/elf2e32/source/filedump.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/filedump.h Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
// Nokia Corporation - initial contribution.
//
// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
//
// Description:
// FileDump Class for elf2e32 tool
@@ -35,8 +36,10 @@
~FileDump();
int Execute();
private:
- int DumpE32Image(const char * fileName);
- int GenerateAsmFile(const char* afileName);//DumpAsm
+ int DumpE32Image();
+ int GenerateAsmFile();//DumpAsm
+ int GenerateArmasAsmFile();
+ int GenerateGasAsmFile();
};
#endif
--- a/toolsandutils/e32tools/elf2e32/source/pagedcompress.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pagedcompress.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -270,26 +270,32 @@
}
-void CompressPages(TUint8* bytes, TInt size, std::ofstream& os)
+void CompressPages(TUint8 * bytes, TInt size, std::ofstream& os)
{
// Build a list of compressed pages
- TUint16 numOfPages = (TUint16) ((size + PAGE_SIZE - 1) / PAGE_SIZE);
+ TUint16 numOfPages = (TUint16) (size / PAGE_SIZE);
+ if ( size % PAGE_SIZE > 0)
+ ++numOfPages;
- CBytePairCompressedImage* comprImage = CBytePairCompressedImage::NewLC(numOfPages, size);
- if (!comprImage)
+ CBytePairCompressedImage *comprImage = CBytePairCompressedImage::NewLC(numOfPages, size);
+ if( NULL == comprImage)
{
//Print(EError," NULL == comprImage\n");
return;
}
- TUint pageNum;
- TUint remain = (TUint)size;
- for (pageNum=0; pageNum<numOfPages; ++pageNum)
+ TUint8* iPageStart;
+ TUint16 iPageLen;
+ TUint16 iPage = 0;
+
+ while(iPage * PAGE_SIZE <= size )
{
- TUint8* pageStart = bytes + pageNum * PAGE_SIZE;
- TUint pageLen = remain>PAGE_SIZE ? PAGE_SIZE : remain;
- comprImage->AddPage((TUint16)pageNum, pageStart, (TUint16)pageLen);
- remain -= pageLen;
+ iPageStart = &bytes[iPage * PAGE_SIZE];
+ iPageLen = (TUint16)( (iPage + 1) * PAGE_SIZE < size ? PAGE_SIZE : size - iPage * PAGE_SIZE);
+
+ comprImage->AddPage(iPage, iPageStart, iPageLen);
+
+ ++iPage;
}
// Write out index table and compressed pages
@@ -301,7 +307,6 @@
}
-
int DecompressPages(TUint8 * bytes, std::ifstream& is)
{
TUint decompressedSize = 0;
--- a/toolsandutils/e32tools/elf2e32/source/parameterlistinterface.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/parameterlistinterface.h Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
// Nokia Corporation - initial contribution.
//
// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
//
// Description:
// Implementation of the Header file for the ParameterListInterface of the elf2e32 tool
@@ -43,6 +44,12 @@
EStdExe
};
+enum EAsmDialect // Which dialect of arm assembly to write for the --dump option
+{
+ EArmas, // RVCT armas
+ EGas // GNU as
+};
+
typedef unsigned int UINT;
using std::vector;
@@ -278,6 +285,7 @@
virtual bool SymNamedLookup() = 0;
virtual bool IsDebuggable() = 0;
virtual bool IsSmpSafe() = 0;
+ virtual EAsmDialect AsmDialect() = 0;
};
--- a/toolsandutils/e32tools/elf2e32/source/parametermanager.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/parametermanager.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
// Nokia Corporation - initial contribution.
//
// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
//
// Description:
// Implementation of the Class ParameterManager for the elf2e32 tool
@@ -111,7 +112,8 @@
iCustomDllTarget(false),
iSymNamedLookup(false),
iDebuggable(false),
- iSmpSafe(false)
+ iSmpSafe(false),
+ iAsmDialect(EArmas)
{
iArgumentCount = aArgc;
ParamList temp(aArgv, aArgv+aArgc);
@@ -430,6 +432,12 @@
(void*)ParameterManager::ParseSmpSafe,
"SMP Safe",
},
+ {
+ "asm",
+ (void*)ParameterManager::ParseAsmDialect,
+ "Dialect of arm assembly to write for the --dump option. "
+ "Either \"gas\" (GNU as) or \"armas\" (RVCT as: default)",
+ },
{
"help",
(void *)ParameterManager::ParamHelp,
@@ -648,7 +656,7 @@
parser(this, "help", 0, 0);
}
- parser(this, const_cast<char*>(aName.c_str()), optval, aDesc);
+ parser(this, aName.c_str(), optval, aDesc);
}
}
@@ -1509,6 +1517,21 @@
}
/**
+This function indicates the asm assembly dialect that will be written for the
+--dump option, as determined by the specified or default value of the --asm
+option.
+
+@internalComponent
+@released
+
+@return EArmas if --asm=armas was passed, else EGas
+*/
+EAsmDialect ParameterManager::AsmDialect()
+{
+ return iAsmDialect;
+}
+
+/**
This function extracts the filename from the absolute path that is given as input.
@internalComponent
@@ -2248,7 +2271,7 @@
{
int len = nq;
symbol = new char[len+1];
- memcpy(symbol, p, len);
+ memcpy(symbol, &*p, len);
symbol[len] = 0;
q = nq+1;
@@ -2388,7 +2411,7 @@
if (*e == '-' || *e == '+') break;
}
if (e != b)
- ParseCapability1(b, e, aCapabilities, invert);
+ ParseCapability1(&*b, &*e, aCapabilities, invert);
b = e;
@@ -2847,6 +2870,23 @@
aPM->SetSmpSafe(true);
}
+DEFINE_PARAM_PARSER(ParameterManager::ParseAsmDialect)
+{
+ INITIALISE_PARAM_PARSER;
+ if (!strcmp(aValue,"gas"))
+ {
+ aPM->SetAsmDialect(EGas);
+ }
+ else if (!strcmp(aValue,"armas"))
+ {
+ aPM->SetSmpSafe(EArmas);
+ }
+ else
+ {
+ throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "--asm");
+ }
+}
+
static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
{
{ "DLL", EDll },
@@ -3729,3 +3769,18 @@
{
iSmpSafe = aVal;
}
+
+/**
+This function sets iAsmDialect if --asm is passed in.
+
+@internalComponent
+@released
+
+@param aVal
+A member of enum EAsmDialect
+*/
+void ParameterManager::SetAsmDialect(EAsmDialect aAsmDialect)
+{
+ iAsmDialect = aAsmDialect;
+}
+
--- a/toolsandutils/e32tools/elf2e32/source/parametermanager.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/parametermanager.h Thu Jul 22 16:44:43 2010 +0100
@@ -9,6 +9,7 @@
// Nokia Corporation - initial contribution.
//
// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
//
// Description:
// Implementation of the Header file for Class ParameterManager of the elf2e32 tool
@@ -81,7 +82,7 @@
typedef std::map<string, const OptionDesc *, OptionCompare> OptionMap;
typedef vector<char *> LibSearchPaths;
- typedef void (*ParserFn)(ParameterManager *, char *, char *, const OptionDesc *);
+ typedef void (*ParserFn)(ParameterManager *, char const *, char const *, const OptionDesc *);
#define DECLARE_PARAM_PARSER(name) \
@@ -144,6 +145,7 @@
DECLARE_PARAM_PARSER(ParseSymNamedLookup);
DECLARE_PARAM_PARSER(ParseDebuggable);
DECLARE_PARAM_PARSER(ParseSmpSafe);
+ DECLARE_PARAM_PARSER(ParseAsmDialect);
ParameterManager(int aArgc, char** aArgv);
virtual ~ParameterManager();
@@ -195,6 +197,7 @@
void SetSymNamedLookup(bool aVal);
void SetDebuggable(bool aVal);
void SetSmpSafe(bool aVal);
+ void SetAsmDialect(EAsmDialect aAsmDialect);
int NumOptions();
int NumShortOptions();
@@ -279,6 +282,7 @@
bool SymNamedLookup();
bool IsDebuggable();
bool IsSmpSafe();
+ EAsmDialect AsmDialect();
private:
/** The number of command line arguments passed into the program */
@@ -445,6 +449,7 @@
bool iSymNamedLookup;
bool iDebuggable;
bool iSmpSafe;
+ EAsmDialect iAsmDialect;
};
--- a/toolsandutils/e32tools/elf2e32/source/pl_common.cpp Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pl_common.cpp Thu Jul 22 16:44:43 2010 +0100
@@ -17,7 +17,7 @@
//
//
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
#include "pl_common.h"
--- a/toolsandutils/e32tools/elf2e32/source/pl_common.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pl_common.h Thu Jul 22 16:44:43 2010 +0100
@@ -27,7 +27,7 @@
#pragma warning(disable: 4710) // function not inlined
#endif
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
typedef unsigned long PLULONG;
typedef unsigned int PLUINT32;
--- a/toolsandutils/e32tools/elf2e32/source/pl_dllsymbol.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pl_dllsymbol.h Thu Jul 22 16:44:43 2010 +0100
@@ -20,7 +20,7 @@
#if !defined(_PL_DLLSYMBOL_H_)
#define _PL_DLLSYMBOL_H_
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
#include "pl_symbol.h"
/**
--- a/toolsandutils/e32tools/elf2e32/source/pl_elfconsumer.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pl_elfconsumer.h Thu Jul 22 16:44:43 2010 +0100
@@ -26,7 +26,7 @@
using std::list;
-enum{ KMaxWindowsIOSize = 31 * 1024 * 1024 };
+enum{ KMaxWindowsIOSize = 32 * 1024 * 1024 };
/**
This class is for reading the ELF file generated by the static linker and based on whether it is
--- a/toolsandutils/e32tools/elf2e32/source/pl_sym_type.h Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/elf2e32/source/pl_sym_type.h Thu Jul 22 16:44:43 2010 +0100
@@ -20,7 +20,7 @@
#if !defined(EA_37C067EA_9B6B_4d95_84A3_ABBE88E7AD8F__INCLUDED_)
#define EA_37C067EA_9B6B_4d95_84A3_ABBE88E7AD8F__INCLUDED_
-#include <tools/elfdefs.h>
+#include "elfdefs.h"
enum SymbolType
{
--- a/toolsandutils/e32tools/group/bld.inf Tue Jul 13 16:41:02 2010 +0100
+++ b/toolsandutils/e32tools/group/bld.inf Thu Jul 22 16:44:43 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,17 @@
#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