This should be fixed and the patch dropped in Linux 6.9, see:
https://lore.kernel.org/bpf/Zbe3NuOgaupvUcpF@kernel.org/
--
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -23,6 +23,8 @@
 #include "json_writer.h"
 #include "main.h"

+#define basename(path) (strrchr((path),'/') ? strrchr((path),'/')+1 : (path))
+
 #define MAX_OBJ_NAME_LEN 64

 static void sanitize_identifier(char *name)
