Skip to contentSkip to conversation

openrisc: pass endianness info to sparse

PATCH Stafford Horne 1 participant 1 message Nov 1, 2017 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAMHZB6E+_EvR_C_JC5G7FZ1qUTJq-c3Y+jk7JLJ6wekzzgauFw@mail.gmail.com

#3 lore raw

+CC List

Quoted 11 lines · Luc Van Oostenryck
Quoted 10 lines · Stafford Horne
Quoted 8 lines · Luc Van Oostenryck

openrisc is big-endian only but sparse assumes the same endianness as the building machine.
This is problematic for code which expect __BYTE_ORDER__ being correctly predefined by the compiler which sparse can then pre-process differently from what gcc would, depending on the building machine endianness.

Fix this by letting sparse know about the architecture endianness.

Quoted 7 lines
Quoted 3 lines

Thank You,

I have applied this. I haven't really used sparse before, but it looks great.

Just use 'make C=1' or 'make C=2' when compiling the kernel. For endianness problems, sparse is invaluable as it does things no others tools can.

Right, I tried it out and it works well. Now I have a new tool to add to my workflow, and it looks like a few bugs to fix as well.

Quoted 9 lines
Quoted 2 lines

Do you think openrisc needs to set other arguments like __BIG_ENDIAN__ as other architectures do?

If you use a recent version of sparse (the version 0.5.1 released in August), which I strongly advise, you don't need to as sparse then understand -mbig-endian
and then define __BIG_ENDIAN__ internally, like GCC do.
But with older version of sparse, yes, it would also be needed as well as __BYTE_ORDER__.

I do have 0.5.1 so I should be good.

-Stafford