I've noticed the following failure in XenServer's build environment > make[6]: Leaving directory > '/builddir/build/BUILD/xen-4.19.1/tools/tests/x86_emulator' > In file included from /usr/include/features.h:535, > from /usr/include/bits/libc-header-start.h:33, > from /usr/include/stdint.h:26, > from > /usr/lib/gcc/x86_64-xenserver-linux/12/include/stdint.h:9, > from blowfish.c:18: > /usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such > file or directory > 7 | # include <gnu/stubs-32.h> > | ^~~~~~~~~~~~~~~~ > compilation terminated. > make[6]: *** [testcase.mk:15: blowfish.bin] Error 1
It's non-fatal, but it reduces the content in test_x86_emulator which we do care about running. Elsewhere in the tree we fix this with -ffreestanding -nostdinc -I$(XEN_ROOT)/tools/firmware/include but that isn't an option for test_x86_emulator in general which is hosted. However, it is an option for blowfish.c specifically which is freestanding, and for which we build a 32bit form in an otherwise 64bit build. Therefore, it stands to reason that: diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile index 294d27ebaa08..e46fd8becb96 100644 --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -33,8 +33,8 @@ HOSTCFLAGS += -m32 -I.. else -blowfish-cflags := "" -blowfish-cflags-x86_32 := "-mno-accumulate-outgoing-args -Dstatic=" +blowfish-cflags := "-ffreestanding -nostdinc -I$(XEN_ROOT)/tools/firmware/include " +blowfish-cflags-x86_32 := "$(blowfish-cflags) -mno-accumulate-outgoing-args -Dstatic=" 3dnow-vecs := 8 3dnow-ints := should do what we want, except it doesn't. Somehow this is getting injected the intermediate blowfish.h: > blowfish.h:617:99: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or > ‘__attribute__’ before ‘/’ token > 617 | static const unsigned int __attribute__((section(".test, > \"ax\", @progbits #"))) > blowfish_x86_32_I/local/xen.spec/scm/tools/tests/x86_emulator/../../../tools/firmware/include[] > = { > > | > > ^ and at this point I've got completely lost in this build system. The .h generation seems to loop over each cflag, and while that looks plausible for vector generation, I can't see how it works (except by accident) for blowfish. The problem is the generation of $flavor, but this logic is completely opaque. ~Andrew