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=-9.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 4BCF0C433DB for ; Tue, 9 Mar 2021 20:00:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13D7A6522A for ; Tue, 9 Mar 2021 20:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbhCIUAA (ORCPT ); Tue, 9 Mar 2021 15:00:00 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:52708 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231596AbhCIT7g (ORCPT ); Tue, 9 Mar 2021 14:59:36 -0500 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 129JxHaT012316; Wed, 10 Mar 2021 04:59:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 129JxHaT012316 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1615319958; bh=wou3lyafM4ONQKR6kN74QI87FmicL9SFVho3ygkDglM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sjmwAI9xvm2Zy6LtpLeE852Wy9RroQWF2TUSaLlRLLO+bm8mDSWKQ4HxUGdMjf8qD 1l+ZGyu2sK8hSRmTKQC0M5WK2r3fOMkXFEZZWDAG6g1ZH25o5+BiYkqxBqXfmWMRmY jOMGu3WYFA2FfnAmyTndTg5ZQOmjogeH08282/xGbtCQjK8n7YQms/oHN2u7pq0cCb ITT1bAgOAbXloH4PvaLrJj6lxITcUnkwtIwZDPYuwWyIILup4mXgmW/aWINtrfxkPT //QHVknwFKoKVDm1c5RwKsfWe8xCrhuYI89vEq/tuGxY8vxU7IUSb97NZxSVhOxwQm rOvy1lHgmVN4w== X-Nifty-SrcIP: [209.85.214.173] Received: by mail-pl1-f173.google.com with SMTP id u18so7139907plc.12; Tue, 09 Mar 2021 11:59:17 -0800 (PST) X-Gm-Message-State: AOAM530YjikXgjSeoPt2ddpc9QerNhhYU2AxJTdSriNHzQFNXyEvPHjl kaIAbKwsHDECKlqI6hwTL8fxFBCN55PHcpsZTs8= X-Google-Smtp-Source: ABdhPJyu7CPo4ikfEtebKPQYUBDnx6k1ucJhvEHaGxy8qyVnzrQco83OIsQDbKZALU41Il9x7uyqrLaQR9YDlllaMhI= X-Received: by 2002:a17:90a:dc08:: with SMTP id i8mr6060446pjv.153.1615319956989; Tue, 09 Mar 2021 11:59:16 -0800 (PST) MIME-Version: 1.0 References: <20210302210646.3044738-1-nathan@kernel.org> <20210302210646.3044738-2-nathan@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Wed, 10 Mar 2021 04:58:39 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] Makefile: Only specify '--prefix=' when building with clang + GNU as To: Nathan Chancellor Cc: Michal Marek , Nick Desaulniers , Linux Kbuild mailing list , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 4:55 AM Masahiro Yamada wrote: > > On Wed, Mar 3, 2021 at 6:07 AM Nathan Chancellor wrote: > > > > When building with LLVM_IAS=1, there is no point to specifying > > '--prefix=' because that flag is only used to find the cross assembler, > > which is clang itself when building with LLVM_IAS=1. All of the other > > tools are invoked directly from PATH or a full path specified via the > > command line, which does not depend on the value of '--prefix='. > > > > Sharing commands to reproduce issues becomes a little bit easier without > > a '--prefix=' value because that '--prefix=' value is specific to a > > user's machine due to it being an absolute path. > > > > Signed-off-by: Nathan Chancellor > > > I was tricked by a couple of Reviewed-by/Tested-by tags. > > With this patch applied, the code looks as follows: > > > ifneq ($(CROSS_COMPILE),) > CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) > ifneq ($(LLVM_IAS),1) > GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) > CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) > CLANG_FLAGS += -no-integrated-as > endif > endif > > > For the native build (empty CROSS_COMPILE), > you cannot add -no-integrated-as. > > > I dropped this from my tree. > > > > Is the correct code as follows? > > > ifneq ($(LLVM_IAS),1) > CLANG_FLAGS += -no-integrated-as > ifneq ($(CROSS_COMPILE),) > CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) > GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) > CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) > endif > endif > > > > If you send v2, can you include comments from Fangrui Song? Fangrui Song: clang can spawn GNU as (if -f?no-integrated-as is specified) and GNU objcopy (-f?no-integrated-as and -gsplit-dwarf and -g[123]). objcopy is only used for GNU as assembled object files. With integrated assembler, the object file streamer creates .o and .dwo simultaneously. With GNU as, two objcopy commands are needed to extract .debug*.dwo to .dwo files && another command to remove .debug*.dwo sections. I did not know the objtool part, and I think it is worth recording. -- Best Regards Masahiro Yamada