Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1196196imm; Fri, 8 Jun 2018 11:38:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI+4/pKAsxAXbAAO3V/ZQNZQitqud23SIOzSoVOHZ3A6Tm3P7673bZ62HcZUTJnX1T4z/zf X-Received: by 2002:a63:770f:: with SMTP id s15-v6mr6385676pgc.30.1528483116001; Fri, 08 Jun 2018 11:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528483115; cv=none; d=google.com; s=arc-20160816; b=ZvrZRZLFdaKvLmTLXSIKbP1jbqfWPJSzSjYHnCKQi2BuxJUcO4XWkNWG1i6NIHj3PI OmpS8vq4iU084/iiYFpg8zx1h4OKU90pSm+pg8smnzlQFbNQxkinUw2PHt4Kignj25/K ETV9IWca1qj7ZS5rxOeewgQnb3WiZzepxD5kNnCBDI8ujN6zrokbuNZp/FSVeuKsMGMA pTTK2hZjIlZC2SfX9cfln5d50el4EWcsTiuAbMvmW2tByrZzLIOT/sz81q7Oyghi4ddU EtrpQAtfjgYv1U1seuYEX/HTkgwUyY7F4HqDQRRAik8PU+qcpbcJVMcuAo7z5475p9zt QgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Dr4lhiBmjjffIm8LJAJh7TUgIqFJ/g+ZOjphROYkJ64=; b=BO/vBIlt/Bn4fjpNGQe19S+7zpSlf7ANKsuEkq6xsmHcm0+EmnFa1aqb23WewSHc2t rZ7/TBrnUb4JxiXiG7O8wgIATr8RQF+MCTTQ1ALkRfBi03l+8NQWUqcYZIh3vfR4POO/ VhC3C68gXT7YBe6eN9h2t3KfebR4fg0nYgzuhhQnz/RaeSSb28nw5EftQW97fwbi1LVa d/A9xxby3yDhlX3q/00Eo+i/NBa9pA7rnRs5n9JkedAQ4w1SfcvLLKVUu8GfvfB9PIxs ryHG0kJyk9XiqdZGfJWX3EzNmBPbOLx6sCT6tlMMjYrvXceVkyrTgetcMAE+4krWXBo5 ThXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HWkBfi5M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10-v6si625131pla.98.2018.06.08.11.38.21; Fri, 08 Jun 2018 11:38:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HWkBfi5M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753002AbeFHSg0 (ORCPT + 99 others); Fri, 8 Jun 2018 14:36:26 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:45448 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752697AbeFHSgZ (ORCPT ); Fri, 8 Jun 2018 14:36:25 -0400 Received: by mail-pf0-f196.google.com with SMTP id a22-v6so7044426pfo.12 for ; Fri, 08 Jun 2018 11:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Dr4lhiBmjjffIm8LJAJh7TUgIqFJ/g+ZOjphROYkJ64=; b=HWkBfi5MI3xaAuh3iMJbQ0O8wGt/ZHYhJ4a9We5eOi1WU1e+GU6mwhbSjY3DcH73qt /ttmgN81O6jjN4xn0RZmO7yW5kk07PzlM/W0cGhlaQgLeYbLXqHd6Fs/1VLHEaz5UtK8 jAhfePFmycxvumbMc0wTnCIcDYWSQROqjqQ76ygUKFoZMDqmAO0TOcqNZqiiBulo0zbC jAs81Cccz/HfGOwH+QQZc245UWJ/HIvAs3IBW5fprsS3bLzdNoB9Incm4QzoF77DvhNM fFjkyW8cqgwWgmzqeJm/ww+z46/dOMYQqhyFm4tlMN1r8LbJ145Zlnb2F1feIohI4eSo gSlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Dr4lhiBmjjffIm8LJAJh7TUgIqFJ/g+ZOjphROYkJ64=; b=JG0MLXCjE3eMVC2XqkJ99ioDWIJNTJO+Swo8HxgrCL1eynaO4H3KZo2ALFV5bw3Fq+ gkoT8Nj/wypYOgVKQBP3n0/t2rs2vtbeAqmCK0Ulqz6DWtmHj8W5pUBG/jLlaJDHv3Dk LBjxoBnmQe/KtGLNGBGS4we1Lab3oDtd56V7GwBuz0Bz3rpMJw6k6Zq/l0M1gUYWPybI QJjnBzttCsJhGL8WG10Puz3VycwrhlWTINdGUQ/wTbkZgPI4hiWlz6LUvXhjdwMdkHNs KsHYfoOo76sBSgxATRhmAXNZq42mcxnqy+qMErvCxdzdR7/pNabUy7+420VRBkeg3M3J yCzQ== X-Gm-Message-State: APt69E22OZ9YX7NwW1dm3svyfmo4D9SvPmCCeE4WqysvmwcGh0d49rnJ yQD2kPtLSHS4sj3cZ8HTBT+McRpfBfI= X-Received: by 2002:a62:1013:: with SMTP id y19-v6mr7119126pfi.166.1528482984616; Fri, 08 Jun 2018 11:36:24 -0700 (PDT) Received: from jchowdhary0.mtv.corp.google.com ([2620:0:1000:1612:de71:f59c:9968:92ba]) by smtp.gmail.com with ESMTPSA id o65-v6sm5884219pga.75.2018.06.08.11.36.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jun 2018 11:36:23 -0700 (PDT) Subject: Re: [PATCH] uapi: Make generic uapi headers compile standalone. To: Randy Dunlap , linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, kernel-team@android.com, linux-kbuild@vger.kernel.org References: <20180606231602.231326-1-jchowdhary@google.com> From: Jayant Chowdhary Message-ID: Date: Fri, 8 Jun 2018 11:36:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Randy, On 06/07/2018 05:07 PM, Randy Dunlap wrote: > On 06/06/2018 04:16 PM, Jayant Chowdhary wrote: >> In order for static analysis tools to analyze each of the uapi headers, >> we need to enable them to compile stand-alone. Some uapi headers were >> missing dependencies which would not make them compile stand-alone in >> user-land. This patch adds those dependencies. > > Hi, > > Thanks for getting started on this. I see that the kbuild robot and I were > still not able to do successful builds even after this patch is applied. > We were building different targets though. robot was doing kernel builds > and I was doing a large "all-uapi" build. > > I started on my all-uapi work about 1 week ago but haven't posted anything yet, > but it's posted (attached) below. It's not yet up to kernel quality yet (for a > Makefile), and I have made very little progress toward a successful userspace build. > > If anyone is interested, just put these 3 files in /tools/build > and then run: > > make ARCH=$some_arch O=build_dir headers_check > so that the headers will be cleaned up and installed in build_dir/usr/. > > Then run 'make -f all-uapi.mk' > and the userspace program with all header files found in build_dir/usr/include > will be built -- i.e., attempted (not successfully). > > (note: chmod +x hdr-fix-lines.pl) > > Thank you for this. This is surely a more formal way of finding out and verifying problems w.r.t the uapi headers, being compiled from user-land. I do have one concern with this approach though: the make target 'all-uapi.o' depends on all-uapi.h, which includes all the uapi headers installed in . So this does make sure that when all the uapi headers are included, a user-land program will be able to compile fine, without adding any additional dependencies. However, this could be masking some cases of dependency exclusion. An example can be seen as follows: Header dependency chain: A.h->B.h, however A.h doesn't actually include B.h C.h->B.h, C.h does include B.h all-uapi.h #include #include all-uapi.h will compile fine, since the inclusion of C.h before A.h satisfies A.h's dependency on B.h. However, if a user-land program includes just A.h, it will not compile without adding B.h. So the target being built successfully masked an issue with the uapi header, no? I guess it might be better to just have a Makefile which produces a target for each header in the set produced by 'make headers_install' and compile those, with a -I flag as /usr/include ? Also, do you think it might be better to do this work in phases ? I'm guessing we'll be seeing many headers to fix (especially arch specific ones). Fixing these separately: first the generic ones, followed by the ones for the arches, might be easier ? Thanks, Jayant