[2/2] abg-ctf-reader: use the right string table for CTF data

Message ID 20211110125050.15529-2-jose.marchesi@oracle.com
State New
Headers
Series [1/2] elf_helpers: new utility function find_strtab_for_symtab_section |

Commit Message

Jose E. Marchesi Nov. 10, 2021, 12:50 p.m. UTC
  The CTF library needs the string table associated with the symbol
table of the ELF file.  This patch makes the CTF reader to use the
right string table.

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

	* src/abg-ctf-reader.cc (slurp_elf_info): Use
	find_strtab_for_symtab_section.
---
 src/abg-ctf-reader.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Dodji Seketeli Nov. 10, 2021, 3:54 p.m. UTC | #1
"Jose E. Marchesi via Libabigail" <libabigail@sourceware.org> a écrit:

> The CTF library needs the string table associated with the symbol
> table of the ELF file.  This patch makes the CTF reader to use the
> right string table.
>
> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
>
> 	* src/abg-ctf-reader.cc (slurp_elf_info): Use
> 	find_strtab_for_symtab_section.

Applied to master.  Thanks!

Cheers,
  

Patch

diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc
index 51fb2ed9..27eddc2e 100644
--- a/src/abg-ctf-reader.cc
+++ b/src/abg-ctf-reader.cc
@@ -1040,7 +1040,8 @@  slurp_elf_info(read_context *ctxt, corpus_sptr corp)
   /* Get the raw ELF section contents for libctf.  */
   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);
+  Elf_Scn *strtab_scn = elf_helpers::find_strtab_for_symtab_section(ctxt->elf_handler,
+                                                                    symtab_scn);
 
   if (ctf_scn == NULL || symtab_scn == NULL || strtab_scn == NULL)
     return 0;