patch-2.1.101 linux/arch/arm/lib/extractinfo.perl
Next file: linux/arch/arm/lib/getconsdata.c
Previous file: linux/arch/arm/lib/extractconstants.pl
Back to the patch index
Back to the overall index
- Lines: 46
- Date:
Fri May 8 00:42:38 1998
- Orig file:
v2.1.100/linux/arch/arm/lib/extractinfo.perl
- Orig date:
Wed Dec 31 16:00:00 1969
diff -u --recursive --new-file v2.1.100/linux/arch/arm/lib/extractinfo.perl linux/arch/arm/lib/extractinfo.perl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+$OBJDUMP=$ARGV[0];
+
+sub swapdata {
+ local ($num) = @_;
+
+ return substr($num, 6, 2).substr($num, 4, 2).substr ($num, 2, 2).substr ($num, 0, 2);
+}
+
+open (DATA, $OBJDUMP.' --full-contents --section=.data getconsdata.o | grep \'^ 00\' |') ||
+ die ('Cant objdump!');
+while (<DATA>) {
+ ($addr, $data0, $data1, $data2, $data3) = split (' ');
+ $dat[hex($addr)] = hex(&swapdata($data0));
+ $dat[hex($addr)+4] = hex(&swapdata($data1));
+ $dat[hex($addr)+8] = hex(&swapdata($data2));
+ $dat[hex($addr)+12] = hex(&swapdata($data3));
+}
+close (DATA);
+
+open (DATA, $OBJDUMP.' --syms getconsdata.o |') || die ('Cant objdump!');
+while (<DATA>) {
+ /elf32/ && ( $elf = 1 );
+ /a.out/ && ( $aout = 1 );
+ next if ($aout && ! / 07 /);
+ next if ($elf && ! (/^00...... g/ && /.data/));
+ next if (!$aout && !$elf);
+
+ ($addr, $flags, $sect, $a1, $a2, $a3, $name) = split (' ') if $aout;
+ $nam[hex($addr)] = substr($name, 1) if $aout;
+ if ($elf) {
+ chomp;
+ $addr = substr ($_, 0, 8);
+ $name = substr ($_, 32);
+ $nam[hex($addr)] = $name;
+ }
+}
+close (DATA);
+
+print "/*\n * *** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! ***\n */\n";
+for ($i = 0; $i < hex($addr)+12; $i ++) {
+ print "unsigned long $nam[$i] = $dat[$i];\n" if $dat[$i];
+ print "#define __HAS_$nam[$i]\n" if $dat[$i];
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov