@@ -29,7 +29,9 @@ SECTIONS
. = ALIGN(16);
/* Linkage tables */
.opd : {
+ __start_opd = .;
*(.opd)
+ __end_opd = .;
} PROVIDE (__gp = .);
.plt : {
*(.plt)
@@ -7,6 +7,8 @@
#ifdef CONFIG_64BIT
#undef dereference_function_descriptor
unsigned long dereference_function_descriptor(unsigned long);
+#undef dereference_kernel_function_descriptor
+unsigned long dereference_kernel_function_descriptor(unsigned long);
#endif
#endif
@@ -66,6 +66,7 @@
#include <asm/pgtable.h>
#include <asm/unwind.h>
+#include <asm/sections.h>
#if 0
#define DEBUGP printk
@@ -954,3 +955,19 @@ void module_arch_cleanup(struct module *mod)
{
deregister_unwind_table(mod);
}
+
+#ifdef CONFIG_64BIT
+unsigned long dereference_module_function_descriptor(struct module *mod,
+ unsigned long addr)
+{
+ unsigned long start_opd = (Elf64_Addr)mod->core_layout.base +
+ mod->arch.fdesc_offset;
+ unsigned long end_opd = start_opd +
+ mod->arch.fdesc_count * sizeof(Elf64_Fdesc);
+
+ if (addr < start_opd || addr >= end_opd)
+ return addr;
+
+ return dereference_function_descriptor(addr);
+}
+#endif
@@ -276,6 +276,15 @@ unsigned long dereference_function_descriptor(unsigned long ptr)
ptr = (unsigned long)p;
return ptr;
}
+
+unsigned long dereference_kernel_function_descriptor(unsigned long addr)
+{
+ if (addr < (unsigned long)__start_opd ||
+ addr >= (unsigned long)__end_opd)
+ return addr;
+
+ return dereference_function_descriptor(addr);
+}
#endif
static inline unsigned long brk_rnd(void)
@@ -99,7 +99,9 @@ SECTIONS
. = ALIGN(16);
/* Linkage tables */
.opd : {
+ __start_opd = .;
*(.opd)
+ __end_opd = .;
} PROVIDE (__gp = .);
.plt : {
*(.plt)