btf_encoder: Pass the base BTF object to the BTF encoder

We'll get rid of the 'base_btf' global variable in libbtf.c, so stop
using it in the BTF encoder.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-02 09:32:56 -03:00
parent 81797a00fb
commit f93e05d8bd
3 changed files with 4 additions and 3 deletions

View File

@ -467,7 +467,7 @@ static bool has_arg_names(struct cu *cu, struct ftype *ftype)
return true;
}
int cu__encode_btf(struct cu *cu, int verbose, bool force,
int cu__encode_btf(struct cu *cu, struct btf *base_btf, int verbose, bool force,
bool skip_encoding_vars, const char *detached_btf_filename)
{
uint32_t type_id_off;

View File

@ -9,11 +9,12 @@
Copyright (C) Arnaldo Carvalho de Melo <acme@redhat.com>
*/
struct btf;
struct cu;
int btf_encoder__encode(const char *filename);
int cu__encode_btf(struct cu *cu, int verbose, bool force,
int cu__encode_btf(struct cu *cu, struct btf *base_btf, int verbose, bool force,
bool skip_encoding_vars, const char *detached_btf_filename);
#endif /* _BTF_ENCODER_H_ */

View File

@ -2465,7 +2465,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
goto filter_it;
if (btf_encode) {
if (cu__encode_btf(cu, global_verbose, btf_encode_force,
if (cu__encode_btf(cu, base_btf, global_verbose, btf_encode_force,
skip_encoding_btf_vars, detached_btf_filename)) {
fprintf(stderr, "Encountered error while encoding BTF.\n");
exit(1);