summaryrefslogtreecommitdiffstats
path: root/tools/bpf
diff options
context:
space:
mode:
authorKun-Chuan Hsieh <jetswayss@gmail.com>2021-02-24 05:27:52 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 17:06:16 +0100
commit8493877b58b6f35d643da307ee1ae920b3ddd1d8 (patch)
tree56b65584b0e41372cfbd03047eafc50dc8750497 /tools/bpf
parentee7eac24b5b495f484034cdb2bd7152edc5a985f (diff)
downloadlinux-stable-8493877b58b6f35d643da307ee1ae920b3ddd1d8.tar.gz
linux-stable-8493877b58b6f35d643da307ee1ae920b3ddd1d8.tar.bz2
linux-stable-8493877b58b6f35d643da307ee1ae920b3ddd1d8.zip
tools/resolve_btfids: Fix build error with older host toolchains
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 <jetswayss@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jiri Olsa <jolsa@redhat.com> Link: https://lore.kernel.org/bpf/20210224052752.5284-1-jetswayss@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/resolve_btfids/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index dfa540d8a02d..d636643ddd35 100644
--- 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 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