* [PATCH] riscv: Fix build errors using binutils2.37 toolchains
@ 2023-08-24 19:08 Mingzheng Xing
2023-08-24 19:25 ` Conor Dooley
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Mingzheng Xing @ 2023-08-24 19:08 UTC (permalink / raw)
To: Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nathan Chancellor, Nick Desaulniers, Tom Rix
Cc: Bin Meng, Guo Ren, linux-riscv, linux-kernel, llvm, stable,
Mingzheng Xing, Conor Dooley
When building the kernel with binutils 2.37 and GCC-11.1.0/GCC-11.2.0,
the following error occurs:
Assembler messages:
Error: cannot find default versions of the ISA extension `zicsr'
Error: cannot find default versions of the ISA extension `zifencei'
The above error originated from this commit of binutils[0], which has been
resolved and backported by GCC-12.1.0[1] and GCC-11.3.0[2].
So fix this by change the GCC version in
CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC to GCC-11.3.0.
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f0bae2552db1dd4f1995608fbf6648fcee4e9e0c [0]
Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca2bbb88f999f4d3cc40e89bc1aba712505dd598 [1]
Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671 [2]
Fixes: ca09f772ccca ("riscv: Handle zicsr/zifencei issue between gcc and binutils")
Reported-by: Conor Dooley <conor.dooley@microchip.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
---
Then below are my test results after this fix:
gcc binutils
10.5.0 2.35 ok
10.5.0 2.36 ok
10.5.0 2.37 ok
10.5.0 2.38 ok
11.1.0 2.35 ok
11.1.0 2.36 ok
11.1.0 2.37 ok
11.1.0 2.38 ok
11.2.0 2.35 ok
11.2.0 2.36 ok
11.2.0 2.37 ok
11.2.0 2.38 ok
11.3.0 2.35 ok
11.3.0 2.36 ok
11.3.0 2.37 ok
11.3.0 2.38 ok
11.4.0 2.35 ok
11.4.0 2.36 ok
11.4.0 2.37 ok
11.4.0 2.38 ok
12.1.0 2.35 ok
12.1.0 2.36 ok
12.1.0 2.37 ok
12.1.0 2.38 ok
12.2.0 2.35 ok
12.2.0 2.36 ok
12.2.0 2.37 ok
12.2.0 2.38 ok
arch/riscv/Kconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 10e7a7ad175a..bea7b73e895d 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -580,15 +580,15 @@ config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
and Zifencei are supported in binutils from version 2.36 onwards.
To make life easier, and avoid forcing toolchains that default to a
newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
- For clang < 17 or GCC < 11.1.0, for which this is not possible, this is
- dealt with in CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
+ For clang < 17 or GCC < 11.3.0, for which this is not possible or need
+ special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
def_bool y
depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
- # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b03be74bad08c382da47e048007a78fa3fb4ef49
- depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110100)
+ # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
+ depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
help
Certain versions of clang and GCC do not support zicsr and zifencei via
-march. This option causes an older ISA spec compatible with these older
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Fix build errors using binutils2.37 toolchains
2023-08-24 19:08 [PATCH] riscv: Fix build errors using binutils2.37 toolchains Mingzheng Xing
@ 2023-08-24 19:25 ` Conor Dooley
2023-08-24 19:36 ` Palmer Dabbelt
2023-08-24 20:08 ` Palmer Dabbelt
2023-08-24 20:10 ` patchwork-bot+linux-riscv
2 siblings, 1 reply; 5+ messages in thread
From: Conor Dooley @ 2023-08-24 19:25 UTC (permalink / raw)
To: Mingzheng Xing
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Nathan Chancellor,
Nick Desaulniers, Tom Rix, Bin Meng, Guo Ren, linux-riscv,
linux-kernel, llvm, stable, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
On Fri, Aug 25, 2023 at 03:08:52AM +0800, Mingzheng Xing wrote:
> When building the kernel with binutils 2.37 and GCC-11.1.0/GCC-11.2.0,
> the following error occurs:
>
> Assembler messages:
> Error: cannot find default versions of the ISA extension `zicsr'
> Error: cannot find default versions of the ISA extension `zifencei'
>
> The above error originated from this commit of binutils[0], which has been
> resolved and backported by GCC-12.1.0[1] and GCC-11.3.0[2].
>
> So fix this by change the GCC version in
> CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC to GCC-11.3.0.
>
> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f0bae2552db1dd4f1995608fbf6648fcee4e9e0c [0]
> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca2bbb88f999f4d3cc40e89bc1aba712505dd598 [1]
> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671 [2]
> Fixes: ca09f772ccca ("riscv: Handle zicsr/zifencei issue between gcc and binutils")
> Reported-by: Conor Dooley <conor.dooley@microchip.com>
Closes: https://lore.kernel.org/all/20230823-captive-abdomen-befd942a4a73@wendy/
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Fix build errors using binutils2.37 toolchains
2023-08-24 19:25 ` Conor Dooley
@ 2023-08-24 19:36 ` Palmer Dabbelt
0 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2023-08-24 19:36 UTC (permalink / raw)
To: Conor Dooley
Cc: xingmingzheng, Paul Walmsley, aou, nathan, ndesaulniers, trix,
bmeng, guoren, linux-riscv, linux-kernel, llvm, stable,
Conor Dooley
On Thu, 24 Aug 2023 12:25:36 PDT (-0700), Conor Dooley wrote:
> On Fri, Aug 25, 2023 at 03:08:52AM +0800, Mingzheng Xing wrote:
>> When building the kernel with binutils 2.37 and GCC-11.1.0/GCC-11.2.0,
>> the following error occurs:
>>
>> Assembler messages:
>> Error: cannot find default versions of the ISA extension `zicsr'
>> Error: cannot find default versions of the ISA extension `zifencei'
>>
>> The above error originated from this commit of binutils[0], which has been
>> resolved and backported by GCC-12.1.0[1] and GCC-11.3.0[2].
>>
>> So fix this by change the GCC version in
>> CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC to GCC-11.3.0.
>>
>> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f0bae2552db1dd4f1995608fbf6648fcee4e9e0c [0]
>> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca2bbb88f999f4d3cc40e89bc1aba712505dd598 [1]
>> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671 [2]
>> Fixes: ca09f772ccca ("riscv: Handle zicsr/zifencei issue between gcc and binutils")
>> Reported-by: Conor Dooley <conor.dooley@microchip.com>
>
> Closes: https://lore.kernel.org/all/20230823-captive-abdomen-befd942a4a73@wendy/
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> Tested-by: Conor Dooley <conor.dooley@microchip.com>
Thanks. I queued this up into staging, it's building -- so is Linus'
master, so it might take a bit to get through everything.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Fix build errors using binutils2.37 toolchains
2023-08-24 19:08 [PATCH] riscv: Fix build errors using binutils2.37 toolchains Mingzheng Xing
2023-08-24 19:25 ` Conor Dooley
@ 2023-08-24 20:08 ` Palmer Dabbelt
2023-08-24 20:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2023-08-24 20:08 UTC (permalink / raw)
To: Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nathan Chancellor, Nick Desaulniers, Tom Rix, Mingzheng Xing
Cc: Bin Meng, Guo Ren, linux-riscv, linux-kernel, llvm, stable,
Conor Dooley
On Fri, 25 Aug 2023 03:08:52 +0800, Mingzheng Xing wrote:
> When building the kernel with binutils 2.37 and GCC-11.1.0/GCC-11.2.0,
> the following error occurs:
>
> Assembler messages:
> Error: cannot find default versions of the ISA extension `zicsr'
> Error: cannot find default versions of the ISA extension `zifencei'
>
> [...]
Applied, thanks!
[1/1] riscv: Fix build errors using binutils2.37 toolchains
https://git.kernel.org/palmer/c/ef21fa7c198e
Best regards,
--
Palmer Dabbelt <palmer@rivosinc.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Fix build errors using binutils2.37 toolchains
2023-08-24 19:08 [PATCH] riscv: Fix build errors using binutils2.37 toolchains Mingzheng Xing
2023-08-24 19:25 ` Conor Dooley
2023-08-24 20:08 ` Palmer Dabbelt
@ 2023-08-24 20:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-24 20:10 UTC (permalink / raw)
To: Mingzheng Xing
Cc: linux-riscv, conor, paul.walmsley, palmer, aou, nathan,
ndesaulniers, trix, bmeng, guoren, linux-kernel, llvm, stable,
conor.dooley
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Fri, 25 Aug 2023 03:08:52 +0800 you wrote:
> When building the kernel with binutils 2.37 and GCC-11.1.0/GCC-11.2.0,
> the following error occurs:
>
> Assembler messages:
> Error: cannot find default versions of the ISA extension `zicsr'
> Error: cannot find default versions of the ISA extension `zifencei'
>
> [...]
Here is the summary with links:
- riscv: Fix build errors using binutils2.37 toolchains
https://git.kernel.org/riscv/c/ef21fa7c198e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-24 20:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 19:08 [PATCH] riscv: Fix build errors using binutils2.37 toolchains Mingzheng Xing
2023-08-24 19:25 ` Conor Dooley
2023-08-24 19:36 ` Palmer Dabbelt
2023-08-24 20:08 ` Palmer Dabbelt
2023-08-24 20:10 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox