Linux kernel 如何纠正错误“;未定义对“互斥锁锁定慢路径”的引用;在内核编译期间?
我正在Ubuntu 12.04上编译内核版本2.6.25。当我使用“make”命令编译它时 我发现错误: 内核/内置.o:在函数“互斥锁”中: /usr/src/linux-2.6.25/kernel/mutex.c:92:未定义对“\uuuu mutex\u lock\u slowpath”的引用 内核/内置.o:在函数“mutex\u unlock”中: /usr/src/linux-2.6.25/kernel/mutex.c:117:未定义对“\uuuu mutex\u unlock\u slowpath”的引用 make::[.tmp_vmlinux1]错误1Linux kernel 如何纠正错误“;未定义对“互斥锁锁定慢路径”的引用;在内核编译期间?,linux-kernel,Linux Kernel,我正在Ubuntu 12.04上编译内核版本2.6.25。当我使用“make”命令编译它时 我发现错误: 内核/内置.o:在函数“互斥锁”中: /usr/src/linux-2.6.25/kernel/mutex.c:92:未定义对“\uuuu mutex\u lock\u slowpath”的引用 内核/内置.o:在函数“mutex\u unlock”中: /usr/src/linux-2.6.25/kernel/mutex.c:117:未定义对“\uuuu mutex\u unlock\u
如何纠正这些错误?请帮助更改kernel/mutex.c中的声明以强制将函数保留在对象文件中就足够了。您可以像这样使用gcc属性扩展“\uuuu used”:
-static void noinline __sched
+static __used void noinline __sched
__mutex_lock_slowpath(atomic_t *lock_count);
-static noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
+static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
更改kernel/mutex.c中的声明以强制将函数保留在对象文件中就足够了。您可以像这样使用gcc属性扩展“\uuuu used”:
-static void noinline __sched
+static __used void noinline __sched
__mutex_lock_slowpath(atomic_t *lock_count);
-static noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
+static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
事实证明,解决方案是在四个位置更改
内核/mutex.c
:
第60、96、192行
-static void fastcall noinline __sched
+static __attribute__ ((used)) void fastcall noinline __sched
第251行
-static fastcall noinline void
+static __attribute__ ((used)) void fastcall noinline __sched
我不知道为什么使用的
\uu
不起作用。证明解决方案是在四个位置更改内核/mutex.c
:
第60、96、192行
-static void fastcall noinline __sched
+static __attribute__ ((used)) void fastcall noinline __sched
第251行
-static fastcall noinline void
+static __attribute__ ((used)) void fastcall noinline __sched
我不知道为什么使用的
\u
不起作用。这些函数只在同一个文件中定义。你有他们的远期申报吗?@Rajeev Das你能解决这个问题吗?我解决不了。请共享仅在同一文件中定义的那些函数的信息。你有他们的远期申报吗?@Rajeev Das你能解决这个问题吗?我解决不了。请共享解决方案不起作用的信息:kernel/mutex.c:60:15:错误:应为“=”、“、”、“;”、”“void”static之前的asm”或“attribute”\uu使用了void fastcall noinline\uu sched^解决方案不起作用:kernel/mutex.c:60:15:错误:应为“=”,“,”,“;”,“,”“void”static之前的asm”或“attribute”\u使用void fastcall noinline\u sched^