[PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic

Ben Dooks ben.dooks at codethink.co.uk
Wed Aug 14 12:42:41 EDT 2013

Currently BUG() uses .word or .hword to create the necessary illegal
instructions. However if we are building BE8 then these get swapped
by the linker into different illegal instructions in the text.

Change to using .inst and .inst.w to create the instructions and mark
them as instructions so that the linker acts correctly.

Fixes issue reported by Dave Martin <Dave.Martin at arm.com>

Signed-off-by: Ben Dooks <ben.dooks at codethink.co.uk>
 arch/arm/include/asm/bug.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 7af5c6c..b95da52 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -12,10 +12,10 @@
 #define BUG_INSTR_VALUE 0xde02
-#define BUG_INSTR_TYPE ".hword "
+#define BUG_INSTR_TYPE ".inst.w "
 #define BUG_INSTR_VALUE 0xe7f001f2
-#define BUG_INSTR_TYPE ".word "
+#define BUG_INSTR_TYPE ".inst "

More information about the linux-arm-kernel mailing list