mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 18:40:10 +00:00
modpost: Get proper section index by get_secindex() instead of st_shndx
commit4b8a5cfb5fupstream. (uint16_t) st_shndx is limited to 65535(i.e. SHN_XINDEX) so sym_get_data() gets wrong section index by st_shndx if requested symbol contains extended section index that is more than 65535. In this case, we need to get proper section index by .symtab_shndx section. Module.symvers generated by building kernel with "-ffunction-sections -fdata-sections" shows the issue. Fixes:56067812d5("kbuild: modversions: add infrastructure for emitting relative CRCs") Fixes:e84f9fbbec("modpost: refactor namespace_from_kstrtabns() to not hard-code section name") Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
492b7e9392
commit
c325c96b4b
@@ -307,7 +307,8 @@ static const char *sec_name(struct elf_info *elf, int secindex)
|
|||||||
|
|
||||||
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
Elf_Shdr *sechdr = &info->sechdrs[sym->st_shndx];
|
unsigned int secindex = get_secindex(info, sym);
|
||||||
|
Elf_Shdr *sechdr = &info->sechdrs[secindex];
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
|
|
||||||
offset = sym->st_value;
|
offset = sym->st_value;
|
||||||
|
|||||||
Reference in New Issue
Block a user