[PATCH -mm] scripts/decodecode: add AFLAGS

From: Randy Dunlap
Date: Fri Jun 29 2007 - 13:21:04 EST


From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Add AFLAGS=options environment variable for the 'as' command.
This enables us to generate code for something other than the host
system architecture. E.g., on an x86_64 system:

AFLAGS=--32 scripts/decodecode < i386.oops
generates code for i386 (and then objdump uses the object file's
arch. to disassemble it).

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
scripts/decodecode | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

--- linux-2622-rc6mm1.orig/scripts/decodecode
+++ linux-2622-rc6mm1/scripts/decodecode
@@ -1,6 +1,10 @@
#!/bin/sh
# Disassemble the Code: line in Linux oopses
# usage: decodecode < oops.file
+#
+# options: set env. variable AFLAGS=options to pass options to "as";
+# e.g., to decode an i386 oops on an x86_64 system, use:
+# AFLAGS=--32 decodecode < 386.oops

T=`mktemp`
code=
@@ -31,7 +35,7 @@ if [ $marker -ne 0 ]; then
beforemark=`echo "$code" | cut -c-$((${marker} - 1))`
echo -n " .byte 0x" > $T.s
echo $beforemark | sed -e 's/ /,0x/g' >> $T.s
- as -o $T.o $T.s
+ as $AFLAGS -o $T.o $T.s
objdump -S $T.o
rm $T.o $T.s

@@ -42,6 +46,6 @@ fi
code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'`
echo -n " .byte 0x" > $T.s
echo $code >> $T.s
-as -o $T.o $T.s
+as $AFLAGS -o $T.o $T.s
objdump -S $T.o
rm $T.o $T.s
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/