Skip to content

Commit 2318976

Browse files
vwaxRussell King
authored andcommitted
ARM: 8976/1: module: allow arch overrides for .init section names
ARM stores unwind information for .init.text in sections named .ARM.extab.init.text and .ARM.exidx.init.text. Since those aren't currently recognized as init sections, they're allocated along with the core section, and relocation fails if the core and the init section are allocated from different regions and can't reach other. final section addresses: ... 0x7f800000 .init.text .. 0xcbb54078 .ARM.exidx.init.text .. section 16 reloc 0 sym '': relocation 42 out of range (0xcbb54078 -> 0x7f800000) Allow architectures to override the section name so that ARM can fix this. Acked-by: Jessica Yu <[email protected]> Signed-off-by: Vincent Whitchurch <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent cdcb07e commit 2318976

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

include/linux/moduleloader.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ void *module_alloc(unsigned long size);
2929
/* Free memory returned from module_alloc. */
3030
void module_memfree(void *module_region);
3131

32+
/* Determines if the section name is an init section (that is only used during
33+
* module loading).
34+
*/
35+
bool module_init_section(const char *name);
36+
3237
/* Determines if the section name is an exit section (that is only used during
3338
* module unloading)
3439
*/

kernel/module.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ static void layout_sections(struct module *mod, struct load_info *info)
24002400
if ((s->sh_flags & masks[m][0]) != masks[m][0]
24012401
|| (s->sh_flags & masks[m][1])
24022402
|| s->sh_entsize != ~0UL
2403-
|| strstarts(sname, ".init"))
2403+
|| module_init_section(sname))
24042404
continue;
24052405
s->sh_entsize = get_offset(mod, &mod->core_layout.size, s, i);
24062406
pr_debug("\t%s\n", sname);
@@ -2433,7 +2433,7 @@ static void layout_sections(struct module *mod, struct load_info *info)
24332433
if ((s->sh_flags & masks[m][0]) != masks[m][0]
24342434
|| (s->sh_flags & masks[m][1])
24352435
|| s->sh_entsize != ~0UL
2436-
|| !strstarts(sname, ".init"))
2436+
|| !module_init_section(sname))
24372437
continue;
24382438
s->sh_entsize = (get_offset(mod, &mod->init_layout.size, s, i)
24392439
| INIT_OFFSET_MASK);
@@ -2768,6 +2768,11 @@ void * __weak module_alloc(unsigned long size)
27682768
return vmalloc_exec(size);
27692769
}
27702770

2771+
bool __weak module_init_section(const char *name)
2772+
{
2773+
return strstarts(name, ".init");
2774+
}
2775+
27712776
bool __weak module_exit_section(const char *name)
27722777
{
27732778
return strstarts(name, ".exit");

0 commit comments

Comments
 (0)