int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) { const Elf_Shdr *sect; int err; err = module_bug_finalize(hdr, sechdrs, me); if (err) return err; /* Apply feature fixups */ sect = find_section(hdr, sechdrs, "__ftr_fixup"); if (sect != NULL) do_feature_fixups(cur_cpu_spec->cpu_features, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); #ifdef CONFIG_PPC64 sect = find_section(hdr, sechdrs, "__fw_ftr_fixup"); if (sect != NULL) do_feature_fixups(powerpc_firmware_features, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); #endif sect = find_section(hdr, sechdrs, "__lwsync_fixup"); if (sect != NULL) do_lwsync_fixups(cur_cpu_spec->cpu_features, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); return 0; }
int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) { const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL, *para = NULL; char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { if (!strcmp(".text", secstrings + s->sh_name)) text = s; if (!strcmp(".altinstructions", secstrings + s->sh_name)) alt = s; if (!strcmp(".smp_locks", secstrings + s->sh_name)) locks= s; if (!strcmp(".parainstructions", secstrings + s->sh_name)) para = s; } if (alt) { /* patch .altinstructions */ void *aseg = (void *)alt->sh_addr; apply_alternatives(aseg, aseg + alt->sh_size); } if (locks && text) { void *lseg = (void *)locks->sh_addr; void *tseg = (void *)text->sh_addr; alternatives_smp_module_add(me, me->name, lseg, lseg + locks->sh_size, tseg, tseg + text->sh_size); } if (para) { void *pseg = (void *)para->sh_addr; apply_paravirt(pseg, pseg + para->sh_size); } return module_bug_finalize(hdr, sechdrs, me); }
int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) { return module_bug_finalize(hdr, sechdrs, me); }