summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;