dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Douglas RAILLARD <douglas.raillard@arm.com>
Cc: acme@redhat.com, dwarves@vger.kernel.org
Subject: Re: [PATCH v3 5/6] btf_loader.c: Propagate struct conf_load
Date: Thu, 28 Oct 2021 10:19:59 -0300	[thread overview]
Message-ID: <YXqjf+dH/Ft8iQCT@kernel.org> (raw)
In-Reply-To: <20211028122710.881181-6-douglas.raillard@arm.com>

Em Thu, Oct 28, 2021 at 01:27:09PM +0100, Douglas RAILLARD escreveu:
> From: Douglas Raillard <douglas.raillard@arm.com>
> 
> Give access to struct conf_load in class__infer_alignment.

prep patch, paving the way, thanks for doing it like that. :-)

Applied.

- Arnaldo

 
> Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
> ---
>  btf_loader.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/btf_loader.c b/btf_loader.c
> index 2885252..e500eae 100644
> --- a/btf_loader.c
> +++ b/btf_loader.c
> @@ -471,7 +471,8 @@ static int btf__load_sections(struct btf *btf, struct cu *cu)
>  	return btf__load_types(btf, cu);
>  }
>  
> -static uint32_t class__infer_alignment(uint32_t byte_offset,
> +static uint32_t class__infer_alignment(const struct conf_load *conf,
> +				       uint32_t byte_offset,
>  				       uint32_t natural_alignment,
>  				       uint32_t smallest_offset)
>  {
> @@ -497,7 +498,7 @@ static uint32_t class__infer_alignment(uint32_t byte_offset,
>  	return alignment;
>  }
>  
> -static int class__fixup_btf_bitfields(struct tag *tag, struct cu *cu)
> +static int class__fixup_btf_bitfields(const struct conf_load *conf, struct tag *tag, struct cu *cu)
>  {
>  	struct class_member *pos;
>  	struct type *tag_type = tag__type(tag);
> @@ -536,27 +537,29 @@ static int class__fixup_btf_bitfields(struct tag *tag, struct cu *cu)
>  			}
>  		}
>  
> -		pos->alignment = class__infer_alignment(pos->byte_offset,
> +		pos->alignment = class__infer_alignment(conf,
> +							pos->byte_offset,
>  							tag__natural_alignment(type, cu),
>  							smallest_offset);
>  		smallest_offset = pos->byte_offset + pos->byte_size;
>  	}
>  
> -	tag_type->alignment = class__infer_alignment(tag_type->size,
> +	tag_type->alignment = class__infer_alignment(conf,
> +						     tag_type->size,
>  						     tag__natural_alignment(tag, cu),
>  						     smallest_offset);
>  
>  	return 0;
>  }
>  
> -static int cu__fixup_btf_bitfields(struct cu *cu)
> +static int cu__fixup_btf_bitfields(const struct conf_load *conf, struct cu *cu)
>  {
>  	int err = 0;
>  	struct tag *pos;
>  
>  	list_for_each_entry(pos, &cu->tags, node)
>  		if (tag__is_struct(pos) || tag__is_union(pos)) {
> -			err = class__fixup_btf_bitfields(pos, cu);
> +			err = class__fixup_btf_bitfields(conf, pos, cu);
>  			if (err)
>  				break;
>  		}
> @@ -606,7 +609,7 @@ static int cus__load_btf(struct cus *cus, struct conf_load *conf, const char *fi
>  	if (err != 0)
>  		goto out_free;
>  
> -	err = cu__fixup_btf_bitfields(cu);
> +	err = cu__fixup_btf_bitfields(conf, cu);
>  	/*
>  	 * The app stole this cu, possibly deleting it,
>  	 * so forget about it
> -- 
> 2.25.1

-- 

- Arnaldo

  reply	other threads:[~2021-10-28 13:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 12:27 [PATCH v3 0/6] Infer BTF alignment Douglas RAILLARD
2021-10-28 12:27 ` [PATCH v3 1/6] fprintf: Fix nested struct printing Douglas RAILLARD
2021-10-28 12:40   ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 2/6] btf_loader.c: Refactor class__fixup_btf_bitfields Douglas RAILLARD
2021-10-28 13:15   ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 3/6] btf_loader.c: Infer alignment info Douglas RAILLARD
2021-10-28 13:15   ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 4/6] dwarves_fprintf: Move cacheline_size into struct conf_fprintf Douglas RAILLARD
2021-10-28 13:18   ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 5/6] btf_loader.c: Propagate struct conf_load Douglas RAILLARD
2021-10-28 13:19   ` Arnaldo Carvalho de Melo [this message]
2021-10-28 12:27 ` [PATCH v3 6/6] btf_loader.c: Use cacheline size to infer alignment Douglas RAILLARD
2021-10-28 13:24   ` Arnaldo Carvalho de Melo
2021-10-28 14:12     ` Douglas Raillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXqjf+dH/Ft8iQCT@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=douglas.raillard@arm.com \
    --cc=dwarves@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).