Skip to content

Commit

Permalink
Merge branch 'libbpf-global-vars'
Browse files Browse the repository at this point in the history
Andrii Nakryiko says:

====================
This patch set salvages all the non-extern-specific changes out of blocked
externs patch set ([0]). In addition to small clean ups, it also refactors
libbpf's handling of relocations and allows support for global (non-static)
variables.

  [0] https://patchwork.ozlabs.org/project/netdev/list/?series=143358&state=*
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Alexei Starovoitov committed Nov 25, 2019
2 parents a8fdaad + 393cdfb commit 1f60750
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 161 deletions.
292 changes: 158 additions & 134 deletions tools/lib/bpf/libbpf.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ $(OUTPUT)/flow_dissector_load.o: flow_dissector_load.h
define CLANG_BPF_BUILD_RULE
($(CLANG) $3 -O2 -target bpf -emit-llvm \
-c $1 -o - || echo "BPF obj compilation failed") | \
$(LLC) -march=bpf -mcpu=probe $4 -filetype=obj -o $2
$(LLC) -mattr=dwarfris -march=bpf -mcpu=probe $4 -filetype=obj -o $2
endef
# Similar to CLANG_BPF_BUILD_RULE, but with disabled alu32
define CLANG_NOALU32_BPF_BUILD_RULE
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_arrays_output {
int a2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_existence.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_existence_output {
int a_exists;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_flavors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_flavors {
int a;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_ints.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_ints {
uint8_t u8_field;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_kernel_output {
int valid[10];
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_misc_output {
int a, b, c;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_mods.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_mods_output {
int a, b, c, d, e, f, g, h;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_nesting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_nesting_substruct {
int a;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

char _license[] SEC("license") = "GPL";

static volatile struct data {
struct {
char in[256];
char out[256];
} data;
} data = {};

enum core_reloc_primitives_enum {
A = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_ptr_as_arr {
int a;
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/progs/test_core_reloc_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1f60750

Please sign in to comment.