summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-05-06 22:41:13 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-05-11 15:07:17 -0700
commit37f05601eabc29f82c03b461a22d8fafacd736d2 (patch)
tree039736ac90f801217d5bb3a0689d535186f6762a /tools/bpf/bpftool
parentf4cceb783169c9f0639ce7c648a6a5de83c00dc4 (diff)
bpftool: Strip const/volatile/restrict modifiers from .bss and .data vars
Similarly to .rodata, strip any const/volatile/restrict modifiers when generating BPF skeleton. They are not helpful and actually just get in the way. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20210507054119.270888-2-andrii@kernel.org
Diffstat (limited to 'tools/bpf/bpftool')
-rw-r--r--tools/bpf/bpftool/gen.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index 31ade77f5ef8..440a2fcb6441 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -106,8 +106,10 @@ static int codegen_datasec_def(struct bpf_object *obj,
if (strcmp(sec_name, ".data") == 0) {
sec_ident = "data";
+ strip_mods = true;
} else if (strcmp(sec_name, ".bss") == 0) {
sec_ident = "bss";
+ strip_mods = true;
} else if (strcmp(sec_name, ".rodata") == 0) {
sec_ident = "rodata";
strip_mods = true;