[LTP] [PATCH] Add __clear_cache declaration for clang

Cyril Hrubis chrubis@suse.cz
Tue Jun 11 14:04:41 CEST 2024


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


More information about the ltp mailing list