Solve incorrect handling of ExportName=SymbolName@Ordinal syntax
authorjascui
Tue, 16 Nov 2010 15:56:27 +0800
changeset 683 8e0eb519ef53
parent 682 2c32f186fa1f (diff)
parent 681 240a07ea3a13 (current diff)
child 685 39f7ecf8fbc7
child 686 3e502c8c584c
Solve incorrect handling of ExportName=SymbolName@Ordinal syntax
--- a/e32tools/elf2e32/source/deffile.cpp	Fri Nov 12 17:02:24 2010 +0800
+++ b/e32tools/elf2e32/source/deffile.cpp	Tue Nov 16 15:56:27 2010 +0800
@@ -463,27 +463,27 @@
 		IsWord(iLine + iOffset, aCurrentPos);
 
 		char *cmt = strchr(iLine + iOffset, ';');
-		char *aAlias = strchr(iLine + iOffset, '=');
+		char *aExport = strchr(iLine + iOffset, '=');
 
-		if( aAlias && (!cmt || (aAlias < cmt)) )
+		if( aExport && (!cmt || (aExport < cmt)) )
 		{
-			int aAliasPos = aAlias - (iLine+ iOffset);
+			int aExportPos = aExport - (iLine+ iOffset);
 
 			//Check if alias name is also supplied, they should be separated 
-			// by whitespace, i.e., SymbolName=AliasName is valid while, 
-			// SymbolName =AliasName is invalid.
-			if( aAliasPos > aCurrentPos)
+			// by whitespace, i.e., ExportName=SymbolName is valid while,
+			// ExportName =SymbolName is invalid.
+			if( aExportPos > aCurrentPos)
 			{
 				char *aToken = (iLine + iOffset + aCurrentPos);
 				throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum, aToken);
 			}
 
-			aSymbolName = new char[aAliasPos+1];
-			strncpy(aSymbolName, iLine + iOffset, aAliasPos);
-			aSymbolName[aAliasPos] = '\0';
-			char *aExportName = new char[aCurrentPos - aAliasPos + 1];
-			strncpy(aExportName, aAlias +1, (aCurrentPos - aAliasPos));
-			aExportName[(aCurrentPos - aAliasPos)] = '\0';
+			char* aExportName = new char[aExportPos+1];
+			strncpy(aExportName, iLine+iOffset, aExportPos);
+			aExportName[aExportPos] = '\0';
+			aSymbolName = new char[aCurrentPos - aExportPos + 1];
+			strncpy(aSymbolName, aExport +1, (aCurrentPos - aExportPos));
+			aSymbolName[(aCurrentPos - aExportPos-1)] = '\0';
 			iSymbol->ExportName(aExportName);
 		}
 		else
--- a/e32tools/elf2e32/source/pl_elfproducer.cpp	Fri Nov 12 17:02:24 2010 +0800
+++ b/e32tools/elf2e32/source/pl_elfproducer.cpp	Tue Nov 16 15:56:27 2010 +0800
@@ -172,7 +172,10 @@
 	while(aItr != aEnd) {
 		String		aSymName("");
 		aSym = *aItr;
-		aSymName = aSym->SymbolName();
+		if(aSym->ExportName())
+			aSymName = aSym->ExportName();
+		else
+			aSymName = aSym->SymbolName();
 		//set symbol info..
 		iElfDynSym[aIdx].st_name = iDSOSymNameStrTbl.size();
 
@@ -183,7 +186,10 @@
 
 		//set version table info...
 		iVersionTbl[aIdx] = DEFAULT_VERSION;
-		AddToHashTable(aSym->SymbolName(), aIdx);
+		if(aSym->ExportName())
+			AddToHashTable(aSym->ExportName(), aIdx);
+		else
+			AddToHashTable(aSym->SymbolName(), aIdx);
 		aItr++;aIdx++;
 	}