summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/module.h
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2022-08-30 13:48:31 +0300
committerCatalin Marinas <catalin.marinas@arm.com>2022-09-09 14:27:25 +0300
commitb3adc3844e1dedd05fa8d09633eaa8ddc5ddcece (patch)
treee34bd3354ff0026a95a81c8e88f472167daaf7af /arch/arm64/include/asm/module.h
parentb90cb1053190353cc30f0fef0ef1f378ccc063c5 (diff)
downloadlinux-b3adc3844e1dedd05fa8d09633eaa8ddc5ddcece.tar.xz
arm64: module: move find_section to header
Move it to the header so that the implementation can be shared by the alternatives code. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Cc: Will Deacon <will@kernel.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20220830104833.34636-2-joey.gouly@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/module.h')
-rw-r--r--arch/arm64/include/asm/module.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h
index 4e7fa2623896..22f1be47cc92 100644
--- a/arch/arm64/include/asm/module.h
+++ b/arch/arm64/include/asm/module.h
@@ -65,4 +65,19 @@ static inline bool plt_entry_is_initialized(const struct plt_entry *e)
return e->adrp || e->add || e->br;
}
+static inline const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
+ const Elf_Shdr *sechdrs,
+ const char *name)
+{
+ const Elf_Shdr *s, *se;
+ const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+
+ for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) {
+ if (strcmp(name, secstrs + s->sh_name) == 0)
+ return s;
+ }
+
+ return NULL;
+}
+
#endif /* __ASM_MODULE_H */