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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2010 Symbian Foundation Ltd.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
# All rights reserved.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Symbian Foundation - initial contribution.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# Contributors:
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
# Description: 
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Process file ROM log to make it suitable for re-use by buildrom.pl
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
use strict;
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    17
use Getopt::Long;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    18
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    19
my $featurelist = "syborg_stem_features.iby";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    20
GetOptions(
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    21
  "f|features=s" => \$featurelist,   # name of featurelist file
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    22
  );
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    23
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    24
print "ROM_IMAGE[0] {\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    25
print "#include \"$featurelist\"\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    26
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
my $line;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
while ($line = <>)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
	{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
	# Put back original auto-btmap statements for any "mbm_rom" derived files
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
	# Put back original __ECOM_PLUGIN lines
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
	# REM expanded __ECOM_PLUGIN(\epoc32\release\ARMV5\urel,Sys\Bin,\epoc32\data\Z,Resource\Plugins, a3fFourCCConvertorPlugin.dll , a3fFourCCConvertorPlugin.dll ) 
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
	if ($line =~ /^REM expanded\s+__ECOM_PLUGIN/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
		$line =~ s/REM expanded\s+//;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
		my $discarded = <>;		# discard the derived file= line for the plugin
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
		}
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
	if ($line =~ /REM processed spidata/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
		}
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    45
		
57
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    46
	if ($line =~ /REM processed \s*patchdata/i)
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    47
		{
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    48
		$line =~ s/REM processed\s+//;	# reinstate the original patchdata line
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    49
		my $discarded = <>;		# discard the final "patchdata ... addr" line
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    50
		}
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 9
diff changeset
    51
		
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
	$line =~ s/REM processed //;	# re-enable other directives
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
	if ($line =~ /^time=/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
		$line = "time=##TODAY## 12:00:00\n";
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
		}
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
	
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    59
	# remove lines added by buildrom for generated files
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    60
	
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    61
	if ($line =~ /^data=\S+\\([^\\]+)\s+"\S+"/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    62
		{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    63
		my $file = $1;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    64
		if ($file =~ /features.dat|ecom-\d-\d\.s/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    65
			{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    66
			# print STDERR "Discarded: $line";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    67
			next;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    68
			}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    69
		}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    70
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    71
	if ($line =~ /^REM (ROM_IMAGE\[\d\])$/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    72
		{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    73
		$line = "$1 {\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    74
		print "}\n";		# close the preceeding ROM_IMAGE
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    75
		}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    76
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
	print $line;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
	}
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    79
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    80
print "}\n";