Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4477493rwb; Tue, 6 Sep 2022 08:05:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR5HIMRejtcRf9UvDg/hHrU2PMY4gDW91ptiHCRoSUrWkYW4zzmAYHMBZs6/IjzRDaqF0ZQX X-Received: by 2002:a17:902:f790:b0:170:d401:66d2 with SMTP id q16-20020a170902f79000b00170d40166d2mr54616417pln.124.1662476705191; Tue, 06 Sep 2022 08:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476705; cv=none; d=google.com; s=arc-20160816; b=Oos6eEL/FSU5KPHwRg3hoQy8s1tuGx8Sl1aiapX6Q9kgvLXLlsRZEeHbvQGLQlBCUw S7Ncb8HzqA7WldTRR/cwwnORkvloUIqk/792aqEG0H8WDKfY1SpVWBfIZXN4E1r+Yo35 Yazrdr6ifwVJIFCI+znNm6Hb2Zrv5dAMuRO8av70aSQeMLFKe87foZq1bzutSwyb8LAv dXA6jf7Dh88gevQDXewN0qbooKkCWqED8GfSDucllMA8FWEfeEDK1wCS6ooTa1x3YONb Yc4GlNeAkc4mw300JUIVZtyALxZKFo2SR4WAjW3EUuwHUhalDhoTu4z9xKMAt7az+1tT fFcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e5ngroV3h4jwiufqSTFgPtmGhJldpYZX0aIUkzJw9PI=; b=wnzUnaWnrn0d+25xJDAUcrO06PXp6lrV8+DYfdfi2rNIxo9RAijDIU4dkkUPEkOBvR 0SfNcJZPTmacrQFKUZgZaF8t9BIhx52EikBWVIoaXzzofCTtGi1yOw7qAkM95PVrwfF2 V1KwRFEAkgtvLOJXR5A1FNzLROX9dQtAnHUvdWWBTZXW61/VYKVG6Awy+es4H3VAhNPi gObC2Cl/YkR08eRj2oxwTy0/M2cqCsWAcImKjzmyGCNWKUwN/NfAwRQRrKue55kcHsz1 JmcVhnbhNd0NGV0wO4PDS4N3mSxAdfb+GAHavesnYVjFHoEtdJHmWamppI5KoklK1JXu bdUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FM0xUfKV; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 199-20020a6302d0000000b00434277cd636si10469193pgc.414.2022.09.06.08.04.54; Tue, 06 Sep 2022 08:05:05 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=FM0xUfKV; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240476AbiIFOA3 (ORCPT + 99 others); Tue, 6 Sep 2022 10:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239014AbiIFN4Z (ORCPT ); Tue, 6 Sep 2022 09:56:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA12D81B2D; Tue, 6 Sep 2022 06:42:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6803C614C9; Tue, 6 Sep 2022 13:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A48CC433D7; Tue, 6 Sep 2022 13:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471685; bh=Xt26qhiog42++afoF8PkB8vPyUpXbYVlMImYk5r6XAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FM0xUfKVMRpWzH327GizLUYjiKv8wgCke5uBZCE1vu+KsMJsBW/VDVJ1cvZWnxmMh zhAxQhQyU4/mXqWYkqT5AIS4uwT7cfyiEgyGycX0WfBrEpO8s/V6Hl6gaXkR0pWalx FYbBlVT6kbjzDikPPUlitNRUmBxu9/egy+7u2G8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Olsa , Andrii Nakryiko Subject: [PATCH 5.15 101/107] kbuild: Unify options for BTF generation for vmlinux and modules Date: Tue, 6 Sep 2022 15:31:22 +0200 Message-Id: <20220906132826.130642856@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132821.713989422@linuxfoundation.org> References: <20220906132821.713989422@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Jiri Olsa commit e27f05147bff21408c1b8410ad8e90cd286e7952 upstream. Using new PAHOLE_FLAGS variable to pass extra arguments to pahole for both vmlinux and modules BTF data generation. Adding new scripts/pahole-flags.sh script that detect and prints pahole options. [ fixed issues found by kernel test robot ] Signed-off-by: Jiri Olsa Signed-off-by: Andrii Nakryiko Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211029125729.70002-1-jolsa@kernel.org Signed-off-by: Greg Kroah-Hartman --- Makefile | 3 +++ scripts/Makefile.modfinal | 2 +- scripts/link-vmlinux.sh | 11 +---------- scripts/pahole-flags.sh | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100755 scripts/pahole-flags.sh --- a/Makefile +++ b/Makefile @@ -480,6 +480,8 @@ LZ4 = lz4c XZ = xz ZSTD = zstd +PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh) + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) NOSTDINC_FLAGS := @@ -534,6 +536,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAG export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL +export PAHOLE_FLAGS # Files to ignore in find ... statements --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -40,7 +40,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ quiet_cmd_btf_ko = BTF [M] $@ cmd_btf_ko = \ if [ -f vmlinux ]; then \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \ + LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ else \ printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ fi; --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -211,7 +211,6 @@ vmlinux_link() gen_btf() { local pahole_ver - local extra_paholeopt= if ! [ -x "$(command -v ${PAHOLE})" ]; then echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available" @@ -226,16 +225,8 @@ gen_btf() vmlinux_link ${1} - if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then - # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars - extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars" - fi - if [ "${pahole_ver}" -ge "121" ]; then - extra_paholeopt="${extra_paholeopt} --btf_gen_floats" - fi - info "BTF" ${2} - LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${extra_paholeopt} ${1} + LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1} # Create ${2} which contains just .BTF section but no symbols. Add # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all --- /dev/null +++ b/scripts/pahole-flags.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +extra_paholeopt= + +if ! [ -x "$(command -v ${PAHOLE})" ]; then + exit 0 +fi + +pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/') + +if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then + # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars" +fi +if [ "${pahole_ver}" -ge "121" ]; then + extra_paholeopt="${extra_paholeopt} --btf_gen_floats" +fi + +echo ${extra_paholeopt}