diff mbox series

[v2,bpf-next,1/6] bpftool: strip const/volatile/restrict modifiers from .bss and .data vars

Message ID 20210423185357.1992756-2-andrii@kernel.org
State Superseded
Headers show
Series [v2,bpf-next,1/6] bpftool: strip const/volatile/restrict modifiers from .bss and .data vars | expand

Commit Message

Andrii Nakryiko April 23, 2021, 6:53 p.m. UTC
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>
---
 tools/bpf/bpftool/gen.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Yonghong Song April 23, 2021, 8:02 p.m. UTC | #1
On 4/23/21 11:53 AM, Andrii Nakryiko wrote:
> 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>

Acked-by: Yonghong Song <yhs@fb.com>
diff mbox series

Patch

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;