RE: [RFC PATCH v2 2/2] objtool: fix x86 orc generation on big endian cross compiles

From: David Laight
Date: Wed Sep 30 2020 - 09:06:34 EST


From: Vasily Gorbik
> Sent: 30 September 2020 13:24
>
> Correct objtool orc generation endianness problems to enable fully
> functional x86 cross compiles on big endian hardware.
>
...
> +
> +#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
> +
> struct orc_entry {
> s16 sp_offset;
> s16 bp_offset;
> @@ -57,6 +67,20 @@ struct orc_entry {
> unsigned end:1;
> } __packed;
>
> +#else
> +
> +struct orc_entry {
> + s16 sp_offset;
> + s16 bp_offset;
> + unsigned bp_reg:4;
> + unsigned sp_reg:4;
> + unsigned unused:5;
> + unsigned end:1;
> + unsigned type:2;
> +} __packed;
> +
> +#endif

Shouldn't that be checking BITFIELD_ENDIAN.

I also think that (in the other patch) you can assume
that you don't need to byteswap if __KERNEL__ is defined.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)