Skip to content

Commit 56acc03

Browse files
committed
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: Wedson Almeida Filho <wedsonaf@google.com>
1 parent caa5a6f commit 56acc03

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

arch/powerpc/kernel/module_64.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ static Elf64_Sym *find_dot_toc(Elf64_Shdr *sechdrs,
277277
return NULL;
278278
}
279279

280+
bool module_init_section(const char *name)
281+
{
282+
/* We don't handle .init for the moment: always return false. */
283+
return false;
284+
}
285+
280286
int module_frob_arch_sections(Elf64_Ehdr *hdr,
281287
Elf64_Shdr *sechdrs,
282288
char *secstrings,
@@ -286,7 +292,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
286292

287293
/* Find .toc and .stubs sections, symtab and strtab */
288294
for (i = 1; i < hdr->e_shnum; i++) {
289-
char *p;
290295
if (strcmp(secstrings + sechdrs[i].sh_name, ".stubs") == 0)
291296
me->arch.stubs_section = i;
292297
else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0) {
@@ -298,10 +303,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
298303
dedotify_versions((void *)hdr + sechdrs[i].sh_offset,
299304
sechdrs[i].sh_size);
300305

301-
/* We don't handle .init for the moment: rename to _init */
302-
while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))
303-
p[0] = '_';
304-
305306
if (sechdrs[i].sh_type == SHT_SYMTAB)
306307
dedotify((void *)hdr + sechdrs[i].sh_offset,
307308
sechdrs[i].sh_size / sizeof(Elf64_Sym),

0 commit comments

Comments
 (0)