tools/repair_obyfile.pl
author William Roberts <williamr@symbian.org>
Mon, 25 Oct 2010 17:26:54 +0100
changeset 80 3ab0df073c86
parent 57 a44af1db196f
permissions -rw-r--r--
Add support for "slim", which is "stem" + removal of some exports and checking of import details For this to work, the static_dependencies.txt file needs to contain the augmented dependency information. To help with this, it can now consume a mixture of both rom_content.csv lines and static_dependencies.txt lines: the best way to update the information would be something like (edit rom_content.csv to add "slim" to XXX.dll) findstr /i "xxx.dll" rom_content.csv > slim.txt findstr /i "xxx.dll" static_dependencies.txt >> slim.txt perl ..\tools\static_dependencies.pl -u static_dependencies.txt slim.txt > new_dependencies.txt This will notice the "slim" marking for xxx.dll, and record the detailed import and export lists for xxx.dll and everything which links to it. The new information will look something like sys\bin\xxx.dll /epoc32/release/armv5/urel/stem_xxx.dll exports=1-98.100-102:euser[100039e5].dll sys\bin\yyy.dll /epoc32/release/armv5/urel/yyy.dll euser[100039e5].dll:xxx[102750c7].dll@2.4-5.77.104-106:scppnwdl.dll sys\bin\zzz.dll /epoc32/release/armv5/urel/zzz.dll euser[100039e5].dll:xxx[102750c7].dll@23.25.74-77:scppnwdl.dll Only executables for which there is a "slim" marking will have this level of detail. The filtering script now does the detailed cross-checking of imports to exports for "slim" executables. In this case, it will observe the stem_xxx.dll does not export ordinal 104, and so the filtering will include deleting sys\bin\yyy.dll (xxx.dll Missing ordinal 104) sys\bin\zzz.dll will be acceptable, because it only uses ordinals which are still present in stem_xxx.dll

# Copyright (c) 2010 Symbian Foundation Ltd.
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Symbian Foundation - initial contribution.
#
# Contributors:
#
# Description: 
# Process file ROM log to make it suitable for re-use by buildrom.pl

use strict;
use Getopt::Long;

my $featurelist = "syborg_stem_features.iby";
GetOptions(
  "f|features=s" => \$featurelist,   # name of featurelist file
  );

print "ROM_IMAGE[0] {\n";
print "#include \"$featurelist\"\n";

my $line;
while ($line = <>)
	{
	# Put back original auto-btmap statements for any "mbm_rom" derived files
	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
	
	# Put back original __ECOM_PLUGIN lines
	# REM expanded __ECOM_PLUGIN(\epoc32\release\ARMV5\urel,Sys\Bin,\epoc32\data\Z,Resource\Plugins, a3fFourCCConvertorPlugin.dll , a3fFourCCConvertorPlugin.dll ) 
	if ($line =~ /^REM expanded\s+__ECOM_PLUGIN/)
		{
		$line =~ s/REM expanded\s+//;
		my $discarded = <>;		# discard the derived file= line for the plugin
		}
	
	if ($line =~ /REM processed spidata/)
		{
		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
		}
		
	if ($line =~ /REM processed \s*patchdata/i)
		{
		$line =~ s/REM processed\s+//;	# reinstate the original patchdata line
		my $discarded = <>;		# discard the final "patchdata ... addr" line
		}
		
	$line =~ s/REM processed //;	# re-enable other directives
	
	if ($line =~ /^time=/)
		{
		$line = "time=##TODAY## 12:00:00\n";
		}
	
	# remove lines added by buildrom for generated files
	
	if ($line =~ /^data=\S+\\([^\\]+)\s+"\S+"/)
		{
		my $file = $1;
		if ($file =~ /features.dat|ecom-\d-\d\.s/)
			{
			# print STDERR "Discarded: $line";
			next;
			}
		}

	if ($line =~ /^REM (ROM_IMAGE\[\d\])$/)
		{
		$line = "$1 {\n";
		print "}\n";		# close the preceeding ROM_IMAGE
		}

	print $line;
	}

print "}\n";