Commit d4be60fe authored by Wedson Almeida Filho's avatar Wedson Almeida Filho Committed by Michael Ellerman

powerpc/module_64: use module_init_section instead of patching names

Without this patch, module init sections are disabled by patching their
names in arch-specific code when they're loaded (which prevents code in
layout_sections from finding init sections). This patch uses the new
arch-specific module_init_section instead.

This allows modules that have .init_array sections to have the
initialisers properly called (on load, before init). Without this patch,
the initialisers are not called because .init_array is renamed to
_init_array, and thus isn't found by code in find_module_sections().
Signed-off-by: default avatarWedson Almeida Filho <wedsonaf@google.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220202055123.2144842-1-wedsonaf@google.com
parent be7be1c6
...@@ -277,6 +277,12 @@ static Elf64_Sym *find_dot_toc(Elf64_Shdr *sechdrs, ...@@ -277,6 +277,12 @@ static Elf64_Sym *find_dot_toc(Elf64_Shdr *sechdrs,
return NULL; return NULL;
} }
bool module_init_section(const char *name)
{
/* We don't handle .init for the moment: always return false. */
return false;
}
int module_frob_arch_sections(Elf64_Ehdr *hdr, int module_frob_arch_sections(Elf64_Ehdr *hdr,
Elf64_Shdr *sechdrs, Elf64_Shdr *sechdrs,
char *secstrings, char *secstrings,
...@@ -286,7 +292,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr, ...@@ -286,7 +292,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
/* Find .toc and .stubs sections, symtab and strtab */ /* Find .toc and .stubs sections, symtab and strtab */
for (i = 1; i < hdr->e_shnum; i++) { for (i = 1; i < hdr->e_shnum; i++) {
char *p;
if (strcmp(secstrings + sechdrs[i].sh_name, ".stubs") == 0) if (strcmp(secstrings + sechdrs[i].sh_name, ".stubs") == 0)
me->arch.stubs_section = i; me->arch.stubs_section = i;
else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0) { else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0) {
...@@ -298,10 +303,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr, ...@@ -298,10 +303,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
dedotify_versions((void *)hdr + sechdrs[i].sh_offset, dedotify_versions((void *)hdr + sechdrs[i].sh_offset,
sechdrs[i].sh_size); sechdrs[i].sh_size);
/* We don't handle .init for the moment: rename to _init */
while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))
p[0] = '_';
if (sechdrs[i].sh_type == SHT_SYMTAB) if (sechdrs[i].sh_type == SHT_SYMTAB)
dedotify((void *)hdr + sechdrs[i].sh_offset, dedotify((void *)hdr + sechdrs[i].sh_offset,
sechdrs[i].sh_size / sizeof(Elf64_Sym), sechdrs[i].sh_size / sizeof(Elf64_Sym),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment