module.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_ARM_MODULE_H
  3. #define _ASM_ARM_MODULE_H
  4. #include <asm-generic/module.h>
  5. #include <asm/unwind.h>
  6. #ifdef CONFIG_ARM_UNWIND
  7. #define ELF_SECTION_UNWIND 0x70000001
  8. #endif
  9. #define PLT_ENT_STRIDE L1_CACHE_BYTES
  10. #define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32))
  11. #define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT)
  12. struct plt_entries {
  13. u32 ldr[PLT_ENT_COUNT];
  14. u32 lit[PLT_ENT_COUNT];
  15. };
  16. struct mod_plt_sec {
  17. struct elf32_shdr *plt;
  18. struct plt_entries *plt_ent;
  19. int plt_count;
  20. };
  21. struct mod_arch_specific {
  22. #ifdef CONFIG_ARM_UNWIND
  23. struct list_head unwind_list;
  24. struct unwind_table *init_table;
  25. #endif
  26. #ifdef CONFIG_ARM_MODULE_PLTS
  27. struct mod_plt_sec core;
  28. struct mod_plt_sec init;
  29. #endif
  30. };
  31. struct module;
  32. u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val);
  33. #ifdef CONFIG_THUMB2_KERNEL
  34. #define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE
  35. static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym)
  36. {
  37. if (ELF_ST_TYPE(sym->st_info) == STT_FUNC)
  38. return sym->st_value & ~1;
  39. return sym->st_value;
  40. }
  41. #endif
  42. #endif /* _ASM_ARM_MODULE_H */