public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Add __clear_cache declaration for clang
@ 2024-06-11  5:56 Khem Raj
  2024-06-11 12:04 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2024-06-11  5:56 UTC (permalink / raw)
  To: ltp; +Cc: Hui Min Mina Chou, Khem Raj

__clear_cache was enabled on RISCV recently with 7352ba02390116f1cd6a9b583860ba28aa0a1b7a
however it fails to compile with clang19 on RISCV
With this error

  hugemmap15.c:51:2: error: call to undeclared function '__clear_cache'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      51 |         __clear_cache(p, p + COPY_SIZE);
         |         ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Hui Min Mina Chou <minachou@andestech.com>
---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index a84ba6476..856e22ff3 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -21,6 +21,7 @@
 
 #if defined(__clang__)
 	#pragma clang optimize off
+	void __clear_cache(void *start, void *end);
 #endif
 
 #define _GNU_SOURCE

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] Add __clear_cache declaration for clang
  2024-06-11  5:56 [LTP] [PATCH] Add __clear_cache declaration for clang Khem Raj
@ 2024-06-11 12:04 ` Cyril Hrubis
  2025-10-12 19:10   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-06-11 12:04 UTC (permalink / raw)
  To: Khem Raj; +Cc: Hui Min Mina Chou, ltp

Hi!
> __clear_cache was enabled on RISCV recently with 7352ba02390116f1cd6a9b583860ba28aa0a1b7a
> however it fails to compile with clang19 on RISCV
> With this error
> 
>   hugemmap15.c:51:2: error: call to undeclared function '__clear_cache'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>       51 |         __clear_cache(p, p + COPY_SIZE);
>          |         ^

This sounds like a clnag bug. The __clear_cache() is a pre-defined
function and as such the signature should be part of the compiler.

Is the call even supported by clang19 on RISCV?

> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Hui Min Mina Chou <minachou@andestech.com>
> ---
>  testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> index a84ba6476..856e22ff3 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> @@ -21,6 +21,7 @@
>  
>  #if defined(__clang__)
>  	#pragma clang optimize off
> +	void __clear_cache(void *start, void *end);
>  #endif
>  
>  #define _GNU_SOURCE
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] Add __clear_cache declaration for clang
  2024-06-11 12:04 ` Cyril Hrubis
@ 2025-10-12 19:10   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2025-10-12 19:10 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Hui Min Mina Chou, Khem Raj, ltp

Hi Khem, Cyril,

> Hi!
> > __clear_cache was enabled on RISCV recently with 7352ba02390116f1cd6a9b583860ba28aa0a1b7a
> > however it fails to compile with clang19 on RISCV
> > With this error

> >   hugemmap15.c:51:2: error: call to undeclared function '__clear_cache'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> >       51 |         __clear_cache(p, p + COPY_SIZE);
> >          |         ^

> This sounds like a clnag bug. The __clear_cache() is a pre-defined
> function and as such the signature should be part of the compiler.

> Is the call even supported by clang19 on RISCV?

I think Cyril is correct. IMHO __clear_cache() on riscv64 was added in

https://github.com/llvm/llvm-project/commit/9d469b5988bfb1c2e99533f863b1f9eb5b0c58b7

which was added in llvmorg-20.1.0-rc1.

BTW we have m4 check for __clear_cache(), I'll send a patch.

Kind regards,
Petr

> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > Cc: Hui Min Mina Chou <minachou@andestech.com>
> > ---
> >  testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 1 +
> >  1 file changed, 1 insertion(+)

> > diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> > index a84ba6476..856e22ff3 100644
> > --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> > +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> > @@ -21,6 +21,7 @@

> >  #if defined(__clang__)
> >  	#pragma clang optimize off
> > +	void __clear_cache(void *start, void *end);
> >  #endif

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-12 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11  5:56 [LTP] [PATCH] Add __clear_cache declaration for clang Khem Raj
2024-06-11 12:04 ` Cyril Hrubis
2025-10-12 19:10   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox