btf_encoder: Move the global btf_encoder to its users, like pahole

Tools should instantiate it using btf_encoder__new(), etc, ditch the
library global.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-08 15:38:48 -03:00
parent fa849010b4
commit 46a3e3a87a
3 changed files with 1 additions and 4 deletions

View File

@ -269,8 +269,6 @@ static int btf_encoder__encode_tag(struct btf_encoder *encoder, struct cu *cu, s
}
}
struct btf_encoder *encoder;
static int btf__encode_as_raw_file(struct btf *btf, const char *filename)
{
uint32_t raw_btf_size;

View File

@ -53,8 +53,6 @@ struct btf_encoder {
extern bool btf_encoder__verbose;
extern struct btf_encoder *encoder;
struct btf_encoder *btf_encoder__new(struct cu *cu, struct btf *base_btf, bool skip_encoding_vars, bool force, bool verbose);
void btf_encoder__delete(struct btf_encoder *encoder);

View File

@ -26,6 +26,7 @@
#include "lib/bpf/src/libbpf.h"
#include "pahole_strings.h"
static struct btf_encoder *encoder;
static char *detached_btf_filename;
static bool btf_encode;
static bool ctf_encode;