aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/test_core_reloc_size.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-11-20 23:07:43 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-11-24 16:58:45 -0800
commit393cdfbee809891dc6ba859a44cc6441fa8dce9e (patch)
tree1f046a91c4fdc56fabf6559e47fd5793a08df058 /tools/testing/selftests/bpf/progs/test_core_reloc_size.c
parentlibbpf: Fix various errors and warning reported by checkpatch.pl (diff)
downloadlinux-dev-393cdfbee809891dc6ba859a44cc6441fa8dce9e.tar.xz
linux-dev-393cdfbee809891dc6ba859a44cc6441fa8dce9e.zip
libbpf: Support initialized global variables
Initialized global variables are no different in ELF from static variables, and don't require any extra support from libbpf. But they are matching semantics of global data (backed by BPF maps) more closely, preventing LLVM/Clang from aggressively inlining constant values and not requiring volatile incantations to prevent those. This patch enables global variables. It still disables uninitialized variables, which will be put into special COM (common) ELF section, because BPF doesn't allow uninitialized data to be accessed. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191121070743.1309473-5-andriin@fb.com
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/bpf/progs/test_core_reloc_size.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_core_reloc_size.c b/tools/testing/selftests/bpf/progs/test_core_reloc_size.c
index 9a92998d9107..9e091124d3bd 100644
--- a/tools/testing/selftests/bpf/progs/test_core_reloc_size.c
+++ b/tools/testing/selftests/bpf/progs/test_core_reloc_size.c
@@ -8,10 +8,10 @@
char _license[] SEC("license") = "GPL";
-static volatile struct data {
+struct {
char in[256];
char out[256];
-} data;
+} data = {};
struct core_reloc_size_output {
int int_sz;