linux 内核编译错误 error: conflicting types for ‘syscall_trace_enter’

编译内核出现如下错误:

arch/x86/kernel/ptrace.c:1472:17: error: conflicting types for ‘syscall_trace_enter’ 
In file included from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/vm86.h:130:0, 
                  from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/processor.h:10, 
                  from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/thread_info.h:22, 
                  from include/linux/thread_info.h:56, 
                  from include/linux/preempt.h:9, 
                  from include/linux/spinlock.h:50, 
                  from include/linux/seqlock.h:29, 
                  from include/linux/time.h:8, 
                  from include/linux/timex.h:56, 
                  from include/linux/sched.h:56, 
                  from arch/x86/kernel/ptrace.c:11: 
/home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/ptrace.h:146:13: note: previous declaration of ‘syscall_trace_enter’ was here 
arch/x86/kernel/ptrace.c:1517:17: error: conflicting types for ‘syscall_trace_leave’ 
In file included from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/vm86.h:130:0, 
                  from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/processor.h:10, 
                  from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/thread_info.h:22, 
                  from include/linux/thread_info.h:56, 
                  from include/linux/preempt.h:9, 
                  from include/linux/spinlock.h:50, 
                  from include/linux/seqlock.h:29, 
                  from include/linux/time.h:8, 
                  from include/linux/timex.h:56, 
                  from include/linux/sched.h:56, 
                  from arch/x86/kernel/ptrace.c:11: 
/home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/ptrace.h:147:13: note: previous declaration of ‘syscall_trace_leave’ was here 
make[2]: *** [arch/x86/kernel/ptrace.o] Error 1 
make[1]: *** [arch/x86/kernel] Error 2 
make: *** [arch/x86] Error 2

注意红色标注的两行,说明ptrace.c 文件中第1472行的函数syscall_trace_leave和ptrace.h文件中该函数的声明有冲突,只要将ptrace.h文件中的函数声明改得和ptrace.c中的相同即可。

解决方案如下:

vi arch/x86/include/asm/ptrace.h

130行 添加 #include <linux/linkage.h>

142 143行 修改代码

原始代码

extern long syscall_trace_enter(struct pt_regs *);
extern void syscall_trace_leave(struct pt_regs *);

修改后的代码

extern asmregparm long syscall_trace_enter(struct pt_regs *); 
extern asmregparm void syscall_trace_leave(struct pt_regs *);

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值