On Thu, Jul 27, 2023 at 04:50:10PM +0100, Will Deacon wrote:
Looking more closely at this, I see that the bpf and kvm selftests are able to include <linux/compiler.h> directly, so I don't see why we need to open-code this here. I also spotted that we've *already* written our own version of this as the 'curse()' macro in selftests/arm64/bti/compiler.h!
So I think we should either use linux/compiler.h or make our curse macro usable to all the arm64 selftests.
Ah, actually it's not including the linux/compiler.h you might be thinking of - it's including an entirely unrelated linux/compiler.h which can be found in tools/include and contains a much smaller set of things. We can port the macro over and try to do the dance to pull in the tools/include headers, hopefully that's not too fragile with the various combinations of build options and the additional complexity of the arm64 tests having an additional layer of directories.
I'd be happier doing this as a fix and then touching the build system in -next (I've got the build system changes now). It should be fine but the build system has changed over time and is prone to fragility - I can see people wanting to pull the fix back to whatever kernel distros are using and running into trouble with a more invasive change.
I was going to mention that kselftest had to define it's own ARRAY_SIZE()...