This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

cross-compile gator module on rk3399(arm64 aarch64 linux-4.4.154) failure!

I cross-compile gator on host use

make -C /home/emel/arm-project/linux-kernel/kernel M=`pwd` ARCH=arm64 CROSS_COMPILE=/opt/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- GATOR_WITH_MALI_SUPPORT=MALI_MIDGARD MALI_DIR_MIDGARD=/home/emel/arm-project/linux-kernel/kernel/drivers/gpu/arm/midgard/   modules

the errors  follow:


make: Entering directory '/home/emel/arm-project/linux-kernel/kernel'
CC [M] /home/emel/arm-project/gator/driver/gator_main.o
In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:
/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'report_trace':
/home/emel/arm-project/gator/driver/gator_backtrace.c:64:33: error: 'struct module' has no member named 'module_core'
(unsigned long)mod->module_core;

In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:
/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'report_trace':
/home/emel/arm-project/gator/driver/gator_backtrace.c:64:33: error: 'struct module' has no member named 'module_core'
(unsigned long)mod->module_core;
^
/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'kernel_backtrace':
/home/emel/arm-project/gator/driver/gator_backtrace.c:105:21: warning: passing argument 1 of 'walk_stackframe' from incompatible pointer type
error, forbidden warning:gator_backtrace.c:105
walk_stackframe(&frame, report_trace, &depth);
^
In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0,
from /home/emel/arm-project/gator/driver/gator_main.c:270:
./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'struct task_struct *' but argument is of type 'struct stackframe *'
extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
^
In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:
/home/emel/arm-project/gator/driver/gator_backtrace.c:105:29: warning: passing argument 2 of 'walk_stackframe' from incompatible pointer type
error, forbidden warning:gator_backtrace.c:105
walk_stackframe(&frame, report_trace, &depth);
^
In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0,
from /home/emel/arm-project/gator/driver/gator_main.c:270:
./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'struct stackframe *' but argument is of type 'int (*)(struct stackframe *, void *)'
extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
^
In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:
/home/emel/arm-project/gator/driver/gator_backtrace.c:105:43: warning: passing argument 3 of 'walk_stackframe' from incompatible pointer type
error, forbidden warning:gator_backtrace.c:105
walk_stackframe(&frame, report_trace, &depth);
^
In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0,
from /home/emel/arm-project/gator/driver/gator_main.c:270:
./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'int (*)(struct stackframe *, void *)' but argument is of type 'int *'
extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
^
In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:
/home/emel/arm-project/gator/driver/gator_backtrace.c:105:5: error: too few arguments to function 'walk_stackframe'
walk_stackframe(&frame, report_trace, &depth);
^
In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0,
from /home/emel/arm-project/gator/driver/gator_main.c:270:
./arch/arm64/include/asm/stacktrace.h:31:13: note: declared here
extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
^
scripts/Makefile.build:277: recipe for target '/home/emel/arm-project/gator/driver/gator_main.o' failed
make[1]: *** [/home/emel/arm-project/gator/driver/gator_main.o] Error 1
Makefile:1474: recipe for target '_module_/home/emel/arm-project/gator/driver' failed
make: *** [_module_/home/emel/arm-project/gator/driver] Error 2
make: Leaving directory '/home/emel/arm-project/linux-kernel/kernel'

I read source code  gator_backtrace.c:

60 if (mod) {
61 cookie = get_cookie(cpu, current, mod->name, false);
62 addr = addr -
63 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
64 (unsigned long)mod->module_core;
65 #else
66 (unsigned long)mod->core_layout.base;
67 #endif
68 }
69 else {
70 cookie = NO_COOKIE;
71 }
72 #endif

...


102 #if defined(__aarch64__) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
103 walk_stackframe(current, &frame, report_trace, &depth);
104 #else
105 walk_stackframe(&frame, report_trace, &depth);
106 #endif

so is it because linux kernel version not match ?

so I change KERNEL_VERSION(4, 5, 0) instead of  KERNEL_VERSION(4, 4, 0)

It can make successfully.

after that i copy gator.ko to rk3399 and insmod .but fail.

unknown symbol in module .

dmesg: unknown symbol walk_stackframe(err 0)

so do I make some mistake with my operation above ? shold I change KERNEL_VERSION(4, 5, 0) ? or  where is walk_stackframe ?

thanks very much!