public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <thecharlesjenkins@gmail.com>
To: Sergey Matyukevich <geomatsi@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>, Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andy Chiu <andybnac@gmail.com>, Deepak Gupta <debug@rivosinc.com>,
	linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi
Date: Mon, 9 Mar 2026 18:45:46 -0700	[thread overview]
Message-ID: <20260310014546.GA17809@inky.localdomain> (raw)
In-Reply-To: <aa85yl-c2suNF5LO@curiosity>

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 <thecharlesjenkins@gmail.com>
> > ---
> > 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 <thecharlesjenkins@gmail.com>
> 
> 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

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

      reply	other threads:[~2026-03-10  1:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  8:11 [PATCH 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
2026-03-05  8:11 ` [PATCH 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
2026-03-05 16:10   ` kernel test robot
2026-03-05  8:11 ` [PATCH 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
2026-03-05  8:11 ` [PATCH 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
2026-03-05  8:11 ` [PATCH 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
2026-03-09 21:21 ` [PATCH 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Sergey Matyukevich
2026-03-10  1:45   ` Charlie Jenkins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260310014546.GA17809@inky.localdomain \
    --to=thecharlesjenkins@gmail.com \
    --cc=andybnac@gmail.com \
    --cc=debug@rivosinc.com \
    --cc=geomatsi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox