public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Kun-Chuan Hsieh <jetswayss@gmail.com>
To: ast@kernel.org
Cc: bpf@vger.kernel.org, jolsa@kernel.org, andrii@kernel.org,
	Kun-Chuan Hsieh <jetswayss@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH v2] tools/resolve_btfids: Fix build error with older host toolchains
Date: Wed, 24 Feb 2021 05:27:52 +0000	[thread overview]
Message-ID: <20210224052752.5284-1-jetswayss@gmail.com> (raw)

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.

Cc: stable@vger.kernel.org

Signed-off-by: Kun-Chuan Hsieh <jetswayss@gmail.com>
---
 tools/bpf/resolve_btfids/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index 7409d7860aa6..80d966cfcaa1 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -260,6 +260,11 @@ static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size)
 	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
-- 
2.25.1


             reply	other threads:[~2021-02-24  5:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24  5:27 Kun-Chuan Hsieh [this message]
2021-02-24  8:32 ` [PATCH v2] tools/resolve_btfids: Fix build error with older host toolchains Jiri Olsa
2021-02-24 16:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224052752.5284-1-jetswayss@gmail.com \
    --to=jetswayss@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jolsa@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox