On Tue, Mar 01, 2016 at 12:04:01PM +0100, Paolo Bonzini wrote: > > > On 01/03/2016 10:15, Andrew Jones wrote: > >> > So libcflat uses the header stdint.h from the standard gcc installation > >> > to get the uint64_t and friends, but you define the PRIx64 etc. here > >> > manually? That sounds strange... You could simply include "inttypes.h" > >> > instead of "stdint.h" in this libcflat.h header file, then you would get > >> > PRIx64 and friends automatically instead. > > We can only include headers that are provided by libgcc in arch-neutral > > files like libcflat, in order for cross-compiling to work. inttypes.h > > isn't available. > > Yup, inttypes.h is not part of the freestanding environment. > > > > OTOH, for a stand-alone binary like kvm-unit-tests, it's also somewhat > > > risky to compile without "-nostdinc" since unwanted headers might be > > > included that way (e.g. what happens if someone writes "#include > > > <stdio.h>" by accident? You likely get some nice confusion...). So maybe > > > it would be better to compile with "-nostdinc" instead and define all > > > necessary things manually here? > > > > We don't have -nostdinc because sometimes the x86 tests cheat and use > > standard includes. arm and powerpc Makefiles could/should add it though, > > as they don't currently cheat, and it's probably best if they never do. > > Some of the includes are part of the freestanding environment: float.h, > iso646.h, limits.h, stdarg.h, stdbool.h, stddef.h, stdint.h and probably > a few more in C11 (e.g. stdalign.h, stdatomic.h, stdnoreturn.h). Using > them is not cheating. Ah, OK. Actually, I just did a quick experiment. I added '-isysroot /foo' to CFLAGS, in order to allow libgcc headers, but not anything in /usr/include. Almost everything compiled, but Bug report: x86/setjmp.c currently includes stdio.h Thanks, drew -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html