scripts/decodecode: set ARCH when running natively on arm/arm64
authorMarc Zyngier <[email protected]>
Fri, 28 Dec 2018 08:31:21 +0000 (00:31 -0800)
committerLinus Torvalds <[email protected]>
Fri, 28 Dec 2018 20:11:44 +0000 (12:11 -0800)
When running decodecode natively on arm64, ARCH is likely not to be set,
and we end-up with .4byte instead of .inst when generating the
disassembly.

Similar effects would occur if running natively on a 32bit ARM platform,
although that's even less popular.

A simple workaround is to populate ARCH when it is not set and that we're
running on an arm/arm64 system.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Marc Zyngier <[email protected]>
Acked-by: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
scripts/decodecode

index 9cef558528aac890dfc2d2545aa9eb2fd8be3934..ba8b8d5834e67922e0028dbec04b9e7cebc2766d 100755 (executable)
@@ -60,6 +60,13 @@ case $width in
 4) type=4byte ;;
 esac
 
+if [ -z "$ARCH" ]; then
+    case `uname -m` in
+       aarch64*) ARCH=arm64 ;;
+       arm*) ARCH=arm ;;
+    esac
+fi
+
 disas() {
        ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1