Re: [PATCH v2 bpf-next 07/13] resolve_btfids: use .BTF.base ELF section as base BTF if -B option is used

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

 



On Wed, 2024-04-24 at 16:48 +0100, Alan Maguire wrote:

[...]

> @@ -532,11 +533,26 @@ static int symbols_resolve(struct object *obj)
>  	__u32 nr_types;
>  
>  	if (obj->base_btf_path) {
> -		base_btf = btf__parse(obj->base_btf_path, NULL);
> +		LIBBPF_OPTS(btf_parse_opts, optp);
> +		const char *path;
> +
> +		if (obj->base) {
> +			optp.btf_sec = BTF_BASE_ELF_SEC;
> +			path = obj->path;
> +			base_btf = btf__parse_opts(path, &optp);
> +			/* fall back to normal base parsing if no BTF_BASE_ELF_SEC */
> +			if (libbpf_get_error(base_btf))
> +				base_btf = NULL;

Should this be a fatal error?
Since user requested '-B' explicitly?

> +		}
> +		if (!base_btf) {
> +			optp.btf_sec = BTF_ELF_SEC;
> +			path = obj->base_btf_path;
> +			base_btf = btf__parse_opts(path, &optp);
> +		}
>  		err = libbpf_get_error(base_btf);
>  		if (err) {
>  			pr_err("FAILED: load base BTF from %s: %s\n",
> -			       obj->base_btf_path, strerror(-err));
> +			       path, strerror(-err));
>  			return -1;
>  		}
>  	}

[...]





[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