From: David Matlack Subject: [kvm-unit-tests PATCH 18/32] lib: provide stdio.h Date: Thu, 20 Apr 2017 17:49:50 -0700 Message-ID: <20170421005004.137260-19-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Cc: Peter Feiner , David Matlack To: kvm@vger.kernel.org Return-path: Received: from mail-oi0-f46.google.com ([209.85.218.46]:33629 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033869AbdDUAu0 (ORCPT ); Thu, 20 Apr 2017 20:50:26 -0400 Received: by mail-oi0-f46.google.com with SMTP id y11so41516519oie.0 for ; Thu, 20 Apr 2017 17:50:26 -0700 (PDT) In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Peter Feiner 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. Signed-off-by: Peter Feiner Signed-off-by: David Matlack --- 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