Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp101122rwb; Wed, 18 Jan 2023 14:48:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtkuwZzu8a/BW24LGQegBhv6AvKICNPdjU/3MvFI7yZSBVJOWgf58rOP9m/f7O+WS3ZZG05 X-Received: by 2002:a05:6402:642:b0:496:d2f7:77a2 with SMTP id u2-20020a056402064200b00496d2f777a2mr20028479edx.18.1674082133855; Wed, 18 Jan 2023 14:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674082133; cv=none; d=google.com; s=arc-20160816; b=uSCSDVedr6b4yjNwdt7SLiHPljMExJ0NFZyerURrsYCNWILqdq9UEbni8zHJ7mSY7J +SBmmVpghbt1QPjxaTVi2EEndcE5mmQf1itpHIs76qZwwV5XNyMv5P1cvHu+FJokMVUG 8BnpTtQF3GSCTM/2e+htMb9mO3o2kUSIgiiRQjlTlPXKwO8c9WnhgE1twPALntKUBwNi DecSsw11dP+VYdKSGL/pkC6ZTgqi87uxHvI1lEU9CT/cTnAn8Lk5Uuw7COR+LLE5nZLL S1ekSUC7l4MNHZWA28rqDJ61enklPJCZjIIzC13dDIDy4T0rKrRcm+t5wULmeXVyWW8U WRyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=zWvijKrwl15jXFb6uDYvZYZZ8XxHXT0j0cKpcyIGLvk=; b=CSPAEvKGf7lIxXeljDYpaJKn3Vsmqgf5/HrYxUQ/s/4rVB8hMNFt1MMwVF2t03TBV0 f5hvn62j/j6VaYgq6lNcW/Vi4nJdaP8pIaXY1Pm0nKhS+45Bmwfo8zbrhEeOKK6SHuSD pmaiaGTP/2ggTG+T95ZIJxhPiQp3Tt/7hlVIMkmI4JcQw9wRZV1M5GCiOBVY/Ny/XBsu OotWOH4yIMS4iow1+5XmvjB/xXzMRVw1W7evB4b7beBgO3Jnu8xXSDUg4OKYqbMTcu2w XFSq2vQvGnuD2c5i0wzkdzgvovYEQ8eef+wQqVQQ/p2Kkml/mYFVRYD98hVMmod2sPeA 3WfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l7aEfFt1; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a50c350000000b0048f81bf24dfsi12729575edb.143.2023.01.18.14.48.42; Wed, 18 Jan 2023 14:48:53 -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=@gmail.com header.s=20210112 header.b=l7aEfFt1; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbjARWbH (ORCPT + 44 others); Wed, 18 Jan 2023 17:31:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjARWak (ORCPT ); Wed, 18 Jan 2023 17:30:40 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A1E47EE2; Wed, 18 Jan 2023 14:30:38 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id v5so705654edc.3; Wed, 18 Jan 2023 14:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=zWvijKrwl15jXFb6uDYvZYZZ8XxHXT0j0cKpcyIGLvk=; b=l7aEfFt1G8GYjFlzRJIqYxt0RJUQu/e65DksD7Ojn7ZuRA9tIGndtVq+ZzzAnanqEm 6ogJFxc4/nbK2clLPr2x65vJEMvCtq0vsVFN+bN/ZuXWOQO2y+0FPU2kLUURuoOPasCb gq9p3dykBCpF+SC893gsGUxoEx+uatygY0zArD44JGmvNA+2k1T9bQ7s49kw7ijHwYxX Mh5J9mZVZQHZ2NElP9fwTjjhCL0akN/UdjhjhuC3RYysPXDkRyyu9LAbPSHhGOKG9lV4 f0tG79ttGChzBDGHBMICeEliS8lRmIZ5mVkKutJSf4RqXoEG3k9bvuOftU7tsW8C9rLk /r+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zWvijKrwl15jXFb6uDYvZYZZ8XxHXT0j0cKpcyIGLvk=; b=nI7gOFoOjiBGs8TT2v85L/A70wcmJ9kqjSIDkkPWI2BgwFHMAIRXnUuJNE5mFJzS4D KyvVBQBHPnsUta+mxR5LEW0thJv37b0Rh/ehhJJOqLTfa0sVofx3einPXQxByj85Mefh 5bkAA70r02lno9sXXvaqPW9Z452XP4Qssx16MII7ExOYOIW+TZ/LG6T81R3BYOy4ZXGX K9SS6t2aYjbjqWw5ohMBbLTgK+RlSCLcU/as1PTp49N/ZvMjakGVYySCK7kUikiN2GWd LdiwHbn1vW4aB7xF+qlLNUKaqH732AucFUSdlxSmO1L15pwYziKhwkSJNtu0zi89O4eI FBEA== X-Gm-Message-State: AFqh2kqa4pg3b+s8CH9Syg6ZJzhCd0d0vb/g1tMhX2mls1J/Lhz/OMIH BXYxDrC8DHWP6ecwr7hWQ3g= X-Received: by 2002:a05:6402:547:b0:499:bec8:4d with SMTP id i7-20020a056402054700b00499bec8004dmr19963057edx.32.1674081037205; Wed, 18 Jan 2023 14:30:37 -0800 (PST) Received: from krava ([83.240.63.129]) by smtp.gmail.com with ESMTPSA id en6-20020a056402528600b00499b3d09bd2sm12535862edb.91.2023.01.18.14.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 14:30:36 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 18 Jan 2023 23:30:33 +0100 To: Ian Rogers Cc: Jiri Olsa , 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 Subject: Re: [PATCH v2 2/2] tools/resolve_btfids: Alter how HOSTCC is forced Message-ID: References: <20230116215751.633675-1-irogers@google.com> <20230116215751.633675-2-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 03:20:38PM -0800, Ian Rogers wrote: > 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? ok, I'll try tomorrow jirka > > 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 > > >