From d9a8b23a35f4a286e8ce1bf7c5ce0e892d1cf5b7 Mon Sep 17 00:00:00 2001 From: Vicente Olivert Riera Date: Tue, 25 Nov 2014 01:32:06 -0800 Subject: [PATCH] mips: support MIPS64 n32 mode The attached patch fixes a problem with Xorg on MIPS64 n32 which is explained here: https://bugs.freedesktop.org/show_bug.cgi?id=79939 Basically, libunwind is using a word size of 64-bit for all MIPS variants. Then, Xorg does a casting to (void *) of a 64-bit variable provided by libunwind. Given that the size of the pointers in MIPS64 n32 is 32-bit wide, that casting causes an error like this one: backtrace.c:90:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] --- include/libunwind-mips.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/libunwind-mips.h b/include/libunwind-mips.h index d9bf67dc..97c95e24 100644 --- a/include/libunwind-mips.h +++ b/include/libunwind-mips.h @@ -50,11 +50,14 @@ extern "C" { /* FIXME for MIPS. Too big? What do other things use for similar tasks? */ #define UNW_TDEP_CURSOR_LEN 4096 -/* The size of a "word" varies on MIPS. This type is used for memory - addresses and register values. To allow a single library to support - multiple ABIs, and to support N32 at all, we must use a 64-bit type - even when addresses are only 32 bits. */ +/* The size of a "word" varies on MIPS. This type is used for memory + addresses and register values, which are 32-bit wide for O32 and N32 + ABIs, and 64-bit wide for N64 ABI. */ +#if _MIPS_SIM == _ABI64 typedef uint64_t unw_word_t; +#else +typedef uint32_t unw_word_t; +#endif typedef int32_t unw_sword_t; /* FIXME: MIPS ABIs. */