The parent encoder will be used to share details of local functions such that we can mark those which have optimized parameters in any CU. Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> --- btf_encoder.c | 4 +++- btf_encoder.h | 2 +- pahole.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/btf_encoder.c b/btf_encoder.c index 15a042c..449439f 100644 --- a/btf_encoder.c +++ b/btf_encoder.c @@ -49,6 +49,7 @@ struct var_info { */ struct btf_encoder { struct list_head node; + struct btf_encoder *parent; struct btf *btf; struct cu *cu; struct gobuffer percpu_secinfo; @@ -1433,11 +1434,12 @@ out: return err; } -struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool skip_encoding_vars, bool force, bool gen_floats, bool verbose) +struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool skip_encoding_vars, bool force, bool gen_floats, struct btf_encoder *parent, bool verbose) { struct btf_encoder *encoder = zalloc(sizeof(*encoder)); if (encoder) { + encoder->parent = parent; encoder->raw_output = detached_filename != NULL; encoder->filename = strdup(encoder->raw_output ? detached_filename : cu->filename); if (encoder->filename == NULL) diff --git a/btf_encoder.h b/btf_encoder.h index a65120c..fd5a97f 100644 --- a/btf_encoder.h +++ b/btf_encoder.h @@ -16,7 +16,7 @@ struct btf; struct cu; struct list_head; -struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool skip_encoding_vars, bool force, bool gen_floats, bool verbose); +struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool skip_encoding_vars, bool force, bool gen_floats, struct btf_encoder *parent, bool verbose); void btf_encoder__delete(struct btf_encoder *encoder); int btf_encoder__encode(struct btf_encoder *encoder); diff --git a/pahole.c b/pahole.c index 6f4f87c..844d502 100644 --- a/pahole.c +++ b/pahole.c @@ -3037,7 +3037,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu, * create it. */ btf_encoder = btf_encoder__new(cu, detached_btf_filename, conf_load->base_btf, skip_encoding_btf_vars, - btf_encode_force, btf_gen_floats, global_verbose); + btf_encode_force, btf_gen_floats, NULL, global_verbose); if (btf_encoder && thr_data) { struct thread_data *thread = thr_data; @@ -3069,6 +3069,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu, skip_encoding_btf_vars, btf_encode_force, btf_gen_floats, + btf_encoder, global_verbose); thread->btf = btf_encoder__btf(thread->encoder); } -- 1.8.3.1