e32tools/elf2e32/source/pl_elfexecutable.cpp
changeset 689 b70d8ea6cf75
parent 684 2defe8c85348
equal deleted inserted replaced
688:27f7c5c966fc 689:b70d8ea6cf75
  1436 {
  1436 {
  1437 	Elf32_Phdr * aHdr;
  1437 	Elf32_Phdr * aHdr;
  1438 
  1438 
  1439 	try {
  1439 	try {
  1440 
  1440 
  1441 		bool limitSymbolFound = false;
  1441 		bool specialSymbolFound = false;
  1442 
  1442 
  1443 		// If Symbol is absolute then assume it came from linker and is a
  1443 		// If Symbol is absolute then assume it came from linker and is a
  1444 		// limit symbol.
  1444 		// limit symbol.
  1445 		if (aSym->st_shndx == SHN_ABS)
  1445 		if (aSym->st_shndx == SHN_ABS)
  1446 		{
  1446 		{
  1447 			aHdr = SegmentFromAbs(aSym->st_value);
  1447 			aHdr = SegmentFromAbs(aSym->st_value);
  1448 		}
  1448 		}
  1449 		else
  1449 		else
  1450 		{
  1450 		{
       
  1451 			// does the symbol point to the address after the end of the code or data segments?
  1451 			if( (iCodeSegmentHdr && aSym->st_value == (iCodeSegmentHdr->p_vaddr + iCodeSegmentHdr->p_memsz)) ||
  1452 			if( (iCodeSegmentHdr && aSym->st_value == (iCodeSegmentHdr->p_vaddr + iCodeSegmentHdr->p_memsz)) ||
  1452 				(iDataSegmentHdr && aSym->st_value == (iDataSegmentHdr->p_vaddr + iDataSegmentHdr->p_memsz)) )
  1453 				(iDataSegmentHdr && aSym->st_value == (iDataSegmentHdr->p_vaddr + iDataSegmentHdr->p_memsz)) )
  1453 			{
  1454 			{
  1454 				//If Symbol is a $$Limit symbol, then consider the open boundary.
  1455 				//If Symbol contains $$, it is linker generated so consider the open boundary.
  1455 				String limitstr = iStringTable + aSym->st_name;
  1456  				//e.g. SHT$$INIT_ARRAY$$Limit and sometimes SHT$$INIT_ARRAY$$Base 
  1456 				if (limitstr.rfind("$$Limit",limitstr.length()) != String::npos)
  1457  				String aSymstr = iStringTable + aSym->st_name;
       
  1458  				if (aSymstr.rfind("$$",aSymstr.length()) != String::npos)
  1457 				{
  1459 				{
  1458 					aHdr = SegmentFromAbs(aSym->st_value);
  1460 					aHdr = SegmentFromAbs(aSym->st_value);
  1459 					limitSymbolFound = true;
  1461 					specialSymbolFound = true;
  1460 				}
  1462 				}
  1461 			}
  1463 			}
  1462 
  1464 
  1463 			if(!limitSymbolFound )
  1465 			if(!specialSymbolFound )
  1464 			{
  1466 			{
  1465 				aHdr = Segment(aSym->st_value);
  1467 				aHdr = Segment(aSym->st_value);
  1466 			}
  1468 			}
  1467 
  1469 
  1468 		}
  1470 		}