Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joey Gouly and committed by
Catalin Marinas
b3adc384 b90cb105

+15 -15
+15
arch/arm64/include/asm/module.h
··· 65 65 return e->adrp || e->add || e->br; 66 66 } 67 67 68 + static inline const Elf_Shdr *find_section(const Elf_Ehdr *hdr, 69 + const Elf_Shdr *sechdrs, 70 + const char *name) 71 + { 72 + const Elf_Shdr *s, *se; 73 + const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 74 + 75 + for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { 76 + if (strcmp(name, secstrs + s->sh_name) == 0) 77 + return s; 78 + } 79 + 80 + return NULL; 81 + } 82 + 68 83 #endif /* __ASM_MODULE_H */
-15
arch/arm64/kernel/module.c
··· 476 476 return -ENOEXEC; 477 477 } 478 478 479 - static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, 480 - const Elf_Shdr *sechdrs, 481 - const char *name) 482 - { 483 - const Elf_Shdr *s, *se; 484 - const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 485 - 486 - for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { 487 - if (strcmp(name, secstrs + s->sh_name) == 0) 488 - return s; 489 - } 490 - 491 - return NULL; 492 - } 493 - 494 479 static inline void __init_plt(struct plt_entry *plt, unsigned long addr) 495 480 { 496 481 *plt = get_plt_entry(addr, plt);