[Ltrace-devel] [PATCH v2] Fix SIGSEGV on MIPS big endian

Oliver Spornitz ospornit at rz-online.de
Mon Feb 4 14:29:33 UTC 2013


---
 sysdeps/linux-gnu/mipsel/arch.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sysdeps/linux-gnu/mipsel/arch.h b/sysdeps/linux-gnu/mipsel/arch.h
index ba1220d..14572cd 100644
--- a/sysdeps/linux-gnu/mipsel/arch.h
+++ b/sysdeps/linux-gnu/mipsel/arch.h
@@ -25,10 +25,18 @@
 #include <stddef.h>
 #include <gelf.h>
 
-#define BREAKPOINT_VALUE { 0x0d, 0x00, 0x00, 0x00 }
+#ifdef __MIPSEL__
+# define BREAKPOINT_VALUE { 0x0d, 0x00, 0x00, 0x00 }
+# define ARCH_ENDIAN_LITTLE
+#elif defined(__MIPSEB__)
+# define BREAKPOINT_VALUE { 0x00, 0x00, 0x00, 0x0d }
+# define ARCH_ENDIAN_BIG
+#else
+# error __MIPSEL__ or __MIPSEB__ must be defined
+#endif
+
 #define BREAKPOINT_LENGTH 4
 #define DECR_PC_AFTER_BREAK 0
-#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_MIPS
-- 
1.8.0





More information about the Ltrace-devel mailing list