Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5606924rwb; Tue, 17 Jan 2023 16:24:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNELAmCOdqWqYl0M2q/WKBpDItBZGAps2hy24xy5MlBX2bN/rTjhu1AcoEDiadfTCaEQTz X-Received: by 2002:a17:907:c911:b0:870:5bf4:a3b1 with SMTP id ui17-20020a170907c91100b008705bf4a3b1mr4178893ejc.33.1674001490329; Tue, 17 Jan 2023 16:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674001490; cv=none; d=google.com; s=arc-20160816; b=KbJ8xSlX7JOdBW+xHfb/8yNTOAIOJpDCkJ8qMntoqDOA5exT5Jj0moMtTtEkExbojd UDaHlhgLXcUQOLkBbnbU3gnjVnbBVrFK8Q89r0aSSkM4nFeFUVoQdXeXYcyBXCKZ4Le9 K56OBy/CU6jM/pGVY7FvrRjgR0hzK5j7sfOkC0cpjVAvunsJDpmJWgjTOtARE0gPSZoF BKKZe6aUhtBMP57SrrOhMcUlzTcCC0tP7QeHRT3+R8hUeOzLF8EVlwPH4mXOnU6Nmj2Y LsesTqdfXyqikqM2iGIEttFmTxbThC/hJz46wnRK6ujAQJ2HgFk4AnapqursMZq4J14L 1o3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wdNV2FR4hnXWIMBBxcsFSzsqX2FCul/r2qCos1KeHcM=; b=jkjy01RPx7zHQZaX2DTMCYF/mgKKFbuSfTnv9ZVbRjl875x3wqNncExR7WNpSg07Ll aBXxBqruK8L/NrbrtlttrHUwqaV83Qi7Z68363Yl4e6dG2f5o7eLyxxJuGtS3EGqpJG+ Bd9UXLtHKL5i/woKpdxp/EtnGzgjAcaSaqi3OZg2VzrCvuqM/mKiUQPDUeojPzc6jSx3 tKm7LaIj1kDt15hWwyH/7zRCDauClCqVGkl8U4d4xj2ScN43EfWwUt6m1iOvNVirOqUB 74Y/2jqtnyC3rOCW+zU+1hdrHYPUh4crPFv2Fz6EBpIuCGRyydk2caFdHPvtrsjeqsyH IKkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XuK6YF0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds17-20020a170907725100b0087664357428si1237794ejc.379.2023.01.17.16.24.39; Tue, 17 Jan 2023 16:24:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XuK6YF0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229636AbjARAIC (ORCPT + 46 others); Tue, 17 Jan 2023 19:08:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbjARAHn (ORCPT ); Tue, 17 Jan 2023 19:07:43 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF1CF6CCC3 for ; Tue, 17 Jan 2023 15:20:51 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so307357wmb.0 for ; Tue, 17 Jan 2023 15:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wdNV2FR4hnXWIMBBxcsFSzsqX2FCul/r2qCos1KeHcM=; b=XuK6YF0KKbfzucFCrwkHMoNMM+miRvxE5AejKyv5FQUNIsCUkSS/zQ6DoVtCUkI6jo JuDMgnayppjfSUX7c8LlLOhmiru/YoBiyBMGFbAnh+V7CH/dug9WwqyanhSvdl4EuUH5 R/ehasZ6ygNDGGI7wAndG9Lrm04fDUaH0bYgZD6FUGkiYeIcObWeTr0kEEbwdYBwWmvc ZnNSirXXw0nNA3t3kfYuoX+Ce2U+dCf1iLHbLzNRlmuJA+STYmvFReTbSqmu6tXfiqzE 2Wc4ETVQWS1jMEV/7GY0ytntQxXgf+VgfEWM5xSVYZduMl0DNE9c99a3cBzfjcW5Ddiz 41jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wdNV2FR4hnXWIMBBxcsFSzsqX2FCul/r2qCos1KeHcM=; b=CThKC8b+eSTfzkUsI9a/HSsECVnug33YI9dIjwb/SujjIMXBZgk8wdhXyUl50YYG+L 6xkkFJy9CF1ee2HWeUUn8TzPsT1FJ4tma7f6SC2YmLpjEUJupq1+1ZGURZtjYCgYwg0n XjUxarqR1YxTThh5wwf20bNOSqE5iKCI7Rk5HykOEereuPl7GjlqnXW61XlzXTYJqLAP xOILzYyqIqLV0wJSAOaUsBSytQfC9gICzPAw22m6E8zeryGPg12DDDt9fEvY4a1IsxVu 2+ksayW2gzD4YFgJfpC7XA7QaNb83eQ2KrQ7XlpKFHiL3PiEKGTiJ/whDpq3Hj/w/9LX uagg== X-Gm-Message-State: AFqh2krQHjnVF3l8Ix6I/pxT0XBjBsfOMUSTv6KeKQidecF37TqjD6RP BMAmGYBRXix7dytNeJg0v4nPFx/7SsEZobYXpW4+1A== X-Received: by 2002:a1c:7404:0:b0:3da:b40f:c734 with SMTP id p4-20020a1c7404000000b003dab40fc734mr406100wmc.115.1673997650192; Tue, 17 Jan 2023 15:20:50 -0800 (PST) MIME-Version: 1.0 References: <20230116215751.633675-1-irogers@google.com> <20230116215751.633675-2-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Tue, 17 Jan 2023 15:20:38 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] tools/resolve_btfids: Alter how HOSTCC is forced To: Jiri Olsa Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Connor OBrien , Nathan Chancellor , Kumar Kartikeya Dwivedi , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 17, 2023 at 2:07 PM Jiri Olsa wrote: > > On Mon, Jan 16, 2023 at 01:57:51PM -0800, Ian Rogers wrote: > > HOSTCC is always wanted when building. Setting CC to HOSTCC happens > > after tools/scripts/Makefile.include is included, meaning flags are > > set assuming say CC is gcc, but then it can be later set to HOSTCC > > which may be clang. tools/scripts/Makefile.include is needed for host > > set up and common macros in objtool's Makefile. Rather than override > > CC to HOSTCC, just pass CC as HOSTCC to Makefile.build, the libsubcmd > > builds and the linkage step. This means the Makefiles don't see things > > like CC changing and tool flag determination, and similar, work > > properly. > > > > Also, clear the passed subdir as otherwise an outer build may break by > > inadvertently passing an inappropriate value. > > > > Signed-off-by: Ian Rogers > > lgtm did you try cross build and build with clang? Hmm.. I don't have a cross build but I checked clang. Any chance you could check the cross build? Thanks, Ian > jirka > > > --- > > tools/bpf/resolve_btfids/Makefile | 17 +++++++---------- > > 1 file changed, 7 insertions(+), 10 deletions(-) > > > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > > index 76b737b2560d..515d87b32fb8 100644 > > --- a/tools/bpf/resolve_btfids/Makefile > > +++ b/tools/bpf/resolve_btfids/Makefile > > @@ -18,14 +18,11 @@ else > > endif > > > > # always use the host compiler > > -AR = $(HOSTAR) > > -CC = $(HOSTCC) > > -LD = $(HOSTLD) > > -ARCH = $(HOSTARCH) > > +HOST_OVERRIDES := AR=$(HOSTAR) CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" \ > > + ARCH=$(HOSTARCH) EXTRA_CFLAGS="$(HOSTCFLAGS) $(KBUILD_HOSTCFLAGS)" > > + > > RM ?= rm > > CROSS_COMPILE = > > -CFLAGS := $(KBUILD_HOSTCFLAGS) > > -LDFLAGS := $(KBUILD_HOSTLDFLAGS) > > > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > > > @@ -56,12 +53,12 @@ $(OUTPUT) $(OUTPUT)/libsubcmd $(LIBBPF_OUT): > > > > $(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd > > $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(SUBCMD_OUT) \ > > - DESTDIR=$(SUBCMD_DESTDIR) prefix= \ > > + DESTDIR=$(SUBCMD_DESTDIR) $(HOST_OVERRIDES) prefix= subdir= \ > > $(abspath $@) install_headers > > > > $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUT) > > $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(LIBBPF_OUT) \ > > - DESTDIR=$(LIBBPF_DESTDIR) prefix= EXTRA_CFLAGS="$(CFLAGS)" \ > > + DESTDIR=$(LIBBPF_DESTDIR) $(HOST_OVERRIDES) prefix= subdir= \ > > $(abspath $@) install_headers > > > > CFLAGS += -g \ > > @@ -76,11 +73,11 @@ export srctree OUTPUT CFLAGS Q > > include $(srctree)/tools/build/Makefile.include > > > > $(BINARY_IN): fixdep FORCE prepare | $(OUTPUT) > > - $(Q)$(MAKE) $(build)=resolve_btfids > > + $(Q)$(MAKE) $(build)=resolve_btfids $(HOST_OVERRIDES) > > > > $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > > $(call msg,LINK,$@) > > - $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > + $(Q)$(HOSTCC) $(BINARY_IN) $(KBUILD_HOSTLDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > > > clean_objects := $(wildcard $(OUTPUT)/*.o \ > > $(OUTPUT)/.*.o.cmd \ > > -- > > 2.39.0.314.g84b9a713c41-goog > >