From 0de80f1a9f6e9e96ab2fffed488d6312053ffe5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 12 Mar 2024 18:21:23 -0700 Subject: [PATCH] Eliminate spurious COMPILE_FOR_BPFLOADER_VERSION macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and make platform bpf.o's target V's platform bpfloader. Note that all mainline shipped bpf.o's already manually specify BPFLOADER_MIN_VER. Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I67b73969def24e1e169c70c5fb1a402bf6e8cabc --- netbpfload/loader.cpp | 4 ---- .../native/bpf_headers/include/bpf/bpf_helpers.h | 10 ++++++++-- .../native/bpf_headers/include/bpf/bpf_map_def.h | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/netbpfload/loader.cpp b/netbpfload/loader.cpp index 30266556ac..8115008a4e 100644 --- a/netbpfload/loader.cpp +++ b/netbpfload/loader.cpp @@ -45,10 +45,6 @@ #include "bpf/bpf_map_def.h" #include "loader.h" -#if BPFLOADER_VERSION < COMPILE_FOR_BPFLOADER_VERSION -#error "BPFLOADER_VERSION is less than COMPILE_FOR_BPFLOADER_VERSION" -#endif - #include #include #include diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h index ac922cdad2..92ddf4414d 100644 --- a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h +++ b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h @@ -39,7 +39,13 @@ // Android U / 14 (api level 34) - various new program types added #define BPFLOADER_U_VERSION 37u -// Android V / 15 (api level 35) - this bpfloader should eventually go back to T +// Android V / 15 (api level 35) - platform only +// (note: the platform bpfloader in V isn't really versioned at all, +// as there is no need as it can only load objects compiled at the +// same time as itself and the rest of the platform) +#define BPFLOADER_V_VERSION 41u + +// Android Mainline - this bpfloader should eventually go back to T #define BPFLOADER_MAINLINE_VERSION 42u /* For mainline module use, you can #define BPFLOADER_{MIN/MAX}_VER @@ -51,7 +57,7 @@ * In which case it's just best to use the default. */ #ifndef BPFLOADER_MIN_VER -#define BPFLOADER_MIN_VER COMPILE_FOR_BPFLOADER_VERSION +#define BPFLOADER_MIN_VER BPFLOADER_V_VERSION #endif #ifndef BPFLOADER_MAX_VER diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h index ef03c4daad..00ef91a203 100644 --- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h +++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h @@ -48,9 +48,6 @@ #define DEFAULT_SIZEOF_BPF_MAP_DEF 32 // v0.0 struct: enum (uint sized) + 7 uint #define DEFAULT_SIZEOF_BPF_PROG_DEF 20 // v0.0 struct: 4 uint + bool + 3 byte alignment pad -// By default, unless otherwise specified, allow the use of features only supported by v0.37. -#define COMPILE_FOR_BPFLOADER_VERSION 37u - /* * The bpf_{map,prog}_def structures are compiled for different architectures. * Once by the BPF compiler for the BPF architecture, and once by a C++