[PATCH v3 2/2] rseq/selftests: Add support for RISC-V

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Mar 3 13:50:38 PST 2022


----- On Mar 3, 2022, at 2:16 AM, Vincent Chen vincent.chen at sifive.com wrote:

> On Thu, Mar 3, 2022 at 12:38 AM Mathieu Desnoyers
> <mathieu.desnoyers at efficios.com> wrote:
>>
[...]

>> > +#if __ORDER_LITTLE_ENDIAN__ == 1234
>>
>> I think we'll want to standardize on this for endianness checking (same as
>> the updated uapi rseq.h):
>>
>> #if defined(__BYTE_ORDER) ? (__BYTE_ORDER == __LITTLE_ENDIAN) :
>> defined(__LITTLE_ENDIAN)
>>
>> We may have to change rseq-mips.h in the rseq selftests to do the same as well
>> rather than
>> using "# ifdef __BIG_ENDIAN".
>>
> 
> OK, I can follow it. However, I found the endianness checking in
> include/uapi/linux/rseq.h is
> #if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) ||
> defined(__BIG_ENDIAN)
> 
> It is a little different than what you mentioned early. Should I
> follow the format in include/uapi/linux/rseq.h? or both formats are
> OK?
> 

The form "#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN)
is completely buggy. Don't use that.

I've sent the fix to Peter to remove the offending #if here:

https://lore.kernel.org/lkml/1445357149.71067.1643137248305.JavaMail.zimbra@efficios.com/T/#mbbad3961494feefb98cb6d092879e3ea41b33df8

Please use the correct non-bogus form instead:

#if defined(__BYTE_ORDER) ? (__BYTE_ORDER == __LITTLE_ENDIAN) : defined(__LITTLE_ENDIAN)

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the linux-riscv mailing list