* [PATCH] symtab: fix getting CRC in relocatable modules
@ 2023-01-28 0:08 vvvvvv
2023-01-31 10:09 ` Dodji Seketeli
0 siblings, 1 reply; 2+ messages in thread
From: vvvvvv @ 2023-01-28 0:08 UTC (permalink / raw)
To: libabigail; +Cc: kernel-team, maennich, vvvvvv
From: Aleksei Vetrov <vvvvvv@google.com>
In ELF with ET_REL type symbol value holds not absolute but relative to
section value. This patch applies adjustment to the address, used in CRC
value extraction.
* src/abg-elf-helpers.cc (get_crc_for_symbol): Rename
crc_symbol_value to crc_symbol_address and adjust it for
relocatable ELF types.
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
---
src/abg-elf-helpers.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/abg-elf-helpers.cc b/src/abg-elf-helpers.cc
index 5d8e3188..d61114bf 100644
--- a/src/abg-elf-helpers.cc
+++ b/src/abg-elf-helpers.cc
@@ -920,10 +920,11 @@ bool
get_crc_for_symbol(Elf* elf_handle, GElf_Sym* crc_symbol, uint32_t& crc_value)
{
size_t crc_section_index = crc_symbol->st_shndx;
- uint64_t crc_symbol_value = crc_symbol->st_value;
+ GElf_Addr crc_symbol_address =
+ maybe_adjust_et_rel_sym_addr_to_abs_addr(elf_handle, crc_symbol);
if (crc_section_index == SHN_ABS)
{
- crc_value = crc_symbol_value;
+ crc_value = crc_symbol_address;
return true;
}
@@ -940,10 +941,10 @@ get_crc_for_symbol(Elf* elf_handle, GElf_Sym* crc_symbol, uint32_t& crc_value)
if (kcrctab_data == NULL)
return false;
- if (crc_symbol_value < sheader->sh_addr)
+ if (crc_symbol_address < sheader->sh_addr)
return false;
- size_t offset = crc_symbol_value - sheader->sh_addr;
+ size_t offset = crc_symbol_address - sheader->sh_addr;
if (offset + sizeof(uint32_t) > kcrctab_data->d_size
|| offset + sizeof(uint32_t) > sheader->sh_size)
return false;
--
2.39.1.456.gfc5497dd1b-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] symtab: fix getting CRC in relocatable modules
2023-01-28 0:08 [PATCH] symtab: fix getting CRC in relocatable modules vvvvvv
@ 2023-01-31 10:09 ` Dodji Seketeli
0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2023-01-31 10:09 UTC (permalink / raw)
To: Aleksei Vetrov via Libabigail; +Cc: vvvvvv, kernel-team, maennich
Hello Aleksei,
Aleksei Vetrov via Libabigail <libabigail@sourceware.org> a écrit:
> From: Aleksei Vetrov <vvvvvv@google.com>
>
> In ELF with ET_REL type symbol value holds not absolute but relative to
> section value. This patch applies adjustment to the address, used in CRC
> value extraction.
>
> * src/abg-elf-helpers.cc (get_crc_for_symbol): Rename
> crc_symbol_value to crc_symbol_address and adjust it for
> relocatable ELF types.
>
> Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
Applied to mainline, thanks!
[...]
Cheers,
--
Dodji
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-31 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28 0:08 [PATCH] symtab: fix getting CRC in relocatable modules vvvvvv
2023-01-31 10:09 ` Dodji Seketeli
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).