From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C572C433ED for ; Tue, 4 May 2021 20:17:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCFCF613CF for ; Tue, 4 May 2021 20:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231234AbhEDUSo (ORCPT ); Tue, 4 May 2021 16:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbhEDUSn (ORCPT ); Tue, 4 May 2021 16:18:43 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916D0C061574; Tue, 4 May 2021 13:17:48 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1le1U4-004AHK-M9; Tue, 04 May 2021 22:17:32 +0200 Message-ID: <70868660127bd13dcc47e94108483ff15827378c.camel@sipsolutions.net> Subject: Re: [PATCH 2/2] kconfig: unify cc-option and as-option From: Johannes Berg To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nick Desaulniers , Arvind Sankar , Andrew Morton , Brendan Higgins , Catalin Marinas , Changbin Du , Krzysztof Kozlowski , Mauro Carvalho Chehab , Randy Dunlap , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 04 May 2021 22:17:30 +0200 In-Reply-To: <20200614144341.1077495-2-masahiroy@kernel.org> References: <20200614144341.1077495-1-masahiroy@kernel.org> <20200614144341.1077495-2-masahiroy@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Hi, So... I realized it's been a while: On Sun, 2020-06-14 at 23:43 +0900, Masahiro Yamada wrote: > cc-option and as-option are almost the same; both pass the flag to > $(CC). The main difference is the cc-option stops before the assemble > stage (-S option) whereas as-option stops after it (-c option). > But, I had noticed for a while now that M= build for an out-of-tree driver were causing some trouble. Not really completely "out-of-tree" but rather backported (https://backports.wiki.kernel.org/). And then I finally narrowed it down to this commit, specifically this: >  # Return y if the compiler supports , n otherwise > -cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null) > +cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o) What happens is that we're doing make -C /path/to/kernel M=/path/to/driver But /path/to/kernel may be the installed distro kernel headers, and thus not be writable to the user doing the driver compile. Obviously, the user may need to 'sudo' anyway to install the result, but if just test- compiling, or even as better practice to not run everything as root, this ".tmp_$$" dir cannot be created. IOW, this broke compiler option detection when KBUILD_EXTMOD=/M= is used. It seems this is still supported (documented in kbuild docs), so I'm kind of hoping it could be fixed? But OTOH, I really don't know how, perhaps just using "mktemp -d" here instead of the hardcoded temp dir? Thanks, johannes