Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1866999pxy; Mon, 2 Aug 2021 12:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhS7ZSbYr9ayDU8Uwlv+toyi0MrcQTdYB2jzPMRIMyd/tBXqbsdYgR8/uB0L9ANDT3sC0t X-Received: by 2002:a17:906:360f:: with SMTP id q15mr17179112ejb.270.1627931887865; Mon, 02 Aug 2021 12:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627931887; cv=none; d=google.com; s=arc-20160816; b=vvtZ/pj4dHQV674XXn4HJiJj0NMwwigfU94wUkaTAjJloMJekA6Zor6auyrilKAFMT Xs9vNsAcjLkxGYo1Qr5Wjc0R5Uyl7P+5QHJaS7kIOAAE7pBWhSLidc1JlHW79DT82mnl J8D1XRdrN9CmDhdmHrzK2zJ4M55uIl3Y2a3kjnJ9ToM8dQuD53dRN8IjBxvuLWi2ww0a VG9IvW6fvHBfmlMNLVkVmd/MFBJ9TJxFBhmVx0IJvfkV8LfsRdqEG+R6b5Y4y/8Tro+U uYauoFOkAGNjz4Zi6rg/KRBl3maYe8/XE1xdj7yMsELOtUKBhY5B0yD5gsIyPLUR8X8t XNsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ZLfvUWXbh5V6pHR5OWkUX5ozbRIHg/mNXbOhh77U1jM=; b=moeqax3bx/vmoVoAWRcu4wbpmG/pW+rj5StDNI4wSXxQJjFmZlWDyWFAdkCwhCEFfh E9Ief6rtYBnGH6FDlFANly8zjYcePsN1vtHqu38gfFdqD2xYeXtBAiLJ+WESag/L2lRu dJ+/XCh8uVrWFYfadk5iFaUoYzxG78ziPolTAI8chM66o1gSi+DzfhkEf6UBHIYIl2BT WSYPcOODoWWr9rLpXEEm3L+X3J06lZQqQC1Gv07YqSBjOJFCPJJhc9NhxfB9HnpWb2WN WWZmKeIfChy4vy7lrxI23h4JbEgIjok4FhbWnf1B9f2rnOf7LYFhD7nyIoW7SBBz/TWi nyPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CgZFdceT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si10702253edw.18.2021.08.02.12.17.44; Mon, 02 Aug 2021 12:18:07 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CgZFdceT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbhHBTQd (ORCPT + 99 others); Mon, 2 Aug 2021 15:16:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:49444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbhHBTQc (ORCPT ); Mon, 2 Aug 2021 15:16:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 27F2860EE8; Mon, 2 Aug 2021 19:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627931783; bh=nB/idNrPLD9uz+xKPp20zN8CmDGUyr8ewkfN6nqYGFY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=CgZFdceTX69vnFjhfnfYTv7I4FmULK7iy/CMOih6trreL7q0juNhnieIc7iYd+CNn 2PX5jLmfEzGY4XNe/ewlOh3xYCgl4zQclVtn44ttiuVH12INNhXD2vXsiQEn7OHEpS ZeomECrUbtFI49xxTJfKeOrGSN1aymV4jJHU3O9/tiM99/ptMqXFY4lT+gpUr4kpUQ CgXbVgZ2y19j1m8h1Tm5VLTRqoFg5CO8g5MBy1apPc33ZtfnmSFcjwHHQzCtcD2GDL P+oi46Iib+nOJnvnmlyYxx7Ps+6NPvoHNOMjqTV2NVC5dVcHwTHnGQXy0P82706KqV uCsl2Dd/FecZA== Subject: Re: [PATCH v6 3/3] Documentation/llvm: update CROSS_COMPILE inferencing To: Nick Desaulniers , Masahiro Yamada Cc: Miguel Ojeda , Fangrui Song , Michal Marek , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Geert Uytterhoeven , Christoph Hellwig , Linus Torvalds References: <20210802183910.1802120-1-ndesaulniers@google.com> <20210802183910.1802120-4-ndesaulniers@google.com> From: Nathan Chancellor Message-ID: <95712f4c-9da5-b7b6-f617-b6b686b6eadc@kernel.org> Date: Mon, 2 Aug 2021 12:16:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210802183910.1802120-4-ndesaulniers@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/2/2021 11:39 AM, 'Nick Desaulniers' via Clang Built Linux wrote: > As noted by Masahiro, document how we can generally infer CROSS_COMPILE > (and the more specific details about --target and --prefix) based on > ARCH. > > Change use of env vars to command line parameters. > > Suggested-by: Masahiro Yamada > Reviewed-by: Fangrui Song > Signed-off-by: Nick Desaulniers Thanks for the update, I think this is much easier for non-CBL folks to understand. Reviewed-by: Nathan Chancellor > --- > Changes v5 -> v6: > * Pick up Fangrui's RB tag. > * Change use of env vars to command line parameters for consistency. > > Documentation/kbuild/llvm.rst | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst > index b18401d2ba82..f8a360958f4c 100644 > --- a/Documentation/kbuild/llvm.rst > +++ b/Documentation/kbuild/llvm.rst > @@ -38,7 +38,7 @@ Cross Compiling > A single Clang compiler binary will typically contain all supported backends, > which can help simplify cross compiling. :: > > - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang > + make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- > > ``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead > ``CROSS_COMPILE`` is used to set a command line flag: ``--target=``. For > @@ -63,6 +63,23 @@ They can be enabled individually. The full list of the parameters: :: > Currently, the integrated assembler is disabled by default. You can pass > ``LLVM_IAS=1`` to enable it. > > +Omitting CROSS_COMPILE > +---------------------- > + > +As explained above, ``CROSS_COMPILE`` is used to set ``--target=``. > + > +Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive > +``--prefix=`` to search for the GNU assembler and linker. > + > +If ``CROSS_COMPILE`` is not specified, the ``--target=`` is inferred > +from ``ARCH``. > + > +That means if you use only LLVM tools, ``CROSS_COMPILE`` becomes unnecessary. > + > +For example, to cross-compile the arm64 kernel:: > + > + make ARCH=arm64 LLVM=1 LLVM_IAS=1 > + > Supported Architectures > ----------------------- > >