--- a/e32tools/elf2e32/source/parametermanager.cpp Fri Jun 18 12:51:41 2010 +0100
+++ b/e32tools/elf2e32/source/parametermanager.cpp Mon Jun 21 17:57:23 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
@@ -25,6 +26,7 @@
#include "parametermanager.h"
#include "errorhandler.h"
#include <iostream>
+#include <cstdlib>
#include "h_utl.h"
#include "h_ver.h"
@@ -110,7 +112,8 @@
iCustomDllTarget(false),
iSymNamedLookup(false),
iDebuggable(false),
- iSmpSafe(false)
+ iSmpSafe(false),
+ iAsmDialect(EArmas)
{
iArgumentCount = aArgc;
ParamList temp(aArgv, aArgv+aArgc);
@@ -429,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,
@@ -647,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);
}
}
@@ -1508,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
@@ -2247,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;
@@ -2387,7 +2411,7 @@
if (*e == '-' || *e == '+') break;
}
if (e != b)
- ParseCapability1(b, e, aCapabilities, invert);
+ ParseCapability1(&*b, &*e, aCapabilities, invert);
b = e;
@@ -2846,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 },
@@ -3728,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;
+}
+