From patchwork Mon Mar 15 13:52:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 401493 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 8DFBCC2BA1A for ; Mon, 15 Mar 2021 13:59:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BC2864F3F for ; Mon, 15 Mar 2021 13:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbhCON70 (ORCPT ); Mon, 15 Mar 2021 09:59:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhCON6X (ORCPT ); Mon, 15 Mar 2021 09:58:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E42B664F12; Mon, 15 Mar 2021 13:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816701; bh=9CV0ZSnjWWhvIHdvkEWgDCT3NYALRwpERTnLsQQyn3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pj8YgrS/E4djL59U2zIyqRwA9YLVOpSQFW0M2D9mt7Gm30qoZTqppnQCISq959cYy WvsK34r658SRlxK0KSfXdX9kE6l19C0AHsc2ChvDLR5j0TUEVS+tk7RARtLfEMU+lg 5fkGyyDloZnvOXB6jRIO+BY0IwEVsba/ShOnY0qU= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kun-Chuan Hsieh , Daniel Borkmann , Jiri Olsa Subject: [PATCH 5.10 064/290] tools/resolve_btfids: Fix build error with older host toolchains Date: Mon, 15 Mar 2021 14:52:37 +0100 Message-Id: <20210315135544.077842633@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greg Kroah-Hartman From: Kun-Chuan Hsieh commit 41462c6e730ca0e63f5fed5a517052385d980c54 upstream. Older libelf.h and glibc elf.h might not yet define the ELF compression types. Checking and defining SHF_COMPRESSED fix the build error when compiling with older toolchains. Also, the tool resolve_btfids is compiled with host toolchain. The host toolchain is more likely to be older than the cross compile toolchain. Fixes: 51f6463aacfb ("tools/resolve_btfids: Fix sections with wrong alignment") Signed-off-by: Kun-Chuan Hsieh Signed-off-by: Daniel Borkmann Acked-by: Jiri Olsa Link: https://lore.kernel.org/bpf/20210224052752.5284-1-jetswayss@gmail.com Signed-off-by: Greg Kroah-Hartman --- tools/bpf/resolve_btfids/main.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -258,6 +258,11 @@ static struct btf_id *add_symbol(struct return btf_id__add(root, id, false); } +/* Older libelf.h and glibc elf.h might not yet define the ELF compression types. */ +#ifndef SHF_COMPRESSED +#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ +#endif + /* * The data of compressed section should be aligned to 4 * (for 32bit) or 8 (for 64 bit) bytes. The binutils ld