#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# HOWTO use this to update BaseAddrs.ref:
#
# This takes the old BaseAddrs.ref and a build listing showing LNK4013
# and LNK4198 errors and produces an updated BaseAddrs.ref with any
# necessary changes for incorrect sizes or missing modules.
#
# Missing modules are added with a default size of 64K, so another
# build is needed to determine if a non-default size is required for
# newly added modules.
use strict;
my $oldref = shift;
my $listing = shift;
my $newref = shift;
my $starting_addr = 0x6FF00000;
my $default_size = 0x00010000;
my @modnames = ();
my @maxsizes = ();
my @comments = ();
my $in_defs = undef;
open(F, "<$oldref") or die;
while (<F>) {
my $l = $_;
chomp($l);
$in_defs = 1;
}
if ($in_defs) {
my @fields = split(/[ \t]+/, $l);
}
else {
}
}
close(F) or die;
my $curlib = undef;
my %reported = ();
open(F, "<$listing") or die;
while (<F>) {
my $l = $_;
chomp($l);
if ($1 eq "libhttpd") {
$curlib = "$1.dll";
}
else {
$curlib = "$1.so";
}
}
my $newsize = hex($1);
# round to nearest 64K
my $i = 0;
while ($i < scalar(@modnames)) {
print " (from $maxsizes[$i])\n";
last;
}
++$i;
}
}
}
my $mod = $1;
print "$mod must be added\n";
}
}
}
close(F) or die;
open(F, ">$newref") or die;
print F join("\n", @comments);
print F "\n";
my $i = 0;
my $curaddr = $starting_addr;
while ($i < scalar(@modnames)) {
++$i;
}
close(F) or die;