Re: [kvm-unit-tests PATCH 18/32] lib: provide stdio.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 20, 2017 at 05:49:50PM -0700, David Matlack wrote:
> From: Peter Feiner <pfeiner@xxxxxxxxxx>
> 
> kvm-unit-tests builds with the odd combination of system include files
> but not system libraries. That is, -nostdlib is specified but
> -nostdinc isn't! Problems arise when the include files don't match the
> libraries, e.g., printf() in some versions of glibc linking in a
> __printf_chk symbol that libcflat doesn't have. This patch fixes the
> problem with printf by pointing '#include "stdio.h"' to
> lib/libcflat.h, where a printf declaration that libcflat actually
> implements exists, rather than letting /usr/include/stdio.h get
> included. This patch does not solve the general problem of potential
> mismatches between libcflat and the compiler's notion standard include
> files; doing so would require rewriting stdarg.h, stdint.h, and
> several others in libcflat.

Yeah, I'm not sure rewriting those would be worth being able to add
-nostdinc. When we cross compile ARM and POWER those few headers are
some of the ones provided by the cross compiler.

> 
> Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
> Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
> ---
>  lib/stdio.h | 4 ++++
>  1 file changed, 4 insertions(+)
>  create mode 100644 lib/stdio.h
> 
> diff --git a/lib/stdio.h b/lib/stdio.h
> new file mode 100644
> index 000000000000..7b30db93f7f1
> --- /dev/null
> +++ b/lib/stdio.h
> @@ -0,0 +1,4 @@
> +#ifndef LIBCFLAT_STDIO_H
> +#define LIBCFLAT_STDIO_H
> +#include "libcflat.h"
> +#endif
> -- 
> 2.12.2.816.g2cccc81164-goog
>

I'd rather we move the stdio functions (just printf?) into stdio.h rather
than redirect to libcflat. We can include stdio.h from libcflat.h to
avoid updating all the unit tests for now though.

Thanks,
drew



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux