Re: [PATCH] btf_encoder: Make BTF_KIND_TAG conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Thu, Oct 14, 2021 at 02:20:49PM -0700, Ian Rogers escreveu:
> BTF_KIND_TAG is present in libbtf 6.0 but not libbtf in 5.15rc4. Make
> the code requiring it conditionally compiled in.

Thanks, applied.

I just removed the part updating lib/bpf, as I have updated it recently:

⬢[acme@toolbox pahole]$ git show cc6c7d473d51832490aa7b743a0ed7f7f9e05592
commit cc6c7d473d51832490aa7b743a0ed7f7f9e05592
Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Date:   Thu Oct 14 16:27:07 2021 -0300

    Update libbpf to get API to combine BTF
    
    I.e. the one in:
    
     13ebb60ab66799ab libbpf: Add API that copies all BTF types from one BTF object to another
    
    This will be used to paralellize the BTF encoding phase.
    
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

diff --git a/lib/bpf b/lib/bpf
index 980777cc16db75d5..92c1e61a605410b1 160000
--- a/lib/bpf
+++ b/lib/bpf
@@ -1 +1 @@
-Subproject commit 980777cc16db75d5628a537c892aefc2640bb242
+Subproject commit 92c1e61a605410b16d6330fdd4a7a4e03add86d4
⬢[acme@toolbox pahole]$ git log --oneline -3
cad8b8b840d621cd (HEAD -> master) btf_encoder: Make BTF_KIND_TAG conditional
a9c99e98815f06bd dwarves: Introduce conf_load->thread_exit() callback
cc6c7d473d518324 Update libbpf to get API to combine BTF
⬢[acme@toolbox pahole]$

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
>  btf_encoder.c | 7 +++++++
>  lib/bpf       | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/btf_encoder.c b/btf_encoder.c
> index c341f95..400d64b 100644
> --- a/btf_encoder.c
> +++ b/btf_encoder.c
> @@ -141,7 +141,9 @@ static const char * const btf_kind_str[NR_BTF_KINDS] = {
>  	[BTF_KIND_VAR]          = "VAR",
>  	[BTF_KIND_DATASEC]      = "DATASEC",
>  	[BTF_KIND_FLOAT]        = "FLOAT",
> +#ifdef BTF_KIND_TAG /* BTF_KIND_TAG was added in 6.0 */
>  	[BTF_KIND_TAG]          = "TAG",
> +#endif
>  };
>  
>  static const char *btf__printable_name(const struct btf *btf, uint32_t offset)
> @@ -648,6 +650,7 @@ static int32_t btf_encoder__add_datasec(struct btf_encoder *encoder, const char
>  static int32_t btf_encoder__add_tag(struct btf_encoder *encoder, const char *value, uint32_t type,
>  				    int component_idx)
>  {
> +#ifdef BTF_KIND_TAG /* Proxy for libbtf 6.0 */
>  	struct btf *btf = encoder->btf;
>  	const struct btf_type *t;
>  	int32_t id;
> @@ -663,6 +666,10 @@ static int32_t btf_encoder__add_tag(struct btf_encoder *encoder, const char *val
>  	}
>  
>  	return id;
> +#else
> +        fprintf(stderr, "error: unable to encode BTF_KIND_TAG due to old libbtf\n");
> +        return -ENOTSUP;
> +#endif
>  }
>  
>  /*
> diff --git a/lib/bpf b/lib/bpf
> index 980777c..986962f 160000
> --- a/lib/bpf
> +++ b/lib/bpf
> @@ -1 +1 @@
> -Subproject commit 980777cc16db75d5628a537c892aefc2640bb242
> +Subproject commit 986962fade5dfa89c2890f3854eb040d2a64ab38
> -- 
> 2.33.0.1079.g6e70778dc9-goog



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux