2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifndef _ASM_ARM_MODULE_H
|
|
|
|
|
#define _ASM_ARM_MODULE_H
|
|
|
|
|
|
2012-09-28 14:31:03 +09:30
|
|
|
#include <asm-generic/module.h>
|
2022-05-20 08:49:55 +01:00
|
|
|
#include <asm/unwind.h>
|
2009-02-11 13:09:54 +01:00
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARM_UNWIND
|
2022-05-20 08:49:55 +01:00
|
|
|
#define ELF_SECTION_UNWIND 0x70000001
|
2014-11-24 16:54:35 +01:00
|
|
|
#endif
|
2009-02-11 13:09:54 +01:00
|
|
|
|
2021-05-05 07:56:30 +01:00
|
|
|
#define PLT_ENT_STRIDE L1_CACHE_BYTES
|
|
|
|
|
#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32))
|
|
|
|
|
#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT)
|
|
|
|
|
|
|
|
|
|
struct plt_entries {
|
|
|
|
|
u32 ldr[PLT_ENT_COUNT];
|
|
|
|
|
u32 lit[PLT_ENT_COUNT];
|
|
|
|
|
};
|
|
|
|
|
|
2017-02-22 19:40:12 +01:00
|
|
|
struct mod_plt_sec {
|
|
|
|
|
struct elf32_shdr *plt;
|
2021-05-05 07:59:04 +01:00
|
|
|
struct plt_entries *plt_ent;
|
2017-02-22 19:40:12 +01:00
|
|
|
int plt_count;
|
|
|
|
|
};
|
|
|
|
|
|
2010-11-12 13:02:46 +00:00
|
|
|
struct mod_arch_specific {
|
2014-11-24 16:54:35 +01:00
|
|
|
#ifdef CONFIG_ARM_UNWIND
|
2022-05-20 08:49:55 +01:00
|
|
|
struct list_head unwind_list;
|
|
|
|
|
struct unwind_table *init_table;
|
2012-09-28 14:31:03 +09:30
|
|
|
#endif
|
2014-11-24 16:54:35 +01:00
|
|
|
#ifdef CONFIG_ARM_MODULE_PLTS
|
2017-02-22 19:40:12 +01:00
|
|
|
struct mod_plt_sec core;
|
|
|
|
|
struct mod_plt_sec init;
|
2014-11-24 16:54:35 +01:00
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-06 14:48:47 +02:00
|
|
|
struct module;
|
2014-11-24 16:54:35 +01:00
|
|
|
u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val);
|
2022-09-27 13:08:37 +01:00
|
|
|
#ifdef CONFIG_ARM_MODULE_PLTS
|
|
|
|
|
bool in_module_plt(unsigned long loc);
|
|
|
|
|
#else
|
|
|
|
|
static inline bool in_module_plt(unsigned long loc) { return false; }
|
|
|
|
|
#endif
|
2010-11-12 13:02:46 +00:00
|
|
|
|
2018-12-14 17:05:55 +01:00
|
|
|
#ifdef CONFIG_THUMB2_KERNEL
|
|
|
|
|
#define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE
|
|
|
|
|
static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym)
|
|
|
|
|
{
|
|
|
|
|
if (ELF_ST_TYPE(sym->st_info) == STT_FUNC)
|
|
|
|
|
return sym->st_value & ~1;
|
|
|
|
|
|
|
|
|
|
return sym->st_value;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif /* _ASM_ARM_MODULE_H */
|