diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-11-20 23:07:43 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-11-24 16:58:45 -0800 |
commit | 393cdfbee809891dc6ba859a44cc6441fa8dce9e (patch) | |
tree | 1f046a91c4fdc56fabf6559e47fd5793a08df058 /tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c | |
parent | libbpf: Fix various errors and warning reported by checkpatch.pl (diff) | |
download | linux-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 'tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c b/tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c index 738b34b72655..edc0f7c9e56d 100644 --- a/tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.c +++ b/tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct.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_bitfields { /* unsigned bitfields */ |