lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
Subsystems (2)
PATCH 1/1 lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
When building for ARCH=riscv using LLVM < 14, there is an error with CONFIG_DEBUG_INFO_SPLIT=y:
error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so CONFIG_DEBUG_INFO_SPLIT is not selectable with newer versions of LLVM:
$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)
GCC silently had a similar issue that was resolved with GCC 12.x. Restrict CONFIG_DEBUG_INFO_SPLIT for RISC-V when using LLVM or GCC < 12.x to avoid these known issues.
---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.
--- lib/Kconfig.debug | 5 +++++ 1 file changed, 5 insertions(+)
lib/Kconfig.debug +5 -0
@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information" config DEBUG_INFO_SPLIT bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf) + # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000 help Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds with DEBUG_INFO,
---
base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-riscv-debug_info_split-0713571a1ac2
Best regards,
Signature · 1 line
Nathan Chancellor <[email protected]>
Quoted 45 lines · Nathan Chancellor
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.
---lib/Kconfig.debug| 5 +++++1 file changed, 5 insertions(+)lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information"config
DEBUG_INFO_SPLITbool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf)lib/Kconfig.debug +5
-0+ # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000help
Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds withDEBUG_INFO,
Quoted 8 lines
---
base-commit:2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-riscv-debug_info_split-0713571a1ac2Best regards,
Signature · 1 line
Nathan Chancellor <[email protected]>
LGTM as the author of the Clang mitigation
(https://github.com/llvm/llvm-project/issues/56642) and several recent LLVM assembler side linker relaxation improvement (I continue updating
https://maskray.me/blog/2021-03-14-the-dark-side-of-riscv-linker-relaxation
about the complication of linker relaxation).
Nick Desaulniers
Reviewed-byQuoted 30 lines · Fangrui Song
Quoted 28 lines · Nathan Chancellor
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.
---lib/Kconfig.debug| 5 +++++1 file changed, 5 insertions(+)
Quoted 13 lines
lib/Kconfig.debug endchoice # "Compressed Debug information" · line 362
Quoted 13 lines
lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information"config
DEBUG_INFO_SPLIT
bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf)lib/Kconfig.debug +5
-0+ # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000
Thanks for the patch. I was initially surprised to see no explicit check for LLVM version. Rereading the commit description a few times, I think it makes sense, but I'm guessing we may need to rework this condition again should we eventually get split debug info working for riscv for llvm. I am looking to enable split debug info for kernels for Android's next release.
Fangrui, any thoughts on feasibility for -mrelax and -gsplit-dwarf composability for llvm?
Quoted 20 lines
Quoted 4 lines
help
Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds withDEBUG_INFO,Quoted 8 lines
---
base-commit:2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-riscv-debug_info_split-0713571a1ac2Best regards,
--
Nathan Chancellor <[email protected]>LGTM as the author of the Clang mitigation
(https://github.com/llvm/llvm-project/issues/56642) and several recent LLVM assembler side linker relaxation improvement (I continue updating
https://maskray.me/blog/2021-03-14-the-dark-side-of-riscv-linker-relaxation
about the complication of linker relaxation).Reviewed-by Fangrui Song <[email protected]>
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 53 lines · Nick Desaulniers
Quoted 30 lines · Fangrui Song
Quoted 28 lines · Nathan Chancellor
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.
---lib/Kconfig.debug| 5 +++++1 file changed, 5 insertions(+)Quoted 13 lines
lib/Kconfig.debug endchoice # "Compressed Debug information" · line 362
Quoted 13 lines
lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information"config
DEBUG_INFO_SPLIT
bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf)lib/Kconfig.debug +5
-0+ # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000Thanks for the patch. I was initially surprised to see no explicit check for LLVM version. Rereading the commit description a few times, I think it makes sense, but I'm guessing we may need to rework this condition again should we eventually get split debug info working for riscv for llvm. I am looking to enable split debug info for kernels for Android's next release.
Quoted 2 lines
Fangrui, any thoughts on feasibility for
-mrelaxand-gsplit-dwarfcomposability for llvm?
Yes, this should be feasible and is on my radar
(https://github.com/llvm/llvm-project/issues/56642#issuecomment-1548421026).
It's the next thing I'll do in my spare time after DWARF v5 & linker relaxation interop: https://reviews.llvm.org/D157657
Quoted 29 lines
Reviewed-by Nick Desaulniers <[email protected]>Quoted 13 lines
Quoted 4 lines
help
Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds withDEBUG_INFO,Quoted 8 lines
---
base-commit:2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-riscv-debug_info_split-0713571a1ac2Best regards,
--
Nathan Chancellor <[email protected]>Quoted 7 lines
LGTM as the author of the Clang mitigation
(https://github.com/llvm/llvm-project/issues/56642) and several recent LLVM assembler side linker relaxation improvement (I continue updating
https://maskray.me/blog/2021-03-14-the-dark-side-of-riscv-linker-relaxation
about the complication of linker relaxation).Reviewed-by Fangrui Song <[email protected]>--
Thanks,
~Nick Desaulniers
Signature · 1 line
宋方睿
Quoted 10 lines · Fangrui Song
On Wed, Aug 16, 2023 at 3:35 PM Nick Desaulniers
Quoted 2 lines
Fangrui, any thoughts on feasibility for
-mrelaxand-gsplit-dwarfcomposability for llvm?Yes, this should be feasible and is on my radar
(https://github.com/llvm/llvm-project/issues/56642#issuecomment-1548421026).It's the next thing I'll do in my spare time after DWARF v5 & linker relaxation interop: https://reviews.llvm.org/D157657
Cool, I've removed Saleem from the assignee field there and penciled you in; both because I think Saleem has new concerns and so that you don't lose track of it. Thank you.
Signature · 2 lines
Thanks, ~Nick Desaulniers
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Quoted 10 lines · On Wed, 16 Aug 2023 10:35:43 -0700 you wrote:
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:[...]
Here is the summary with links:
- lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
https://git.kernel.org/riscv/c/9fa9a5f2714d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 34 lines · On Wed, 16 Aug 2023 10:35:43 PDT (-0700), [email protected] wrote:
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.--- lib/Kconfig.debug | 5 +++++ 1 file changed, 5 insertions(+)lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information" config DEBUG_INFO_SPLIT
lib/Kconfig.debug endchoice # "Compressed Debug information" · line 365
Quoted 10 lines
lib/Kconfig.debug +5
-0bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf) + # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000 help Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds with DEBUG_INFO,
Not sure who's taking stuff for lib/Kconfig.debug, I can take it via the RISC-V tree if folks are OK with it. Kees and Andrew were the last to touch it.
Quoted 6 lines
---
base-commit:2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-riscv-debug_info_split-0713571a1ac2Best regards,
Quoted 49 lines · Palmer Dabbelt
Quoted 34 lines · On Wed, 16 Aug 2023 10:35:43 PDT (-0700), [email protected] wrote:
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.--- lib/Kconfig.debug | 5 +++++ 1 file changed, 5 insertions(+)lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information" config DEBUG_INFO_SPLITlib/Kconfig.debug endchoice # "Compressed Debug information" · line 365
Quoted 10 lines
lib/Kconfig.debug +5
-0bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf) + # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000 help Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds with DEBUG_INFO,Reviewed-by Palmer Dabbelt <[email protected]>Acked-by Palmer Dabbelt <[email protected]>
Quoted 3 lines
Not sure who's taking stuff for
lib/Kconfig.debug, I can take it via the RISC-V tree if folks are OK with it. Kees and Andrew were the last to touch it.
I don't think lib/Kconfig.debug has a formal maintainer. Given that and the fact that this change only affects RISC-V, I think it is entirely reasonable for you to take it.
Cheers,
Nathan
Quoted 50 lines · Nathan Chancellor
Quoted 49 lines · Palmer Dabbelt
Quoted 34 lines · On Wed, 16 Aug 2023 10:35:43 PDT (-0700), [email protected] wrote:
When building for ARCH=riscv using LLVM < 14, there is an error with
CONFIG_DEBUG_INFO_SPLIT=y:error: A dwo section may not contain relocations
This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with '-mrelax' (the default), so
CONFIG_DEBUG_INFO_SPLITis not selectable with newer versions of LLVM:$ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)GCC silently had a similar issue that was resolved with GCC 12.x. Restrict
CONFIG_DEBUG_INFO_SPLITfor RISC-V when using LLVM or GCC < 12.x to avoid these known issues.Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
Since this only impacts RISC-V, it seems reasonable that this would go in via their tree but I have added Andrew in case he wants to take it.--- lib/Kconfig.debug | 5 +++++ 1 file changed, 5 insertions(+)lib/Kconfig.debug +0
-0@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information" config DEBUG_INFO_SPLITlib/Kconfig.debug endchoice # "Compressed Debug information" · line 365
Quoted 10 lines
lib/Kconfig.debug +5
-0bool "Produce split debuginfo in .dwo files" depends on $(cc-option,-gsplit-dwarf) + # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC + # prior to 12.x: + # https://github.com/llvm/llvm-project/issues/56642 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 + depends on !RISCV || GCC_VERSION >= 120000 help Generate debug info into separate .dwo files. This significantly reduces the build directory size for builds with DEBUG_INFO,Reviewed-by Palmer Dabbelt <[email protected]>Acked-by Palmer Dabbelt <[email protected]>
Quoted 7 lines
Quoted 3 lines
Not sure who's taking stuff for
lib/Kconfig.debug, I can take it via the RISC-V tree if folks are OK with it. Kees and Andrew were the last to touch it.I don't think
lib/Kconfig.debughas a formal maintainer. Given that and the fact that this change only affects RISC-V, I think it is entirely reasonable for you to take it.
Agreed -- got for it. :)
Signature · 1 line
Kees Cook