Implicit declaration of function ‘task_stack_page’ in linux-4.4 kernel

时间:2017-11-13 06:34:20

标签: c linux linux-kernel linux-device-driver

I am trying to port some patches to linux-4.4 kernel and I am facing following error ./arch/arm64/include/asm/processor.h:159:40: error: implicit declaration of function ‘task_stack_page’ [-Werror=implicit-function-declaration]. Could you give me any pointer on this as to where the issue comes from?

   In file included from ./arch/arm64/include/asm/debug-monitors.h:25:0,
                     from ./arch/arm64/include/asm/bug.h:21,
                     from include/linux/bug.h:4,
                     from include/linux/thread_info.h:11,
                     from include/asm-generic/preempt.h:4,
                     from arch/arm64/include/generated/asm/preempt.h:1,
                     from include/linux/preempt.h:60,
                     from include/linux/spinlock.h:50,
                     from include/linux/seqlock.h:35,
                     from include/linux/time.h:5,
                     from include/uapi/linux/timex.h:56,
                     from include/linux/timex.h:56,
                     from include/linux/sched.h:19,
                     from arch/arm64/kernel/asm-offsets.c:21:
    ./arch/arm64/include/asm/compat.h: In function ‘arch_compat_alloc_user_space’:
    ./arch/arm64/include/asm/processor.h:159:40: error: implicit declaration of function ‘task_stack_page’ [-Werror=implicit-function-declaration]
      ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
                                            ^
    ./arch/arm64/include/asm/ptrace.h:137:5: note: in definition of macro ‘compat_user_mode’
      (((regs)->pstate & (PSR_MODE32_BIT | PSR_MODE_MASK)) == \
         ^
    ./arch/arm64/include/asm/compat.h:236:38: note: in expansion of macro ‘user_stack_pointer’
     #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
                                          ^
    ./arch/arm64/include/asm/compat.h:236:57: note: in expansion of macro ‘task_pt_regs’
     #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
                                                             ^
    ./arch/arm64/include/asm/compat.h:240:24: note: in expansion of macro ‘compat_user_stack_pointer’
      return (void __user *)compat_user_stack_pointer() - len;
                            ^
    ./arch/arm64/include/asm/processor.h:159:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
       ^
    ./arch/arm64/include/asm/ptrace.h:137:5: note: in definition of macro ‘compat_user_mode’
      (((regs)->pstate & (PSR_MODE32_BIT | PSR_MODE_MASK)) == \
         ^
    ./arch/arm64/include/asm/compat.h:236:38: note: in expansion of macro ‘user_stack_pointer’
     #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
                                          ^
    ./arch/arm64/include/asm/compat.h:236:57: note: in expansion of macro ‘task_pt_regs’
     #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
                                                             ^
    ./arch/arm64/include/asm/compat.h:240:24: note: in expansion of macro ‘compat_user_stack_pointer’
      return (void __user *)compat_user_stack_pointer() - len;
                            ^
    ./arch/arm64/include/asm/processor.h:159:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
       ^

I have checked the code and made sure that proper header files are included. Is there any gcc debug options to find where the error is coming from? I wonder why there is no tool (I might be wrong) to debug such compilation errors so that we can easily find the cause of errors

0 个答案:

没有答案