2023-11-28 07:18:59

by Wujie Duan

[permalink] [raw]
Subject: [PATCH] Mark symbols static where possible for mips/kernel

We get 1 error when building kernel with -Werror=missing-prototypes

Signed-off-by: Wujie Duan <[email protected]>
---
arch/mips/kernel/signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 479999b7f2de..b99c0e9bb5c6 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -435,7 +435,7 @@ int protected_restore_fp_context(void __user *sc)
return err ?: sig;
}

-int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
+static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
{
int err = 0;
int i;
--
2.34.1


2023-11-28 09:17:06

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH] Mark symbols static where possible for mips/kernel

On Tue, Nov 28, 2023 at 03:12:25PM +0800, Wujie Duan wrote:
> We get 1 error when building kernel with -Werror=missing-prototypes

check git grep setup_sigcontext arch/mips/

With this patch n32 support doesn't build. We need a prototype in a header
to fix that.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2023-11-28 22:52:24

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Mark symbols static where possible for mips/kernel

Hi Wujie,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc3 next-20231128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Wujie-Duan/Mark-symbols-static-where-possible-for-mips-kernel/20231128-152256
base: linus/master
patch link: https://lore.kernel.org/r/20231128071225.801111-1-wjduan%40linx-info.com
patch subject: [PATCH] Mark symbols static where possible for mips/kernel
config: mips-fuloong2e_defconfig (https://download.01.org/0day-ci/archive/20231129/[email protected]/config)
compiler: mips64el-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231129/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

mips64el-linux-ld: arch/mips/kernel/signal_n32.o: in function `setup_rt_frame_n32':
>> signal_n32.c:(.text+0xe0): undefined reference to `setup_sigcontext'

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-11-30 11:01:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Mark symbols static where possible for mips/kernel

Hi Wujie,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc3 next-20231130]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Wujie-Duan/Mark-symbols-static-where-possible-for-mips-kernel/20231128-152256
base: linus/master
patch link: https://lore.kernel.org/r/20231128071225.801111-1-wjduan%40linx-info.com
patch subject: [PATCH] Mark symbols static where possible for mips/kernel
config: mips-cavium_octeon_defconfig (https://download.01.org/0day-ci/archive/20231130/[email protected]/config)
compiler: mips64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

mips64-linux-ld: arch/mips/kernel/signal_n32.o: in function `setup_rt_frame_n32':
>> arch/mips/kernel/signal_n32.c:109:(.text+0xb8): undefined reference to `setup_sigcontext'


vim +109 arch/mips/kernel/signal_n32.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 91
81d103bf806786 Richard Weinberger 2013-10-06 92 static int setup_rt_frame_n32(void *sig_return, struct ksignal *ksig,
81d103bf806786 Richard Weinberger 2013-10-06 93 struct pt_regs *regs, sigset_t *set)
^1da177e4c3f41 Linus Torvalds 2005-04-16 94 {
9bbf28a36cae08 Atsushi Nemoto 2006-02-01 95 struct rt_sigframe_n32 __user *frame;
^1da177e4c3f41 Linus Torvalds 2005-04-16 96 int err = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 97
7c4f563507c33c Richard Weinberger 2014-03-05 98 frame = get_sigframe(ksig, regs, sizeof(*frame));
96d4f267e40f95 Linus Torvalds 2019-01-03 99 if (!access_ok(frame, sizeof (*frame)))
81d103bf806786 Richard Weinberger 2013-10-06 100 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 101
^1da177e4c3f41 Linus Torvalds 2005-04-16 102 /* Create siginfo. */
81d103bf806786 Richard Weinberger 2013-10-06 103 err |= copy_siginfo_to_user32(&frame->rs_info, &ksig->info);
^1da177e4c3f41 Linus Torvalds 2005-04-16 104
^1da177e4c3f41 Linus Torvalds 2005-04-16 105 /* Create the ucontext. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 106 err |= __put_user(0, &frame->rs_uc.uc_flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 107 err |= __put_user(0, &frame->rs_uc.uc_link);
ea536ad4f231a0 Al Viro 2012-12-23 108 err |= __compat_save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @109 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
431dc8040354db Ralf Baechle 2007-02-13 110 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set);
^1da177e4c3f41 Linus Torvalds 2005-04-16 111
^1da177e4c3f41 Linus Torvalds 2005-04-16 112 if (err)
81d103bf806786 Richard Weinberger 2013-10-06 113 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 114
^1da177e4c3f41 Linus Torvalds 2005-04-16 115 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 116 * Arguments to signal handler:
^1da177e4c3f41 Linus Torvalds 2005-04-16 117 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 118 * a0 = signal number
^1da177e4c3f41 Linus Torvalds 2005-04-16 119 * a1 = 0 (should be cause)
^1da177e4c3f41 Linus Torvalds 2005-04-16 120 * a2 = pointer to ucontext
^1da177e4c3f41 Linus Torvalds 2005-04-16 121 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 122 * $25 and c0_epc point to the signal handler, $29 points to
^1da177e4c3f41 Linus Torvalds 2005-04-16 123 * the struct rt_sigframe.
^1da177e4c3f41 Linus Torvalds 2005-04-16 124 */
81d103bf806786 Richard Weinberger 2013-10-06 125 regs->regs[ 4] = ksig->sig;
^1da177e4c3f41 Linus Torvalds 2005-04-16 126 regs->regs[ 5] = (unsigned long) &frame->rs_info;
^1da177e4c3f41 Linus Torvalds 2005-04-16 127 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 128 regs->regs[29] = (unsigned long) frame;
d814c28ceca8f6 David Daney 2010-02-18 129 regs->regs[31] = (unsigned long) sig_return;
81d103bf806786 Richard Weinberger 2013-10-06 130 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
^1da177e4c3f41 Linus Torvalds 2005-04-16 131
722bb63de630f9 Franck Bui-Huu 2007-02-05 132 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 133 current->comm, current->pid,
^1da177e4c3f41 Linus Torvalds 2005-04-16 134 frame, regs->cp0_epc, regs->regs[31]);
722bb63de630f9 Franck Bui-Huu 2007-02-05 135
7b3e2fc847c832 Ralf Baechle 2006-02-08 136 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 137 }
151fd6acd94e12 Ralf Baechle 2007-02-15 138

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki