summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-02-02 22:54:48 (GMT)
committerH. Peter Anvin <hpa@linux.intel.com>2013-02-02 22:54:48 (GMT)
commitfc130526edf711a5126bd3268674605792a5dd8b (patch)
tree7bbc06476edab2d2f10eadfe9a23ba90e5a53577
parentcd0479de803614ba46ee7e6a3d223dddf30e8753 (diff)
downloadabc8000-old-fc130526edf711a5126bd3268674605792a5dd8b.zip
abc8000-old-fc130526edf711a5126bd3268674605792a5dd8b.tar.gz
abc8000-old-fc130526edf711a5126bd3268674605792a5dd8b.tar.bz2
abc8000-old-fc130526edf711a5126bd3268674605792a5dd8b.tar.xz
genrel.pl: always sort relocationsHEADmaster
Output the relocations in strict numeric order, for sanity and consistency.
-rwxr-xr-xdata/sysrom/genrel.pl11
1 files changed, 5 insertions, 6 deletions
diff --git a/data/sysrom/genrel.pl b/data/sysrom/genrel.pl
index 1843ead..91fa63a 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,7 +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;