kernel/eka/rombuild/rom_sbs.pl
branchGCC_SURGE
changeset 187 02f19e28d12e
parent 113 ebd3f79a304f
child 221 39b39e1a406e
equal deleted inserted replaced
186:c829bdc03aa3 187:02f19e28d12e
   694 	my ($file, $name) = @_;
   694 	my ($file, $name) = @_;
   695 
   695 
   696 	open TMP, $file or die "Can't read $file\n";
   696 	open TMP, $file or die "Can't read $file\n";
   697 
   697 
   698 	# ignore local symbols.
   698 	# ignore local symbols.
   699 	while (<TMP> !~ /Global Symbols/) { }
       
   700 
       
   701 	while (<TMP>)
   699 	while (<TMP>)
   702 	{
   700 	{
   703 		if (/^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i)
   701 		last if /Global Symbols|Linker script and memory map/;
       
   702 	}
       
   703 
       
   704   my @return_values = ();
       
   705   my $line;
       
   706 	while ($line = <TMP>)
       
   707 	{
       
   708 		next if (index($line, $name) < 0);		
       
   709 		
       
   710 		# RVCT 2.2
       
   711 		# 
       
   712 		#     KHeapMinCellSize  0x0004e38c  Data 4  mem.o(.constdata)
       
   713 		#
       
   714 		if ($line =~ /^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i)
   704 		{
   715 		{
   705 			my ($symbol, $addr, $size) = ($1, $2, $3);
   716 			my ($symbol, $addr, $size) = ($1, $2, $3);
   706 			if ($symbol eq $name)
   717 			if ($symbol eq $name)
   707 			{
   718 			{
   708 				close TMP;
   719 				@return_values = ($addr, $size);
   709 				return ($addr, $size);
   720 				last;
   710 			}
   721 			}
   711 		}
   722 		}
   712 
   723 
   713 		# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)"
   724 		# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)"
   714 		# in the map file. Here is an example:
   725 		# in the map file. Here is an example:
   715 		#
   726 		#
   716 		# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata)
   727 		# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata)
   717 		#
   728 		#
   718 		elsif (/^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i)
   729 		elsif ($line =~ /^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i)
   719 		{
   730 		{
   720 			my ($symbol, $addr, $size) = ($1, $2, $3);
   731 			my ($symbol, $addr, $size) = ($1, $2, $3);
   721 			if ($symbol eq $name)
   732 			if ($symbol eq $name)
   722 			{
   733 			{
   723 				close TMP;
   734 				@return_values = ($addr, $size);
   724 				return ($addr, $size);
   735 				last;
   725 			}
   736 			}
   726 		}
   737 		}
   727 	}
   738 		
   728 
   739 		# GCC 4.x map files
   729 	die "patchdata: Can't find symbol $name\n";
   740 		#                 0x00114c68                KHeapMinCellSize
       
   741 		#                 0x00114c6c                KHeapShrinkHysRatio
       
   742 		#  .rodata        0x00115130      0x968 M:/epoc32/build/kernel/c_99481fddbd6c6f58/_omap3530_ekern_exe/armv5/udeb/heap_hybrid.o
       
   743 		#
       
   744 		elsif ($line =~ /^.+\s+(0x\S+)\s+(\S+)/i)
       
   745 		{
       
   746 			my ($addr, $symbol) = ($1, $2);
       
   747 			if ($symbol eq $name)
       
   748 			{
       
   749 				my $next_line = <TMP>;
       
   750 				if ($next_line =~ /^.+\s+(0x\S+)\s+(\S+)/i)
       
   751 				{
       
   752 					my $addr2 = $1;
       
   753 					
       
   754 					@return_values = ($addr, hex($addr2) - hex($addr));
       
   755 					last;
       
   756 				}
       
   757 			}
       
   758 		}
       
   759 
       
   760 	}
       
   761 	close TMP;
       
   762 
       
   763 	die "patchdata: Can't find symbol $name\n" if (scalar @return_values == 0);
       
   764 	return @return_values;
   730 }
   765 }
   731 
   766 
   732 sub parsePatchData($$)
   767 sub parsePatchData($$)
   733 {
   768 {
   734 	my ($infile, $outfile) = @_;
   769 	my ($infile, $outfile) = @_;