e32tools/elf2e32/source/pl_elfexecutable.cpp
changeset 27 3a31ca4b29c4
parent 2 39c28ec933dd
--- a/e32tools/elf2e32/source/pl_elfexecutable.cpp	Sat Jul 17 15:09:24 2010 +0100
+++ b/e32tools/elf2e32/source/pl_elfexecutable.cpp	Wed Aug 04 12:07:55 2010 +0100
@@ -1438,7 +1438,7 @@
 
 	try {
 
-		bool limitSymbolFound = false;
+		bool specialSymbolFound = false;
 
 		// If Symbol is absolute then assume it came from linker and is a
 		// limit symbol.
@@ -1448,19 +1448,22 @@
 		}
 		else
 		{
+			// does the symbol point to the address after the end of the code or data segments?
 			if( (iCodeSegmentHdr && aSym->st_value == (iCodeSegmentHdr->p_vaddr + iCodeSegmentHdr->p_memsz)) ||
 				(iDataSegmentHdr && aSym->st_value == (iDataSegmentHdr->p_vaddr + iDataSegmentHdr->p_memsz)) )
 			{
-				//If Symbol is a $$Limit symbol, then consider the open boundary.
-				String limitstr = iStringTable + aSym->st_name;
-				if (limitstr.rfind("$$Limit",limitstr.length()) != String::npos)
-				{
-					aHdr = SegmentFromAbs(aSym->st_value);
-					limitSymbolFound = true;
-				}
+				//If Symbol contains $$, it is linker generated so consider the open boundary.
+				//e.g. SHT$$INIT_ARRAY$$Limit and sometimes SHT$$INIT_ARRAY$$Base 
+				String aSymstr = iStringTable + aSym->st_name;
+				if (aSymstr.rfind("$$",aSymstr.length()) != String::npos)
+ 				{
+ 					aHdr = SegmentFromAbs(aSym->st_value);
+					specialSymbolFound = true;
+ 				}
+
 			}
 
-			if(!limitSymbolFound )
+			if(!specialSymbolFound )
 			{
 				aHdr = Segment(aSym->st_value);
 			}