Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4619076pxv; Tue, 27 Jul 2021 11:49:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysA/0rYZIyePqktILvWNacEtDGnxccH6EPmWl8yRnfNdPE97gr0Kodlk20UBmyB1ud+7S8 X-Received: by 2002:a05:6402:28b0:: with SMTP id eg48mr12398921edb.241.1627411779149; Tue, 27 Jul 2021 11:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627411779; cv=none; d=google.com; s=arc-20160816; b=VV4SijSLOkgYK6ok9OqZE6yLJKUaGbisKFBp16XMps7eXm1Paki3TbIaQ0Had4aCH0 AXVW2h3oyyjD6kRxfksMEvGFKUxbiotW3NVnuU4XBgUsWPb7YLkIyKyRQHDW96/horSL vHKWYFE7cDsE/W1pi9ayM06VIwxjs2z+y84RAgGSVk8i4ryFpL+374dZeaeXzc06xwoN YSbXUroOo3OhTKxvr8PrGYpIXS49kdRI3MKAt0uttxuQXJQ1pv5phEMSbxlcJ/8srjOX wxmKZ1e52OPFc4v/VEYxqNB3zDofUr1EnffA6V4oLMB9/+AsYnn0ek1NMX8h3I7HcSeO VC/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=vweB/+eLREyXVgB9lHptyRDjPRVX6aeBDK/rUuoIDQ0=; b=OfGL9wptKwK3pmxLVWEkmETQYGbVMMz8dRNgjIlLlaUieCt8U/ubzMH2bCCoHHoiIS V/XcktvGhjROaRROK5/Wk3bH7Hgh95tsEv7ddIOuMOBwdjiyxd7/hcvqYs+iS74WIrqK xJ6y8vXQ7PIIGVrJBCpc5/G1dbeDh86Gvp0oOHkq7mxQCS8QufgGnn/q4ojugnG+/GpJ Ge+/RD1NIxJRRwB7k2KwsjZnjfKSWiHeWKBoURKwwgmAW4X25HZMSbNw0bAufjFxRxla vGXTUPsH832RwY5LbjKVvso++7nOfRFByASuq7UZ1WPwU/EYgjT3Agu2V3B001ZXdSF4 VPlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si3244986ejp.627.2021.07.27.11.49.15; Tue, 27 Jul 2021 11:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbhG0Sqo (ORCPT + 99 others); Tue, 27 Jul 2021 14:46:44 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:33286 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbhG0Sqn (ORCPT ); Tue, 27 Jul 2021 14:46:43 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]:47884) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m8S6C-004DYb-2A; Tue, 27 Jul 2021 12:46:40 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:57748 helo=email.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m8S68-004Ncs-Ff; Tue, 27 Jul 2021 12:46:37 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Masahiro Yamada Cc: Arnd Bergmann , Linus Torvalds , Nick Desaulniers , Miguel Ojeda , Fangrui Song , Michal Marek , Linux Kernel Mailing List , Linux Kbuild mailing list , clang-built-linux , Geert Uytterhoeven , Christoph Hellwig , Nathan Chancellor References: <20210708232522.3118208-1-ndesaulniers@google.com> <20210708232522.3118208-3-ndesaulniers@google.com> <87r1fkizxl.fsf@disp2133> <87v94vg7vi.fsf@disp2133> Date: Tue, 27 Jul 2021 13:46:07 -0500 In-Reply-To: (Masahiro Yamada's message of "Wed, 28 Jul 2021 00:45:54 +0900") Message-ID: <87lf5rfvdc.fsf@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1m8S68-004Ncs-Ff;;;mid=<87lf5rfvdc.fsf@disp2133>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+3wQ5mLUbVDzV6nXI3HOEjKRRseKbKxYY= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02,XMSubLong autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4905] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Masahiro Yamada X-Spam-Relay-Country: X-Spam-Timing: total 747 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 11 (1.4%), b_tie_ro: 9 (1.3%), parse: 1.03 (0.1%), extract_message_metadata: 17 (2.3%), get_uri_detail_list: 3.3 (0.4%), tests_pri_-1000: 24 (3.2%), tests_pri_-950: 1.18 (0.2%), tests_pri_-900: 1.02 (0.1%), tests_pri_-90: 241 (32.2%), check_bayes: 239 (32.0%), b_tokenize: 12 (1.5%), b_tok_get_all: 11 (1.5%), b_comp_prob: 3.1 (0.4%), b_tok_touch_all: 210 (28.1%), b_finish: 0.90 (0.1%), tests_pri_0: 439 (58.8%), check_dkim_signature: 0.58 (0.1%), check_dkim_adsp: 2.5 (0.3%), poll_dns_idle: 0.70 (0.1%), tests_pri_10: 2.1 (0.3%), tests_pri_500: 7 (0.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2 2/2] Makefile: infer CROSS_COMPILE from SRCARCH for LLVM=1 LLVM_IAS=1 X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masahiro Yamada writes: > On Tue, Jul 27, 2021 at 11:16 PM Eric W. Biederman > wrote: >> >> Masahiro Yamada writes: >> >> > On Tue, Jul 27, 2021 at 5:27 AM Eric W. Biederman wrote: >> >> >> >> Masahiro Yamada writes: >> >> >> >> > On Wed, Jul 21, 2021 at 4:58 AM Arnd Bergmann wrote: >> >> >> >> >> >> On Tue, Jul 20, 2021 at 7:43 PM Linus Torvalds >> >> >> wrote: >> >> >> > On Tue, Jul 20, 2021 at 1:05 AM Masahiro Yamada wrote: >> >> >> > >> >> >> > We do most of the other heavy lifting in this area in Kconfig anyway, >> >> >> > why not add that compiler choice? >> >> >> > >> >> >> > Obviously it would be gated by the tests to see which compilers are >> >> >> > _installed_ (and that they are valid versions), so that it doesn't ask >> >> >> > stupid things ("do you want gcc or clang" when only one of them is >> >> >> > installed and/or viable). >> >> >> >> >> >> I don't see a good way of making Kconfig options both select the >> >> >> compiler and defining variables based on the compiler, since that >> >> >> would mean teaching Kconfig about re-evaluating all compiler >> >> >> dependent settings whenever the first option changes. >> >> >> >> >> >> I do have another idea that I think would work though. >> >> >> >> >> >> > Hmm? So then any "LLVM=1" thing would be about the "make config" >> >> >> > stage, not the actual build stage. >> >> >> > >> >> >> > (It has annoyed me for years that if you want to cross-compile, you >> >> >> > first have to do "make ARCH=xyz config" and then remember to do "make >> >> >> > ARCH=xyz" for the build too, but I cross-compile so seldom that I've >> >> >> > never really cared). >> >> >> >> >> >> The best thing that I have come up with is a pre-configure step, where >> >> >> an object tree gets seeded with a makefile fragment that gets included >> >> >> for any 'make' invocation. This would set 'ARCH=', 'CROSS_COMPILE', >> >> >> 'CC=' and possibly any other option that gets passed to 'make' as >> >> >> a variable and has to exist before calling 'make *config'. >> >> > >> >> > >> >> > There is no need to add a hook to include such makefile fragment(s). >> >> > >> >> > Quite opposite, you can put your Makefile (in a different filename) >> >> > that includes the top Makefile. >> >> > >> >> > >> >> > I think this is what people are already doing: >> >> > >> >> > >> >> > GNU Make looks for 'GNUmakefile', 'makefile', and 'Makefile' >> >> > in this order. >> >> > >> >> > >> >> > So, you can put 'GNUmakefile' with your favorite setups. >> >> > >> >> > >> >> > $ cat GNUmakefile >> >> > ARCH=arm64 >> >> > CROSS_COMPILE=aarch64-linux-gnu- >> >> > CC=clang >> >> > include Makefile >> >> >> >> Very weird. >> >> >> >> I just tested this and it does not work. >> >> I did this: >> >> >> >> $ cat GNUmakefile >> >> ARCH = alpha >> >> CROSS_COMPILE = $(arch-prefix alpha) >> >> include Makefile >> >> >> >> In one of my build directories and the main makefile simply does not see >> >> the value of ARCH or CROSS_COMPILE I set. I have confirmed that my >> >> GNUmakefile is being read, because everything breaks if I remove the >> >> include line. >> >> >> >> Does anyone have any ideas? >> >> >> >> Something so we don't have to specify all of these variables on the make >> >> command line would be nice. >> >> >> >> Eric >> > >> > >> > Worked for me. >> > >> > Could you tell me the exact steps you did? >> > >> > >> > This is my case: >> > >> > My kernel source tree is located at $HOME/ref/linux >> > alpha tool chains are located at $HOME/tools/alpha-10.1.0/bin >> > >> > >> > >> > I tried a simple GNUmakefile with 3 lines. >> > >> > You can see 'make' is building the alpha kernel >> > >> > >> > Please see below: >> >> Interesting. That appears to work if I don't specify a build directory. >> Once I specify a build directory with O= it does not work. >> >> When I am working on a change that affects multiple architectures >> I really want a build directory that is not my source tree so I can >> test small changes on multiple architectures without needing to rebuild >> everything. >> >> Eric > > > Ah, OK. > When you specify O= option, Kbuild will > invoke sub-make. > So you need to add 'export' to the > variables. > > Please see the following modified version. Yes. That does seem to work and be simpler. Is there any chance we can get the command that generates the Makefile in the build directory to include variables like ARCH and CROSS_COMPILE in the Makefile as well? Just so they don't need to be set by hand to the same value every time? Eric