From patchwork Thu Nov 17 22:03:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 21960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp645373wrr; Thu, 17 Nov 2022 14:06:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qs/Kp4VwhX5J+CkoYv2gxlGsPngvRP0pHXjKpijmmF7gMSqLKVyZ8vvVExcXWH+3vrOsW X-Received: by 2002:aa7:8d01:0:b0:562:83c1:59e0 with SMTP id j1-20020aa78d01000000b0056283c159e0mr4886490pfe.34.1668722789748; Thu, 17 Nov 2022 14:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668722789; cv=none; d=google.com; s=arc-20160816; b=xyKfA3HDy+b6et4t30oKsYlbjYlPeDKxelNLyJhQLF2eyW8PfsudaXYsv5GNIBsDYe jQ2cxG8N2QtiKUOvjjVhyGXSmnE0Q5ihVFvSe/V65VX9sbWklXPnAAjZ51Rvw6glM94f lK5ucDK7zlVHrOrxIsVwVMx1guVrVSrxU+j9cjMNLY6XM4CuGI0WNpSpLHvM63yMfz5N eFFuPzjbXsGcJgxpNRnF/MsFWsJmNnvn4g3mi2zkEgvAAL/ImLZ6oagbmcKRYfqYtSzL 8G/P3JgXRnz17WV3v8cKe/H/NTrx+AaxoPPRzz2DF+xYCKvBMlTYR40d4PuxcgDlR5xo 3gjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=i6w8X/FEX+k6lmFIXTs91E3JTRcJpHgBrrHWmdWICRc=; b=wjAEH2Iksd3gXGt7WUNthH+FlL3gvv0wK/aS9BcXiBPycXbx4LTS8aUzrbZnLlNaV1 o73nrUI/OQ4D8nd2FgjPxLJKHBitUtj/UJKkwyVT8Af4kflU42iOA3n5l0b0mNmlI4li /QvB0wrC4qD17fGgcC/WeGOpkRhgQebkGc0mB5ufHAbgE2OAly+5t62r4OzAkeZ+hgQs YPZiJlaoABhC/skk/iqIqjOsk4bCLjGVht9NjtsRiT816YrOMFpw7VE6TtJctTpYa+GP 3BfMCgGgsIdhFUjrjpjCuqgmfwDQo6ne2jMEzxVWtqZ0DNLd/JL/5zKZHew1hJQ2iPdR /ljg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=X56mfUl5; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a634843000000b004403e01f82asi2026207pgk.230.2022.11.17.14.06.16; Thu, 17 Nov 2022 14:06:29 -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=X56mfUl5; 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 S241149AbiKQWFj (ORCPT + 99 others); Thu, 17 Nov 2022 17:05:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241053AbiKQWFM (ORCPT ); Thu, 17 Nov 2022 17:05:12 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886A82717C for ; Thu, 17 Nov 2022 14:03:56 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id t9-20020a5b03c9000000b006cff5077dc9so2781289ybp.3 for ; Thu, 17 Nov 2022 14:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=i6w8X/FEX+k6lmFIXTs91E3JTRcJpHgBrrHWmdWICRc=; b=X56mfUl5VlxMRsxDJ+e6Lep8lObttWYXeSv/UmVLRoqcg/lv00Qobno67OYOrhLGUF xtW4JDNUG4OtFy55LevzS3U8QmO2uc4ypJfAJgWqIc3nRZ43rUUy9xdbLhvztkUdA13d 4LZa2EjXLp6ANOFEKFLckDnWI4lAK8pbteZCX3hjj2YhUhxIp21xRo9oqeAqc7ws7PYS nh3MEupBip9D43sbicqnwuphQ6DAEo3rFR4FN0N+Wy7kBEkE7ow4gUOqS2O1GHm8zYFU btyQCAs/UVNymMnMAHPI7Imawr0j+AhJ+hcwC9yAQvXR/nYPp3Wx/V+LOEnss1gbgHTX zPbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i6w8X/FEX+k6lmFIXTs91E3JTRcJpHgBrrHWmdWICRc=; b=nxmc0RfPRi3dXUfr8LLiCCwNGkW6j7R9pHgKPOQ6z/PPvj7i2cl+iQ2SCjzqOkbOWn Q+qLqgMQUzfJ6frn+nJC15EvGt8qCEPHt5KExOnFrb/FiAvSYsd60qJh7PjQSmDhMASn wyHJz/aIsMBbjaPHGRAbrY1jbugES8gHoIzrzCfuoJSyooSuHN+7VnDHReJrR98xqixr Hl00Kh9JWdAly5jZje9yzsDIK9C53N6abXRJPBLzL+spnDXIK6xjw3y1b0j6fSXZLPNm LCGFJvyKOrGzFd/cOFv9da97KpNmIiboaz0nWtp1HNDhExvDWqaWfYUGR+74ru8J/tjs rbVw== X-Gm-Message-State: ANoB5plnwonMxTzIYKgLPTL28QwaD5L9dG9HYwMl6n35ed9HApYkvts/ 2pXBgOnK+AV8ebaTAmyMIdDoFYcPfEqU X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3f1e:c462:d6b8:fba8]) (user=irogers job=sendgmr) by 2002:a25:bd52:0:b0:6e6:8497:ad31 with SMTP id p18-20020a25bd52000000b006e68497ad31mr4148339ybm.165.1668722635804; Thu, 17 Nov 2022 14:03:55 -0800 (PST) Date: Thu, 17 Nov 2022 14:03:37 -0800 In-Reply-To: <20221117220339.341290-1-irogers@google.com> Message-Id: <20221117220339.341290-2-irogers@google.com> Mime-Version: 1.0 References: <20221117220339.341290-1-irogers@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Subject: [PATCH v1 1/3] objtool: Install libsubcmd in build From: Ian Rogers To: Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Stephane Eranian , Andrii Nakryiko , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749782667830774117?= X-GMAIL-MSGID: =?utf-8?q?1749782667830774117?= Including from tools/lib can create inadvertent dependencies. Install libsubcmd in the objtool build and then include the headers from there. Signed-off-by: Ian Rogers --- tools/objtool/Build | 2 -- tools/objtool/Makefile | 33 +++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tools/objtool/Build b/tools/objtool/Build index 33f2ee5a46d3..a3cdf8af6635 100644 --- a/tools/objtool/Build +++ b/tools/objtool/Build @@ -16,8 +16,6 @@ objtool-y += libctype.o objtool-y += str_error_r.o objtool-y += librbtree.o -CFLAGS += -I$(srctree)/tools/lib - $(OUTPUT)libstring.o: ../lib/string.c FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index a3a9cc24e0e3..a3b55c807a51 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -12,9 +12,15 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif -SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/ -LIBSUBCMD_OUTPUT = $(or $(OUTPUT),$(CURDIR)/) -LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a +LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ +ifneq ($(OUTPUT),) + LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd +else + LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd +endif +LIBSUBCMD_DESTDIR = $(LIBSUBCMD_OUTPUT) +LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a +CFLAGS += -I$(LIBSUBCMD_OUTPUT)/include OBJTOOL := $(OUTPUT)objtool OBJTOOL_IN := $(OBJTOOL)-in.o @@ -28,7 +34,8 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ -I$(srctree)/tools/arch/$(SRCARCH)/include \ -I$(srctree)/tools/objtool/include \ - -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include + -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \ + -I$(LIBSUBCMD_OUTPUT)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) @@ -38,6 +45,7 @@ elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk +MKDIR = mkdir BUILD_ORC := n @@ -57,13 +65,22 @@ $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ -$(LIBSUBCMD): fixdep FORCE - $(Q)$(MAKE) -C $(SUBCMD_SRCDIR) OUTPUT=$(LIBSUBCMD_OUTPUT) +$(LIBSUBCMD_OUTPUT): + @$(MKDIR) -p $@ + +$(LIBSUBCMD): fixdep FORCE $(LIBSUBCMD_OUTPUT) + @$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ + DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= \ + $@ install_headers + +$(LIBSUBCMD)-clean: + $(call QUIET_CLEAN, libsubcmd) + $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT) -clean: +clean: $(LIBSUBCMD)-clean $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete - $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep $(LIBSUBCMD) + $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep FORCE: From patchwork Thu Nov 17 22:03:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 21961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp645382wrr; Thu, 17 Nov 2022 14:06:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf6HGWMlVBpQwr5XMSAXInW8P6/MhKiQhWMdcj22GunWzDCCdkvwiJKP22mLwBJitISzyXyN X-Received: by 2002:a63:1601:0:b0:46f:9193:467d with SMTP id w1-20020a631601000000b0046f9193467dmr3909933pgl.479.1668722791250; Thu, 17 Nov 2022 14:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668722791; cv=none; d=google.com; s=arc-20160816; b=r7b1Bn3PpwYjLtLWCDvAbA5K6YR6WWduPKZ1xOWgMU1EvQWj6SRFJeMBSKtAzyUdeq yegLMFhn52AaD9cknAQXW5qyhn7Be96FPQRwuT5pIqw1zJE34v37EVbyKueF6+5Rjs02 +F4rczaQc3NRRvkDMzNMGM0U362cXagF4oOLcY10uKg3xuO3BSClR0wNHlaqk98dWFxr L5hDtI/ng+Ztpr0r9AIT70lC9SLdH0AOpSc8n1c/89DlHNr7Oe6/MGAVat50CeDeXRR+ oL/PLVUHT+2saOK9rxm5xNd5t2r/w+PLrc1rtvp2yn4qHWl4QfxnDkhcZp8+LFIh6yso Tyug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=zN9iF3uBflZ8Xy8LWXsRFnlUwRcK8nR9vFeAViyEg3w=; b=lak3tj+oMZv4zddw/WAvk2UGuq3ypWqSLOXvsONFHdQE+5mfkxM0OeV4m3REUCs+Yp kXtDmWFg9lmj070s4YNba7YyxZkoBqiWST/Ulj0Y1qottJO8dlSGk2StMjJgydUPbOrb xZsBwOnV8rNoG4Uyf4YHhggsgj6iRPUyA9yjaxa3W7rWF4avrRZCeCF1xcC1hUXk4swc Xceghpp5QDzrxhCgZ/xN3CdFwIfd2urxol9jBviQjB8MunPTBmcd81Zc6O14rJ76+CrT pOF64yQVdACJIdBc1ZbykMnVnZAOBNBje9XAfceYZ9Ov3i4e+30iCb7zO3tj4peMrYJS +8Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="FUio/Dfy"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc1-20020a17090b3b8100b001fd8713170csi6593626pjb.179.2022.11.17.14.06.18; Thu, 17 Nov 2022 14:06:31 -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="FUio/Dfy"; 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 S241197AbiKQWFm (ORCPT + 99 others); Thu, 17 Nov 2022 17:05:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241157AbiKQWFR (ORCPT ); Thu, 17 Nov 2022 17:05:17 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0800F72137 for ; Thu, 17 Nov 2022 14:04:04 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-38f92b4b3f2so31674157b3.1 for ; Thu, 17 Nov 2022 14:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zN9iF3uBflZ8Xy8LWXsRFnlUwRcK8nR9vFeAViyEg3w=; b=FUio/DfydfYdb4IgGKrax+IOOSEJyZUeqqiG6wojZ5ImpN1x/0VdJkeNBd0UKi596I lkJTMztN1RVInRqP5wrWWgeK/HJdpL5UyMv54TW2UbAO9JUuFddGEcr0dYLZzyEs6OYo NdCDjTvRAGryqn4n2RWdHtzGQxjNVNbNs08ihglztICussWb4blWNiHbQLTUdqax+CkF 2hjboqb+JJd696ClfAYJ+S+6hqUkI6cn4+8ggjVeusxMPKO4b/XD06eXYLlJJRFouYAe flys8fyoIfzXW+Y+2YkfbkN5zhuMZ7Gd8ogck0qqWcL19iRBN1pWq58MFO7fNrwTia85 9XIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zN9iF3uBflZ8Xy8LWXsRFnlUwRcK8nR9vFeAViyEg3w=; b=2w8ie+4s3oPa+iQgwmfwAZagRjhVmbiT8v0txFYAQUlmtFhHd5LmzmKUaa8KptJgnx Q2tm3yoDc1OscISb3cNQcsYLucqnA1ViWN2CIH6pPj26rpPJynmkF7kRjh5bNAnPoiIl TXyUCBT/HXr5ly6c35sTRTRoae5DY4kc4lpCE7MjytnwDu3JDwlVkdvXsRBffqBil3QX 8gGkX8BsPXeVS+fhA6r3rt9/qDvdbfkySGP6S/xQLlgN6WLcNV3AN4bDVyQR2wAKkAld /89hkK3Glt3Kimfay8cT7pgurj8y0xMvjrAq8zTnGAXqsya5njBzUYXMl97y6iqNFFk3 ak7w== X-Gm-Message-State: ACrzQf2ipE/sXdOhfLt+k9mfJtj+CbNaBHKYnWvPGLZKXLR4NCeLtrLP CctwaeXgNB/W9VOb8XIbizfo0Vtdm536 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3f1e:c462:d6b8:fba8]) (user=irogers job=sendgmr) by 2002:a81:79cc:0:b0:367:6127:ad8a with SMTP id u195-20020a8179cc000000b003676127ad8amr64703162ywc.60.1668722643602; Thu, 17 Nov 2022 14:04:03 -0800 (PST) Date: Thu, 17 Nov 2022 14:03:38 -0800 In-Reply-To: <20221117220339.341290-1-irogers@google.com> Message-Id: <20221117220339.341290-3-irogers@google.com> Mime-Version: 1.0 References: <20221117220339.341290-1-irogers@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Subject: [PATCH v1 2/3] objtool: Properly support make V=1 From: Ian Rogers To: Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Stephane Eranian , Andrii Nakryiko , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749782669248582148?= X-GMAIL-MSGID: =?utf-8?q?1749782669248582148?= The Q variable was being used but never correctly set up. Add the setting up and use in place of @. Signed-off-by: Ian Rogers --- tools/objtool/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index a3b55c807a51..6b6c20ba5160 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -47,6 +47,12 @@ CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk MKDIR = mkdir +ifeq ($(V),1) + Q = +else + Q = @ +endif + BUILD_ORC := n ifeq ($(SRCARCH),x86) @@ -58,18 +64,18 @@ export srctree OUTPUT CFLAGS SRCARCH AWK include $(srctree)/tools/build/Makefile.include $(OBJTOOL_IN): fixdep FORCE - @$(CONFIG_SHELL) ./sync-check.sh - @$(MAKE) $(build)=objtool + $(Q)$(CONFIG_SHELL) ./sync-check.sh + $(Q)$(MAKE) $(build)=objtool $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ $(LIBSUBCMD_OUTPUT): - @$(MKDIR) -p $@ + $(Q)$(MKDIR) -p $@ $(LIBSUBCMD): fixdep FORCE $(LIBSUBCMD_OUTPUT) - @$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ + $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= \ $@ install_headers From patchwork Thu Nov 17 22:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 21962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp650157wrr; Thu, 17 Nov 2022 14:17:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf6TWnhEl9GLAfj376ZS0TUcCVPznbezgi2lqPu3zXSuAPViZ4tQtb3DSvHSEHxKTGirX7dO X-Received: by 2002:aa7:d358:0:b0:467:6847:1ea7 with SMTP id m24-20020aa7d358000000b0046768471ea7mr3857479edr.237.1668723478122; Thu, 17 Nov 2022 14:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668723478; cv=none; d=google.com; s=arc-20160816; b=GLwP4Kdi2+h5/2ZEf2KZ0yICh6nAWI0aRhS851Q4E72F/96Qo5X3qBbtFBYAioBkOe vJyHEdj9eOfLwRMc+civGEGznql46VfTBvUkQWbwBr/O4l/63Vc7umd2n6dxPeIvZYuj 9q/hI4tKhM/aYTFKkiE0erRyDm2V/IebhAEXehVA+9K+y/osO0NsNAycB/EsuoNsiADV cg/9hd+c7IgwMFFqr+G6ycU+a7uIVOmD5RLHFwa5OgLASmIJ+FLk4yd8voOKOfwmoAOA dFoTY2NtynjWWa/gD75TGDc5opLH12/DUdozx1qLdaIZrBG9pWI/kPeC7eg29pMaS0+t GhIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=E/8tcV65NVEwS5qyaLKJ1YnmWVyteYUi8du6gRZPUlk=; b=NIXhns52+o7nq07kHS3qHiuK2DZZ7C49TbIxDdIhSEG8oBckW65zRmD+N0BOswGVCj QiXKxuXEOSxnzw8h+jk5jpjxLD9h5bVwQPoWF8NS+drdcXRQ1OokYg0ZDjbHkuEXkYy4 eeWyxQJNJ6OiOMsCA/mTG137BgkoqHBpq/ngpnDNyKuk8BUf/mnU4NMu0aBvMbEtUs0m oxqWyao06NfbdDzct90lovd82zo+kQyDfL1P5E38igdWJ2rPtcw4DwNu7jDbibjOfmDc FLIrRrdUF4AZibfF3DJVJJ5Rw1tu2ztDM7q8GLSULRCjFpeKTEyMvm2jc5Iw4MYHMNeY jgaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Kgx6EoNM; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be1-20020a1709070a4100b0078def5c29e3si1681774ejc.596.2022.11.17.14.17.28; Thu, 17 Nov 2022 14:17:58 -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=Kgx6EoNM; 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 S241062AbiKQWF6 (ORCPT + 99 others); Thu, 17 Nov 2022 17:05:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235118AbiKQWFX (ORCPT ); Thu, 17 Nov 2022 17:05:23 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B03D7211D for ; Thu, 17 Nov 2022 14:04:12 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id f126-20020a255184000000b006cb2aebd124so2788001ybb.11 for ; Thu, 17 Nov 2022 14:04:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=E/8tcV65NVEwS5qyaLKJ1YnmWVyteYUi8du6gRZPUlk=; b=Kgx6EoNMCudu+OzIdeTfFZaqIVftUAqRW1zo0L+decJ8pEy4/MJC04RnVF7B3KaSZ0 9DK6SxFeAkYNS2w805K2pZXeMVzoTc9+n6i2fomVEFwYh2ahmKGbpB2ptalb+xwgnM+v 1ylGsq+GKD4GqKY+1TF2ywPbbApmanEIDMq5tcF3WNAgugTiNNfif10EuJfPJgvXpQ6G 7DeyxMVQCZjmmpaJM90lNPVsHLhy/uLYINj6B+GbWvdd6u1xI+83ksDlrJ5xrJCL4O8O iQDbVQKNrBr/EN9pK3y4nLsiMZ4yZ/q7eFSymuqkuEkcNrP8HCciHbuAMrDf+BvQnlM4 /3AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E/8tcV65NVEwS5qyaLKJ1YnmWVyteYUi8du6gRZPUlk=; b=n8o8BDgVKTDWb2dUfxAvYCpOXe6MGUYEfofVjrKRjoN+2PTsRNPGXu7+6G7WlrbmVa P9CMj1UFqOz0PrIa/MyFwmPgf8O5ZsRPsNdrMCpQ37r0Zm958ViPN23BWuG1f/PsziRg Z2z/OpUIRf2/h/vGdPV7YuZhYbMxjYHQwW1dynA2hKVW9NPj4XQmGjruFmF9chiHh0i1 WGXaT6bGbYaPrfCRAorL+NWTRsm1It8HBQcdYxSAxCb8M0MxmExEVLxeZuvMaYG0Xqcd BVH3Lx4wwDFPgIqYD+9b0hEdDSWkYP1uSjtgyMVGqroKhHjG44znTDTWniSmvFcLxQJD o8Eg== X-Gm-Message-State: ANoB5pn2fo6HeOYhKfYJhHf946+ikm9e5APyrTrMcK0CF41TjtH3tmMQ S+hyRx0dJcC2M6GujVfxtz2lyu8kFcyu X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3f1e:c462:d6b8:fba8]) (user=irogers job=sendgmr) by 2002:a81:5d5:0:b0:36a:d4df:c6b6 with SMTP id 204-20020a8105d5000000b0036ad4dfc6b6mr3879537ywf.18.1668722651796; Thu, 17 Nov 2022 14:04:11 -0800 (PST) Date: Thu, 17 Nov 2022 14:03:39 -0800 In-Reply-To: <20221117220339.341290-1-irogers@google.com> Message-Id: <20221117220339.341290-4-irogers@google.com> Mime-Version: 1.0 References: <20221117220339.341290-1-irogers@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Subject: [PATCH v1 3/3] objtool: Alter how HOSTCC is forced From: Ian Rogers To: Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Stephane Eranian , Andrii Nakryiko , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749783389999591782?= X-GMAIL-MSGID: =?utf-8?q?1749783389999591782?= HOSTCC is always wanted when building objtool. 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. To avoid mixing CFLAGS from different compilers just the objtool CFLAGS are determined. HOSTCFLAGS is added to these so that command line flags can add to the CFLAGS. Signed-off-by: Ian Rogers --- tools/objtool/Makefile | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 6b6c20ba5160..c9992d73617f 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -2,16 +2,12 @@ include ../scripts/Makefile.include include ../scripts/Makefile.arch -# always use the host compiler -AR = $(HOSTAR) -CC = $(HOSTCC) -LD = $(HOSTLD) - ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif +MAKE = make -S LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ ifneq ($(OUTPUT),) LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd @@ -36,13 +32,20 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/objtool/include \ -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \ -I$(LIBSUBCMD_OUTPUT)/include -WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs -CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) -LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) +WARNINGS := -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs +OBJTOOL_CFLAGS := -Werror $(WARNINGS) -g $(INCLUDES) $(LIBELF_FLAGS) $(HOSTCFLAGS) +OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) # Allow old libelf to be used: elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) -CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) +OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) + +# Always want host compilation. +HOST_OVERRIDES := CC="$(HOSTCC)" EXTRA_CFLAGS="$(OBJTOOL_CFLAGS)" \ + LD="$(HOSTLD)" AR="$(HOSTAR)" +BUILD_HOST_OVERRIDES := CC="$(HOSTCC)" CFLAGS="$(OBJTOOL_CFLAGS)" \ + LD="$(HOSTLD)" LDFLAGS="$(OBJTOOL_LDFLAGS)" \ + AR="$(HOSTAR)" AWK = awk MKDIR = mkdir @@ -65,10 +68,11 @@ include $(srctree)/tools/build/Makefile.include $(OBJTOOL_IN): fixdep FORCE $(Q)$(CONFIG_SHELL) ./sync-check.sh - $(Q)$(MAKE) $(build)=objtool + $(Q)$(MAKE) $(build)=objtool $(BUILD_HOST_OVERRIDES) + $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) - $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ + $(QUIET_LINK)$(HOSTCC) $(OBJTOOL_IN) $(KBUILD_HOSTLDFLAGS) $(OBJTOOL_LDFLAGS) -o $@ $(LIBSUBCMD_OUTPUT): @@ -77,6 +81,7 @@ $(LIBSUBCMD_OUTPUT): $(LIBSUBCMD): fixdep FORCE $(LIBSUBCMD_OUTPUT) $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= \ + $(HOST_OVERRIDES) \ $@ install_headers $(LIBSUBCMD)-clean: