summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-02-02 22:54:48 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2014-02-11 02:07:51 (GMT)
commitc4dcff6ec731a7550d70dba9374aabd554b7a4c0 (patch)
tree34bb6ca290db47b682cef43f248aecfff241640c
parent614a61f3667ea0d61c4ff9d9881d98fb80c875e0 (diff)
downloadabc8000-c4dcff6ec731a7550d70dba9374aabd554b7a4c0.zip
abc8000-c4dcff6ec731a7550d70dba9374aabd554b7a4c0.tar.gz
abc8000-c4dcff6ec731a7550d70dba9374aabd554b7a4c0.tar.bz2
abc8000-c4dcff6ec731a7550d70dba9374aabd554b7a4c0.tar.xz
genrel.pl: always sort relocations
Output the relocations in strict numeric order, for sanity and consistency.
-rwxr-xr-xdata/sysrom/genrel.pl12
1 files changed, 6 insertions, 6 deletions
diff --git a/data/sysrom/genrel.pl b/data/sysrom/genrel.pl
index 494fc55..435f5ed 100755
--- a/data/sysrom/genrel.pl
+++ b/data/sysrom/genrel.pl
@@ -61,8 +61,7 @@ if ($binsize > $totalsize) {
# Now actually parse relocations
#
undef $base;
-$relocs = '';
-$nrelocs = 0;
+@relocs = ();
while (defined($line = <SHRFILE>)) {
chomp $line;
if ($line =~ /^Relocation section '([^\']+)' /) {
@@ -94,8 +93,7 @@ while (defined($line = <SHRFILE>)) {
die "$0: relocation at an odd address\n";
}
- $relocs .= pack("N", $base + $offset);
- $nrelocs++;
+ push(@relocs, $base + $offset);
}
}
close(SHRFILE);
@@ -120,7 +118,7 @@ print OUT pack("N*",
$totalsize, # Memory allocation size
$binsize, # Binary data size
$bsssize, # Size to be zeroed
- $nrelocs); # Relocation count
+ scalar @relocs); # Relocation count
print OUT "\0" x (512 - 8*4);
#
@@ -141,6 +139,8 @@ print OUT "\0" x ($binsize - $raw_binsize);
#
# Output the relocations
#
-print OUT $relocs;
+@relocs = sort { $a <=> $b } @relocs;
+print OUT pack("N*", @relocs);
exit 0;
+