On Wed, 14 Oct 2015 10:43:07 +0200 Gwenhael Goavec-Merou gwenj@trabucayre.com wrote:
From: Gwenhael Goavec-Merou gwenhael.goavec-merou@trabucayre.com
According to : http://autobuild.buildroot.net/results/3de/3de936d9be79e151e66af15193084d82a...
linux/ioctl.h header must be included in linux_spi.c to obtain missing _IOC_SIZEBITS.
Patch based on : http://git.buildroot.net/buildroot/commit/package/c-periphery/0001-Add-missi...
This is actually a bug in the linux headers that apparently is hidden by the glibc headers because they include the right headers "by accident":
glibc headers corresponding to Linux 3.2.0: # 23 "sys/ioctl.h" 2 # 24 "/usr/include/x86_64-linux-gnu/bits/ioctls.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/asm/ioctls.h" 1 3 4 # 1 "/usr/include/asm-generic/ioctls.h" 1 3 4 # 1 "/usr/include/linux/ioctl.h" 1 3 4 # 1 "/usr/include/x86_64-linux-gnu/asm/ioctl.h" 1 3 4 # 1 "/usr/include/asm-generic/ioctl.h" 1 3 4
_IOC_SIZEBITS
(found out with the help of gcc -E -dD and some grep foo)
With musl's 1.0.5 (stable) headers sys/ioctl.h does not include any OS-specific headers (I think) and thus no _IOC_SIZEBITS. That makes it fail to compile flashrom's linux_spi.c as indicated in the log.
Why is that a bug in the kernel headers? Because linux/spi/spidev.h defines a macro named SPI_MSGSIZE (that flashrom uses) that relies on another macro (_IOC_SIZEBITS)from asm-generic/ioctl.h that should be (indirectly) brought in by spidev.h.
Does it matter? No, we have to support it anyway hence I will include the proposed change (if no regression crops up). Still, I would like this to be reported "upstream". Could you please do that Gwenhael?