From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 18/32] lib: provide stdio.h Date: Fri, 21 Apr 2017 10:24:49 +0200 Message-ID: <12c9fa0a-0608-3588-bfa6-9037428c1675@redhat.com> References: <20170421005004.137260-1-dmatlack@google.com> <20170421005004.137260-19-dmatlack@google.com> <20170421071604.ivg5jcgscbz2jdwe@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Peter Feiner To: Andrew Jones , David Matlack Return-path: Received: from mail-wr0-f175.google.com ([209.85.128.175]:36026 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1036594AbdDUIYy (ORCPT ); Fri, 21 Apr 2017 04:24:54 -0400 Received: by mail-wr0-f175.google.com with SMTP id c55so49991399wrc.3 for ; Fri, 21 Apr 2017 01:24:53 -0700 (PDT) In-Reply-To: <20170421071604.ivg5jcgscbz2jdwe@kamzik.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 21/04/2017 09:16, Andrew Jones wrote: >> >> 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. I think -sysroot=`pwd` would keep the usual compiler include path, and remove /usr/include. Paolo