android_kernel_xiaomi_sm8450/include/linux/moduleloader.h
Greg Kroah-Hartman 397f70b65c This is the 5.10.194 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmTy4cgACgkQONu9yGCS
 aT5pDA//SU2uPkDkNZ7p8QEdN3tMS2PPNdhi4Pza1OsJHhBbdfVUg4u31tZJJHpx
 P4c8iLkqnGHf4AyACvhR+GpX2b8T9pXTSIdv+GHqsNVEWmctYIwHGbDJNcoKtskc
 zV3OTDjy6hySEc2fhtxIdtNlLeW2g+WMwpgivXjfkrNVBGntiu7aVBQ8e6tk4TP/
 yEDtpCPzHKBmFF2hkvimQNeAUZUPaIbnBt+bmvgrcZs0TxphQtz8Qu6jFZFuMuII
 WQycQB56mCwQty3xZkLSjL0NhIN7SZ5hjto5HzFeEuZ0ZYSO90NxUzuYLI/oTSOE
 2pwkCxGfQ5UJHEqfbCxAV1Da+Uzo++XzAtuIP2+y6BJoO8X7IuaolAS4QSjb2J9u
 C4tNH+NyGO7JM3rxCbIAc+DcdBLIV5fLe2Xnq2SdQASgBok2QKyAHpU5UDKO43r5
 hoCUbQ7DLVIChJasIwrMY7OXyI4p+AD4RJEhILa8rTi0L7hdFDgxAGdI8G48LjHt
 951Fi+5P0KJ1tnol6FUjtSbcduzfTMzfKoPhy4NdtUCjTnbProbSTPCCeH6eabpD
 73jSGFDMEwr9P/NHk4SJO74v/z/v6NfgE4os95ZI5DkC1ygVOS+8f/pUDTh3Zbhx
 KUbXhIc0oRhnOcUY/aB5ikiAy3r6fS6/BbV55amyf1LtUKOH1QQ=
 =38AI
 -----END PGP SIGNATURE-----

Merge 5.10.194 into android12-5.10-lts

Changes in 5.10.194
	module: Expose module_init_layout_section()
	arm64: module-plts: inline linux/moduleloader.h
	arm64: module: Use module_init_layout_section() to spot init sections
	ARM: module: Use module_init_layout_section() to spot init sections
	mhi: pci_generic: Fix implicit conversion warning
	Revert "drm/amdgpu: install stub fence into potential unused fence pointers"
	Revert "MIPS: Alchemy: fix dbdma2"
	rcu: Prevent expedited GP from enabling tick on offline CPU
	rcu-tasks: Fix IPI failure handling in trc_wait_for_one_reader
	rcu-tasks: Wait for trc_read_check_handler() IPIs
	rcu-tasks: Add trc_inspect_reader() checks for exiting critical section
	Linux 5.10.194

Change-Id: I1e4230071f3ca3c9e811aeba31446875028d7b3d
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-09-02 10:41:24 +00:00

113 lines
3.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_MODULELOADER_H
#define _LINUX_MODULELOADER_H
/* The stuff needed for archs to support modules. */
#include <linux/module.h>
#include <linux/elf.h>
/* These may be implemented by architectures that need to hook into the
* module loader code. Architectures that don't need to do anything special
* can just rely on the 'weak' default hooks defined in kernel/module.c.
* Note, however, that at least one of apply_relocate or apply_relocate_add
* must be implemented by each architecture.
*/
/* Adjust arch-specific sections. Return 0 on success. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod);
/* Additional bytes needed by arch in front of individual sections */
unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
/* Allocator used for allocating struct module, core sections and init
sections. Returns NULL on failure. */
void *module_alloc(unsigned long size);
/* Free memory returned from module_alloc. */
void module_memfree(void *module_region);
/* Determines if the section name is an init section (that is only used during
* module loading).
*/
bool module_init_section(const char *name);
/* Determines if the section name is an exit section (that is only used during
* module unloading)
*/
bool module_exit_section(const char *name);
/* Describes whether within_module_init() will consider this an init section
* or not. This behaviour changes with CONFIG_MODULE_UNLOAD.
*/
bool module_init_layout_section(const char *sname);
/*
* Apply the given relocation to the (simplified) ELF. Return -error
* or 0.
*/
#ifdef CONFIG_MODULES_USE_ELF_REL
int apply_relocate(Elf_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *mod);
#else
static inline int apply_relocate(Elf_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: REL relocation unsupported\n",
module_name(me));
return -ENOEXEC;
}
#endif
/*
* Apply the given add relocation to the (simplified) ELF. Return
* -error or 0
*/
#ifdef CONFIG_MODULES_USE_ELF_RELA
int apply_relocate_add(Elf_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *mod);
#else
static inline int apply_relocate_add(Elf_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: REL relocation unsupported\n",
module_name(me));
return -ENOEXEC;
}
#endif
/* Any final processing of module before access. Return -error or 0. */
int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *mod);
/* Any cleanup needed when module leaves. */
void module_arch_cleanup(struct module *mod);
/* Any cleanup before freeing mod->module_init */
void module_arch_freeing_init(struct module *mod);
#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
!defined(CONFIG_KASAN_VMALLOC)
#include <linux/kasan.h>
#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
#else
#define MODULE_ALIGN PAGE_SIZE
#endif
#endif