On Tue, Mar 10, 2026 at 12:21:14AM +0300, Sergey Matyukevich wrote:
> Hello Charlie,
> 
> On Thu, Mar 05, 2026 at 12:11:28AM -0800, Charlie Jenkins via B4 Relay wrote:
> > There are a couple of compilation issues of the riscv selftests.
> > Coincidentally two of the issues are independent problems with not
> > including the header that includes the BIT() macro and the other issue
> > is from checkpatch incorrectly suggesting to remove non-redundant
> > braces.
> > 
> > Signed-off-by: Charlie Jenkins <[email protected]>
> > ---
> > Charlie Jenkins (4):
> >       selftests: riscv: Add definition of BIT() macro
> >       selftests: riscv: Add braces around EXPECT_EQ()
> >       riscv: ptrace: Fix BIT() compilation issues
> >       selftests: riscv: Add license to cfi selftest
> > 
> >  arch/riscv/include/uapi/asm/ptrace.h                     |  1 +
> >  tools/testing/selftests/riscv/cfi/Makefile               |  2 ++
> >  tools/testing/selftests/riscv/vector/Makefile            |  2 ++
> >  tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 16 
> > ++++++++++------
> >  4 files changed, 15 insertions(+), 6 deletions(-)
> > ---
> > base-commit: c107785c7e8dbabd1c18301a1c362544b5786282
> > change-id: 20260304-fix_selftests-c3f0ae46b3c7
> > 
> > Best regards,
> > -- 
> > Charlie Jenkins <[email protected]>
> 
> Thanks for catching this !
> 
> On rc3 I can also reproduce the issue reported by the kernel test robot
> for v_exec_initval_nolibc.c and vstate_exec_nolibc.c. The following
> addition to your fixes seems to resolve it:

I missed that locally since those file compilations were cached for me!

I think we want to keep those as nolibc so instead we can only add the
header to the CFLAGS for only the tests that want libc, I'll send out an
updated version.

- Charlie

> 
> diff --git a/tools/testing/selftests/riscv/vector/Makefile 
> b/tools/testing/selftests/riscv/vector/Makefile
> index 92c4cfe5f34d..48d6cd5e72f6 100644
> --- a/tools/testing/selftests/riscv/vector/Makefile
> +++ b/tools/testing/selftests/riscv/vector/Makefile
> @@ -22,15 +22,13 @@ $(OUTPUT)/vstate_prctl: vstate_prctl.c 
> $(OUTPUT)/sys_hwprobe.o $(OUTPUT)/v_helpe
>       $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
>  
>  $(OUTPUT)/vstate_exec_nolibc: vstate_exec_nolibc.c
> -     $(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
> -             -Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
> +     $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
>  
>  $(OUTPUT)/v_initval: v_initval.c $(OUTPUT)/sys_hwprobe.o 
> $(OUTPUT)/v_helpers.o
>       $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
>  
>  $(OUTPUT)/v_exec_initval_nolibc: v_exec_initval_nolibc.c
> -     $(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
> -             -Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
> +     $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
>  
>  $(OUTPUT)/vstate_ptrace: vstate_ptrace.c $(OUTPUT)/sys_hwprobe.o 
> $(OUTPUT)/v_helpers.o
>       $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
> diff --git a/tools/testing/selftests/riscv/vector/v_exec_initval_nolibc.c 
> b/tools/testing/selftests/riscv/vector/v_exec_initval_nolibc.c
> index 4dde05e45a04..e3f062c85452 100644
> --- a/tools/testing/selftests/riscv/vector/v_exec_initval_nolibc.c
> +++ b/tools/testing/selftests/riscv/vector/v_exec_initval_nolibc.c
> @@ -9,6 +9,10 @@
>   * To be "clean" all values must be all zeroes.
>   */
>  
> +#include <stdlib.h>
> +#include <string.h>
> +#include <stdio.h>
> +
>  #define __stringify_1(x...)  #x
>  #define __stringify(x...)    __stringify_1(x)
>  
> diff --git a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c 
> b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> index 12f1b1b1c7aa..ecd687bb8359 100644
> --- a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> +++ b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> @@ -1,6 +1,12 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  
> -#include <linux/wait.h>
> +#include <unistd.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <stdio.h>
> +
> +#include <sys/prctl.h>
> +#include <sys/wait.h>
>  
>  #define THIS_PROGRAM "./vstate_exec_nolibc"
> 
> 
> Regards,
> Sergey

Reply via email to