2021-10-28 13:58:21

by Naresh Kamboju

[permalink] [raw]
Subject: riscv: delay.c:77:17: error: implicit declaration of function 'cpu_relax' [-Werror=implicit-function-declaration]

Regression found on riscv gcc-11 built with defconfig
Following build warnings / errors reported on linux next 20211028.

metadata:
git_describe: next-20211028
git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
git_short_log: 503f375baa99 (\"Add linux-next specific files for 20211028\")
target_arch: riscv
toolchain: gcc-11

build error :
--------------
/builds/linux/arch/riscv/lib/delay.c: In function '__delay':
/builds/linux/arch/riscv/lib/delay.c:77:17: error: implicit
declaration of function 'cpu_relax'
[-Werror=implicit-function-declaration]
77 | cpu_relax();
| ^~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [/builds/linux/scripts/Makefile.build:288:
arch/riscv/lib/delay.o] Error 1


Reported-by: Linux Kernel Functional Testing <[email protected]>

build link:
-----------
https://builds.tuxbuild.com/208R1uE0CO13gO5XbrrWlqwau7r/build.log

build config:
-------------
https://builds.tuxbuild.com/208R1uE0CO13gO5XbrrWlqwau7r/config

# To install tuxmake on your system globally
# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch riscv --toolchain gcc-11
--kconfig defconfig

--
Linaro LKFT
https://lkft.linaro.org


2021-10-28 14:59:38

by Kefeng Wang

[permalink] [raw]
Subject: Re: riscv: delay.c:77:17: error: implicit declaration of function 'cpu_relax' [-Werror=implicit-function-declaration]

From c83a7b83ff96ba77a7c26090ccdd42aa7722788f Mon Sep 17 00:00:00 2001
From: Kefeng Wang <[email protected]>
Date: Thu, 28 Oct 2021 23:03:13 +0800
Subject: [PATCH] riscv: Fix implicit declaration of function 'cpu_relax'

Including <asm/processor.h> to fix the implicit declaration of function
'cpu_relax'.

Reported-by: Linux Kernel Functional Testing <[email protected]>
Signed-off-by: Kefeng Wang <[email protected]>
---
After "include/linux/delay.h: replace kernel.h with the necessary
inclusions", we need this include.

arch/riscv/lib/delay.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/riscv/lib/delay.c b/arch/riscv/lib/delay.c
index f51c9a03bca1..8148dcdee894 100644
--- a/arch/riscv/lib/delay.c
+++ b/arch/riscv/lib/delay.c
@@ -8,6 +8,8 @@
#include <linux/timex.h>
#include <linux/export.h>

+#include <asm/processor.h>
+
/*
* This is copies from arch/arm/include/asm/delay.h
*
--
2.26.2


2021-10-28 21:19:25

by Stephen Rothwell

[permalink] [raw]
Subject: Re: riscv: delay.c:77:17: error: implicit declaration of function 'cpu_relax' [-Werror=implicit-function-declaration]

Hi all,

[cc'ing Andy and Andrew]

On Thu, 28 Oct 2021 22:57:02 +0800 Kefeng Wang <[email protected]> wrote:
>
> From c83a7b83ff96ba77a7c26090ccdd42aa7722788f Mon Sep 17 00:00:00 2001
> From: Kefeng Wang <[email protected]>
> Date: Thu, 28 Oct 2021 23:03:13 +0800
> Subject: [PATCH] riscv: Fix implicit declaration of function 'cpu_relax'
>
> Including <asm/processor.h> to fix the implicit declaration of function
> 'cpu_relax'.
>
> Reported-by: Linux Kernel Functional Testing <[email protected]>
> Signed-off-by: Kefeng Wang <[email protected]>
> ---
> After "include/linux/delay.h: replace kernel.h with the necessary inclusions", we need this include.
>
> arch/riscv/lib/delay.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/lib/delay.c b/arch/riscv/lib/delay.c
> index f51c9a03bca1..8148dcdee894 100644
> --- a/arch/riscv/lib/delay.c
> +++ b/arch/riscv/lib/delay.c
> @@ -8,6 +8,8 @@
> #include <linux/timex.h>
> #include <linux/export.h>
>
> +#include <asm/processor.h>
> +
> /*
> * This is copies from arch/arm/include/asm/delay.h
> *
> --
> 2.26.2

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature