mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm] scripts/decodecode: add AFLAGS
@ 2007-06-29 17:21 Randy Dunlap
  0 siblings, 0 replies; only message in thread
From: Randy Dunlap @ 2007-06-29 17:21 UTC (permalink / raw)
  To: lkml; +Cc: akpm

From: Randy Dunlap <randy.dunlap@oracle.com>

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@oracle.com>
---
 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-29 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-29 17:21 [PATCH -mm] scripts/decodecode: add AFLAGS Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®