|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Implementation of the Class PolyDLL Rebuild Target for the elf2e32 tool |
|
15 // @internalComponent |
|
16 // @released |
|
17 // |
|
18 // |
|
19 |
|
20 #include "polydll_rebuild_target.h" |
|
21 #include "deffile.h" |
|
22 #include "errorhandler.h" |
|
23 |
|
24 #include <iostream> |
|
25 |
|
26 using std::list; |
|
27 |
|
28 /** |
|
29 Constructor for the POLYDLLRebuildTarget Class |
|
30 |
|
31 @internalComponent |
|
32 @released |
|
33 */ |
|
34 POLYDLLRebuildTarget::POLYDLLRebuildTarget(ParameterListInterface* aParameterListInterface) : ExportTypeRebuildTarget(aParameterListInterface) { |
|
35 } |
|
36 |
|
37 /** |
|
38 Destructor for the POLYDLLRebuildTarget Class |
|
39 |
|
40 @internalComponent |
|
41 @released |
|
42 */ |
|
43 POLYDLLRebuildTarget::~POLYDLLRebuildTarget() |
|
44 { |
|
45 } |
|
46 |
|
47 /** |
|
48 Function to process the symbols to be exported. In case of Poly DLL, there might be |
|
49 predefined symbols passed to '--sydef' option, need to consider them alongwith the |
|
50 symbols coming from the DEF file and ELF file. |
|
51 |
|
52 @internalComponent |
|
53 @released |
|
54 */ |
|
55 void POLYDLLRebuildTarget::ProcessExports() |
|
56 { |
|
57 int count = iParameterListInterface->SysDefCount(); |
|
58 ParameterListInterface::Sys aSysDefSymbols[10]; |
|
59 |
|
60 int j=0, i=count; |
|
61 while (i) |
|
62 { |
|
63 aSysDefSymbols[j] = iParameterListInterface->SysDefSymbols(j); |
|
64 j++; i--; |
|
65 } |
|
66 |
|
67 typedef SymbolList::iterator Iterator; |
|
68 |
|
69 Symbol *aSymbolEntry; |
|
70 |
|
71 SymbolList *iSysDefExports = new SymbolList; |
|
72 |
|
73 iDefExports = iDefFile->ReadDefFile(iParameterListInterface->DefInput()); |
|
74 |
|
75 for (int k=0; k < count; k++) |
|
76 { |
|
77 SymbolType aType = SymbolTypeCode; |
|
78 aSymbolEntry = new Symbol(aSysDefSymbols[k].iSysDefSymbolName, aType); |
|
79 aSymbolEntry->SetOrdinal(aSysDefSymbols[k].iSysDefOrdinalNum); |
|
80 iSysDefExports->push_back(aSymbolEntry); |
|
81 } |
|
82 |
|
83 // Check if the Sysdefs and the DEF file are matching. |
|
84 |
|
85 Iterator aBegin = iSysDefExports->begin(); |
|
86 Iterator aEnd = iSysDefExports->end(); |
|
87 |
|
88 Iterator aDefBegin = iDefExports->begin(); |
|
89 Iterator aDefEnd = iDefExports->end(); |
|
90 |
|
91 std::list<String> aMissingSysDefList; |
|
92 |
|
93 while ((aDefBegin != aDefEnd) && (aBegin != aEnd)) |
|
94 { |
|
95 if (strcmp((*aBegin)->SymbolName(), (*aDefBegin)->SymbolName())) |
|
96 aMissingSysDefList.push_back((*aBegin)->SymbolName()); |
|
97 aBegin++; |
|
98 aDefBegin++; |
|
99 } |
|
100 |
|
101 if( aMissingSysDefList.size() ) |
|
102 throw SysDefMismatchError(SYSDEFSMISMATCHERROR, aMissingSysDefList, UseCaseBase::DefInput()); |
|
103 |
|
104 ValidateExports(iDefExports); |
|
105 CreateExports(); |
|
106 } |
|
107 |
|
108 /** |
|
109 Function to generate the output E32 image. Incase of an output DEF file, then the |
|
110 DEF file and the corresponding DSO file should be generated. |
|
111 |
|
112 @internalComponent |
|
113 @released |
|
114 */ |
|
115 void POLYDLLRebuildTarget::GenerateOutput() { |
|
116 |
|
117 if( UseCaseBase::DefOutput() ) { |
|
118 WriteDefFile(); |
|
119 } |
|
120 if(UseCaseBase::DSOOutput() && UseCaseBase::LinkAsDLLName()) { |
|
121 WriteDSOFile(); |
|
122 } |
|
123 WriteE32(); |
|
124 } |