All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Pawel Wieczorkiewicz <wipawel@amazon.de>, xen-devel@lists.xen.org
Cc: mpohlack@amazon.de, konrad.wilk@oracle.com
Subject: Re: [livepatch-build-tools part2 2/6] common: Add is_referenced_section() helper function
Date: Mon, 29 Apr 2019 16:14:07 +0100	[thread overview]
Message-ID: <3dc69ca8-6c12-65ab-074c-b635bd5bdaeb@citrix.com> (raw)
In-Reply-To: <20190416120716.26269-2-wipawel@amazon.de>

On 4/16/19 1:07 PM, Pawel Wieczorkiewicz wrote:
> This function checks if given section has an included corresponding
> RELA section and/or any of the symbols table symbols references the
> section. Section associated symbols are ignored here as there is
> always such a symbol for every section.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reviewed-by: Andra-Irina Paraschiv <andraprs@amazon.com>
> Reviewed-by: Bjoern Doebel <doebel@amazon.de>
> Reviewed-by: Norbert Manthey <nmanthey@amazon.de>
> ---
>   common.c | 22 +++++++++++++++++++++-
>   common.h |  1 +
>   2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/common.c b/common.c
> index 1fb07cb..c968299 100644
> --- a/common.c
> +++ b/common.c
> @@ -15,7 +15,7 @@
>   
>   int is_rela_section(struct section *sec)
>   {
> -	return (sec->sh.sh_type == SHT_RELA);
> +	return sec && (sec->sh.sh_type == SHT_RELA);
>   }
>   
>   int is_local_sym(struct symbol *sym)
> @@ -270,6 +270,26 @@ int is_standard_section(struct section *sec)
>   	}
>   }
>   
> +int is_referenced_section(const struct section *sec, const struct kpatch_elf *kelf)

Let's keep to 80 chars where practical (and throughout the rest of the 
patches).

> +{
> +	struct symbol *sym;
> +
> +	if (is_rela_section(sec->rela) && sec->rela->include)
> +		return true;
> +
> +	list_for_each_entry(sym, &kelf->symbols, list) {
> +		if (!sym->include || !sym->sec)
> +			continue;
> +		/* Ignore section associated sections */
> +		if (sym->type == STT_SECTION)
> +			continue;
> +		if (sym->sec->index == sec->index)
> +			return true;

You can simplify this check to `sym->sec == sec` like the rest of the 
code does.

-- 
Ross Lagerwall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-04-29 15:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 12:07 [livepatch-build-tools part2 1/6] common: Add is_standard_section() helper function Pawel Wieczorkiewicz
2019-04-16 12:07 ` [livepatch-build-tools part2 2/6] common: Add is_referenced_section() " Pawel Wieczorkiewicz
2019-04-29 15:14   ` Ross Lagerwall [this message]
2019-04-29 15:58     ` Wieczorkiewicz, Pawel
2019-04-16 12:07 ` [livepatch-build-tools part2 3/6] create-diff-object: Add is_special_section() " Pawel Wieczorkiewicz
2019-04-29 15:25   ` Ross Lagerwall
2019-04-30 12:18     ` Wieczorkiewicz, Pawel
2019-04-16 12:07 ` [livepatch-build-tools part2 4/6] livepatch-build: detect special section group sizes Pawel Wieczorkiewicz
2019-04-25  4:53   ` Konrad Rzeszutek Wilk
2019-04-29 14:14     ` Ross Lagerwall
2019-04-29 21:53       ` Glenn Enright
2019-04-29 14:10   ` Ross Lagerwall
2019-04-29 14:21     ` Ross Lagerwall
2019-04-29 15:19       ` Wieczorkiewicz, Pawel
2019-04-16 12:07 ` [livepatch-build-tools part2 5/6] create-diff-object: Add new entries to special sections array Pawel Wieczorkiewicz
2019-04-29 15:47   ` Ross Lagerwall
2019-04-30 13:01     ` Wieczorkiewicz, Pawel
2019-04-16 12:07 ` [livepatch-build-tools part2 6/6] create-diff-object: Do not include all .rodata sections Pawel Wieczorkiewicz
2019-04-29 16:11   ` Ross Lagerwall
2019-04-30 13:28     ` Wieczorkiewicz, Pawel
2019-04-29 15:07 ` [livepatch-build-tools part2 1/6] common: Add is_standard_section() helper function Ross Lagerwall

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=3dc69ca8-6c12-65ab-074c-b635bd5bdaeb@citrix.com \
    --to=ross.lagerwall@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=mpohlack@amazon.de \
    --cc=wipawel@amazon.de \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.