public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: Dodji Seketeli <dodji@seketeli.org>
Cc: "Jose E. Marchesi via Libabigail" <libabigail@sourceware.org>
Subject: Re: [PATCH V2] ctf: make libabigail::ctf_reader::read_corpus reentrant
Date: Wed, 10 Nov 2021 13:08:50 +0100	[thread overview]
Message-ID: <87mtmc5i25.fsf@oracle.com> (raw)
In-Reply-To: <877ddh8vd7.fsf@seketeli.org> (Dodji Seketeli's message of "Tue,  09 Nov 2021 11:40:52 +0100")


> "Jose E. Marchesi via Libabigail" <libabigail@sourceware.org> a écrit:
>
>> [Changes from V1:
>> - Make sure that the string table passed to libctf is the one related
>>   to the symbol table.]
>
>
> Pffft.
>
> I mistakenly applied the V1 patch to master, sorry about that.

Nah it is my fault.  I should have sent the right version straight away
:)

> So I am providing below a "differential" patch that would bring master
> to the level of this V2 patch.
>
> Would you mind reviewing it, please, (and sign it off) so that I can
> apply it master as well?

LGTM.

>
> Thanks, and sorry again.
>
> Cheers,
>
> From b3e9ff53879939a3e0d4092ecd23cbd39393c268 Mon Sep 17 00:00:00 2001
> From: Dodji Seketeli <dodji@redhat.com>
> Date: Tue, 9 Nov 2021 11:24:16 +0100
> Subject: [PATCH] ctf-reader: Use the string table related to the symtab
>
> There can be several string tables in the ELF file.  The one we want
> to use is the one related to the symbol table, referred to by its
> sh_link property.
>
> This patch ensures that.
>
> 	* src/abg-ctf-reader.cc (slurp_elf_info): Use the string table
> 	related to the symbol table.
>
> Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>

> ---
>  src/abg-ctf-reader.cc | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc
> index 51fb2ed9..33642821 100644
> --- a/src/abg-ctf-reader.cc
> +++ b/src/abg-ctf-reader.cc
> @@ -1037,12 +1037,20 @@ slurp_elf_info(read_context *ctxt, corpus_sptr corp)
>                                  0 /* No suppressions.  */);
>    corp->set_symtab(ctxt->symtab);
>  
> -  /* Get the raw ELF section contents for libctf.  */
> +  /* Get the raw ELF section contents for libctf.  The .ctf section
> +     and the symtab are straightforward enough.  */
>    Elf_Scn *ctf_scn = elf_helpers::find_section(ctxt->elf_handler, ".ctf", SHT_PROGBITS);
>    Elf_Scn *symtab_scn = elf_helpers::find_symbol_table_section(ctxt->elf_handler);
> -  Elf_Scn *strtab_scn = elf_helpers::find_section(ctxt->elf_handler, SHT_STRTAB);
>  
> -  if (ctf_scn == NULL || symtab_scn == NULL || strtab_scn == NULL)
> +  if (ctf_scn == NULL || symtab_scn == NULL)
> +    return 0;
> +
> +  /* The string table that libctf expects is the one related to the
> +     symbol table by virtue of sh_link.  */
> +  GElf_Shdr symtab_shdr_mem, *symtab_shdr = gelf_getshdr(symtab_scn, &symtab_shdr_mem);
> +  Elf_Scn *strtab_scn = elf_getscn(ctxt->elf_handler, symtab_shdr->sh_link);
> +
> +  if (strtab_scn == NULL)
>      return 0;
>  
>    fill_ctf_section(ctxt, ctf_scn, &ctxt->ctf_sect);
> -- 
>
> 2.32.0

  reply	other threads:[~2021-11-10 12:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 13:58 Jose E. Marchesi
2021-11-05 12:43 ` Jose E. Marchesi
2021-11-09 10:40 ` Dodji Seketeli
2021-11-10 12:08   ` Jose E. Marchesi [this message]
2021-11-10 12:15     ` Jose E. Marchesi

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=87mtmc5i25.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=dodji@seketeli.org \
    --cc=libabigail@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).