author | mikek |
Fri, 02 Jul 2010 11:11:13 +0100 | |
changeset 22 | f76056b903a8 |
parent 20 | f2446ffbf2b5 |
child 23 | 0a67eddbe320 |
permissions | -rwxr-xr-x |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
2 |
// All rights reserved. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
4 |
// under the terms of "Eclipse Public License v1.0" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
7 |
// |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
8 |
// Initial Contributors: |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
10 |
// |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
11 |
// Contributors: |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
12 |
// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010 |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
13 |
// |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
14 |
// Description: |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
15 |
// FileDump Operations of elf2e32 tool to dump E32Image and generate ASM File. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
16 |
// @internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
17 |
// @released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
18 |
// |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
19 |
// |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
20 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
21 |
#include "pl_common.h" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
22 |
#include "filedump.h" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
23 |
#include "e32imagefile.h" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
24 |
#include "h_utl.h" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
25 |
#include "deffile.h" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
26 |
#include "errorhandler.h" |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
27 |
#include <cstdio> |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
28 |
#include <cassert> |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
29 |
|
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
30 |
/** |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
31 |
Constructor for class FileDump |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
32 |
@param aParameterListInterface - Instance of class ParameterListInterface |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
33 |
@internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
34 |
@released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
35 |
*/ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
36 |
FileDump::FileDump(ParameterListInterface* aParameterListInterface) : UseCaseBase(aParameterListInterface) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
37 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
38 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
39 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
40 |
/** |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
41 |
Destructor for class FileDump |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
42 |
@internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
43 |
@released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
44 |
*/ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
45 |
FileDump::~FileDump() |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
46 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
47 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
48 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
49 |
/** |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
50 |
Execute Function for the File Dump. It dumps E32 image or generate ASM file based on the |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
51 |
file dump options |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
52 |
@return 0 on success, otherwise throw error |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
53 |
@internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
54 |
@released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
55 |
*/ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
56 |
int FileDump::Execute() |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
57 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
58 |
if(iParameterListInterface->FileDumpOption() && iParameterListInterface->E32OutOption() && iParameterListInterface->DefFileInOption()) //DumpAsm |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
59 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
60 |
if(!(iParameterListInterface->DumpOptions() & EDumpAsm)) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
61 |
throw InvalidArgumentError(INVALIDARGUMENTERROR,(!iParameterListInterface->FileDumpSubOptions()?"":iParameterListInterface->FileDumpSubOptions()) ,"--dump"); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
62 |
if(iParameterListInterface->DumpOptions() & 31) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
63 |
throw InvalidArgumentError(INVALIDARGUMENTERROR,(!iParameterListInterface->FileDumpSubOptions()?"":iParameterListInterface->FileDumpSubOptions()),"--dump"); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
64 |
if(!iParameterListInterface->E32ImageOutput()) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
65 |
throw ParameterParserError(NOREQUIREDOPTIONERROR,"--output"); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
66 |
if(!iParameterListInterface->DefInput()) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
67 |
throw ParameterParserError(NOREQUIREDOPTIONERROR,"--definput"); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
68 |
|
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
69 |
GenerateAsmFile(); |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
70 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
71 |
else |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
72 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
73 |
if(!iParameterListInterface->E32Input()) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
74 |
throw ParameterParserError(NOREQUIREDOPTIONERROR,"--e32input"); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
75 |
if(iParameterListInterface->DumpOptions() & EDumpAsm ) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
76 |
throw InvalidArgumentError(INVALIDARGUMENTERROR,iParameterListInterface->FileDumpSubOptions() ,"--dump"); |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
77 |
DumpE32Image(); |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
78 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
79 |
return 0; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
80 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
81 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
82 |
/** |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
83 |
Function to generate ASM File. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
84 |
@param afileName - ASM File name |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
85 |
@return 0 on success, otherwise throw error |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
86 |
@internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
87 |
@released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
88 |
*/ |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
89 |
int FileDump::GenerateAsmFile() //DumpAsm |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
90 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
91 |
EAsmDialect asmDialect = iParameterListInterface->AsmDialect(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
92 |
switch(asmDialect) |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
93 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
94 |
case EGas: |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
95 |
return GenerateGasAsmFile(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
96 |
case EArmas: |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
97 |
return GenerateArmasAsmFile(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
98 |
default: |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
99 |
assert(false); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
100 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
101 |
return 0; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
102 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
103 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
104 |
/** |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
105 |
Function to generate an RVCT armas ASM File. |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
106 |
@param afileName - ASM File name |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
107 |
@return 0 on success, otherwise throw error |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
108 |
@internalComponent |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
109 |
@released |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
110 |
*/ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
111 |
int FileDump::GenerateArmasAsmFile() |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
112 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
113 |
DefFile *iDefFile = new DefFile(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
114 |
SymbolList *aSymList; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
115 |
aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput()); |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
116 |
char const *afileName = iParameterListInterface->E32ImageOutput(); |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
117 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
118 |
FILE *fptr; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
119 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
120 |
if((fptr=fopen(afileName,"w"))==NULL) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
121 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
122 |
throw FileError(FILEOPENERROR,(char*)afileName); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
123 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
124 |
else |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
125 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
126 |
SymbolList::iterator aItr = aSymList->begin(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
127 |
SymbolList::iterator last = aSymList->end(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
128 |
Symbol *aSym; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
129 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
130 |
while( aItr != last) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
131 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
132 |
aSym = *aItr; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
133 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
134 |
if(aSym->Absent()) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
135 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
136 |
aItr++; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
137 |
continue; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
138 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
139 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
140 |
fputs("\tIMPORT ",fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
141 |
fputs(aSym->SymbolName(),fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
142 |
//Set the visibility of the symbols as default."DYNAMIC" option is |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
143 |
//added to remove STV_HIDDEN visibility warnings generated by every |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
144 |
//export during kernel build |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
145 |
fputs(" [DYNAMIC]", fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
146 |
fputs("\n",fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
147 |
aItr++; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
148 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
149 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
150 |
// Create a directive section that instructs the linker to make all listed |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
151 |
// symbols visible. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
152 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
153 |
fputs("\n AREA |.directive|, READONLY, NOALLOC\n\n",fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
154 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
155 |
fputs("\tDCB \"#<SYMEDIT>#\\n\"\n", fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
156 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
157 |
aItr = aSymList->begin(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
158 |
while (aItr != last) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
159 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
160 |
aSym = *aItr; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
161 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
162 |
if ( aSym->Absent() ) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
163 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
164 |
aItr++; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
165 |
continue; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
166 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
167 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
168 |
// Example: |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
169 |
// DCB "EXPORT __ARM_ll_mlass\n" |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
170 |
fputs("\tDCB \"EXPORT ",fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
171 |
fputs(aSym->SymbolName(),fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
172 |
fputs("\\n\"\n", fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
173 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
174 |
aItr++; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
175 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
176 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
177 |
fputs("\n END\n",fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
178 |
fclose(fptr); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
179 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
180 |
return 0; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
181 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
182 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
183 |
/** |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
184 |
Function to generate a GNU as ASM File. |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
185 |
@param afileName - ASM File name |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
186 |
@return 0 on success, otherwise throw error |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
187 |
@internalComponent |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
188 |
@released |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
189 |
*/ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
190 |
int FileDump::GenerateGasAsmFile() |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
191 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
192 |
DefFile *iDefFile = new DefFile(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
193 |
SymbolList *aSymList; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
194 |
aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput()); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
195 |
char const *afileName = iParameterListInterface->E32ImageOutput(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
196 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
197 |
FILE *fptr; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
198 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
199 |
if((fptr=fopen(afileName,"w"))==NULL) |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
200 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
201 |
throw FileError(FILEOPENERROR,(char*)afileName); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
202 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
203 |
else |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
204 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
205 |
SymbolList::iterator aItr = aSymList->begin(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
206 |
SymbolList::iterator last = aSymList->end(); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
207 |
Symbol *aSym; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
208 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
209 |
while( aItr != last) |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
210 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
211 |
aSym = *aItr; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
212 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
213 |
if(aSym->Absent()) |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
214 |
{ |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
215 |
aItr++; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
216 |
continue; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
217 |
} |
22
f76056b903a8
1) A better fix for Bug 2979 - [GCCE] elf2e32 --dump generates RVCT assembly.
mikek
parents:
20
diff
changeset
|
218 |
fputs("\t.common ",fptr); |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
219 |
fputs(aSym->SymbolName(),fptr); |
22
f76056b903a8
1) A better fix for Bug 2979 - [GCCE] elf2e32 --dump generates RVCT assembly.
mikek
parents:
20
diff
changeset
|
220 |
fputs(" 4\n",fptr); |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
221 |
aItr++; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
222 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
223 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
224 |
fclose(fptr); |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
225 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
226 |
return 0; |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
227 |
} |
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
228 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
229 |
|
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
230 |
/** |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
231 |
Function to Dump E32 Image. |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
232 |
@param afileName - E32 Image File name |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
233 |
@return 1 on success, otherwise throw error |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
234 |
@internalComponent |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
235 |
@released |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
236 |
*/ |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
237 |
int FileDump::DumpE32Image() |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
238 |
{ |
20
f2446ffbf2b5
Provide elf2e32 with an option to select either RVCT assembler or GNU assembler output for the --dump option
mikek
parents:
2
diff
changeset
|
239 |
char const *afileName = iParameterListInterface->E32Input(); |
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
240 |
E32ImageFile *aE32Imagefile=new E32ImageFile(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
241 |
TInt result = aE32Imagefile->Open(afileName); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
242 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
243 |
if (result > 0) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
244 |
return 1; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
245 |
else if (result == KErrCorrupt || result == KErrNotSupported) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
246 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
247 |
throw InvalidE32ImageError(INVALIDE32IMAGEERROR, (char *)afileName); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
248 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
249 |
else if (result != 0) |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
250 |
{ |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
251 |
throw FileError(FILEREADERROR, (char *)afileName); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
252 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
253 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
254 |
int dumpOptions=iParameterListInterface->DumpOptions(); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
255 |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
256 |
aE32Imagefile->Dump((TText*)afileName, dumpOptions); |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
257 |
delete aE32Imagefile; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
258 |
return KErrNone; |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
259 |
} |
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
260 |