[Ltrace-devel] [PATCH] Fix libunwind support for MIPS

Faraz Shahbazker faraz.shahbazker at imgtec.com
Thu Oct 22 23:39:38 UTC 2015


On 10/22/2015 02:43 AM, Vicente Olivert Riera wrote:
> ping
> 
> On 10/08/2015 04:59 PM, Vicente Olivert Riera wrote:
>> /* Verify that we can safely cast arch_addr_t* to unw_word_t*. */
>> (void)sizeof(char[1 - 2*(sizeof(unw_word_t) != sizeof(arch_addr_t))]);
>>
>> This check will always fail for MIPS 32-bit architectures (the only ones
>> supported by ltrace) because unw_word_t is 64-bit sized (it's actually a
>> uint64_t) and arch_add_t (which is void*) is 32-bit sized:

As I understand, that check was deliberately designed to fail at compile time, 
where as your proposal defers it to run time. So one must ask under what
conditions would the deferral and the related run-time overhead be justified?

If MIPS 32-bit requires a cast-and-compare approach, then we would be better
off restricting the change to MIPS 32-bit. You have to  assume that the check 
is not relevant for mips32 and introduce an arch-specific UNW_2_ADDR_T macro
which is just a cast in general, but calls the conversion+verification
function for mips32. Alternatively (if the consensus here allows it),
you could just assume that the check is not valid for mips32 but do it in a 
way that doesn't affect any other architecture.

Regards,
Faraz Shahbazker



More information about the Ltrace-devel mailing list