* [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
@ 2023-08-16 17:35 Nathan Chancellor
2023-08-16 22:04 ` Fangrui Song
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Nathan Chancellor @ 2023-08-16 17:35 UTC (permalink / raw)
To: paul.walmsley, palmer, aou, akpm
Cc: conor, ndesaulniers, trix, linux-riscv, llvm, patches,
kernel test robot, 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_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.
Link: https://github.com/ClangBuiltLinux/linux/issues/1914
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
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(+)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d6798513a8c2..bd51274f4771 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -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,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 17:35 [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V Nathan Chancellor
@ 2023-08-16 22:04 ` Fangrui Song
2023-08-16 22:35 ` Nick Desaulniers
2023-08-30 13:20 ` patchwork-bot+linux-riscv
2023-08-30 13:22 ` Palmer Dabbelt
2 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2023-08-16 22:04 UTC (permalink / raw)
To: Nathan Chancellor
Cc: paul.walmsley, palmer, aou, akpm, conor, ndesaulniers, trix,
linux-riscv, llvm, patches, kernel test robot
On 2023-08-16, Nathan Chancellor 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_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.
>
>Link: https://github.com/ClangBuiltLinux/linux/issues/1914
>Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
>Reported-by: kernel test robot <lkp@intel.com>
>Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
>Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>---
>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(+)
>
>diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>index d6798513a8c2..bd51274f4771 100644
>--- a/lib/Kconfig.debug
>+++ b/lib/Kconfig.debug
>@@ -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,
>--
>Nathan Chancellor <nathan@kernel.org>
>
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 <maskray@google.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 22:04 ` Fangrui Song
@ 2023-08-16 22:35 ` Nick Desaulniers
2023-08-16 22:41 ` Fangrui Song
0 siblings, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2023-08-16 22:35 UTC (permalink / raw)
To: Fangrui Song
Cc: Nathan Chancellor, paul.walmsley, palmer, aou, akpm, conor, trix,
linux-riscv, llvm, patches, kernel test robot
On Wed, Aug 16, 2023 at 3:05 PM Fangrui Song <maskray@google.com> wrote:
>
> On 2023-08-16, Nathan Chancellor 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_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.
> >
> >Link: https://github.com/ClangBuiltLinux/linux/issues/1914
> >Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
> >Reported-by: kernel test robot <lkp@intel.com>
> >Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
> >Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> >---
> >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(+)
> >
> >diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> >index d6798513a8c2..bd51274f4771 100644
> >--- a/lib/Kconfig.debug
> >+++ b/lib/Kconfig.debug
> >@@ -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
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?
Link: https://github.com/llvm/llvm-project/issues/56642
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > 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,
> >--
> >Nathan Chancellor <nathan@kernel.org>
> >
>
> 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 <maskray@google.com>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 22:35 ` Nick Desaulniers
@ 2023-08-16 22:41 ` Fangrui Song
2023-08-16 22:43 ` Nick Desaulniers
0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2023-08-16 22:41 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Nathan Chancellor, paul.walmsley, palmer, aou, akpm, conor, trix,
linux-riscv, llvm, patches, kernel test robot
On Wed, Aug 16, 2023 at 3:35 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Wed, Aug 16, 2023 at 3:05 PM Fangrui Song <maskray@google.com> wrote:
> >
> > On 2023-08-16, Nathan Chancellor 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_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.
> > >
> > >Link: https://github.com/ClangBuiltLinux/linux/issues/1914
> > >Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
> > >Reported-by: kernel test robot <lkp@intel.com>
> > >Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
> > >Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > >---
> > >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(+)
> > >
> > >diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > >index d6798513a8c2..bd51274f4771 100644
> > >--- a/lib/Kconfig.debug
> > >+++ b/lib/Kconfig.debug
> > >@@ -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
>
> 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?
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
> Link: https://github.com/llvm/llvm-project/issues/56642
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> > > 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,
> > >--
> > >Nathan Chancellor <nathan@kernel.org>
> > >
> >
> > 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 <maskray@google.com>
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
--
宋方睿
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 22:41 ` Fangrui Song
@ 2023-08-16 22:43 ` Nick Desaulniers
0 siblings, 0 replies; 9+ messages in thread
From: Nick Desaulniers @ 2023-08-16 22:43 UTC (permalink / raw)
To: Fangrui Song
Cc: Nathan Chancellor, paul.walmsley, palmer, aou, akpm, conor, trix,
linux-riscv, llvm, patches, kernel test robot
On Wed, Aug 16, 2023 at 3:41 PM Fangrui Song <maskray@google.com> wrote:
>
> On Wed, Aug 16, 2023 at 3:35 PM Nick Desaulniers
> > Fangrui, any thoughts on feasibility for `-mrelax` and `-gsplit-dwarf`
> > composability 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.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 17:35 [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V Nathan Chancellor
2023-08-16 22:04 ` Fangrui Song
@ 2023-08-30 13:20 ` patchwork-bot+linux-riscv
2023-08-30 13:22 ` Palmer Dabbelt
2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-30 13:20 UTC (permalink / raw)
To: Nathan Chancellor
Cc: linux-riscv, paul.walmsley, palmer, aou, akpm, conor,
ndesaulniers, trix, llvm, patches, lkp
Hello:
This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:
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_SPLIT is 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-16 17:35 [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V Nathan Chancellor
2023-08-16 22:04 ` Fangrui Song
2023-08-30 13:20 ` patchwork-bot+linux-riscv
@ 2023-08-30 13:22 ` Palmer Dabbelt
2023-08-30 15:36 ` Nathan Chancellor
2 siblings, 1 reply; 9+ messages in thread
From: Palmer Dabbelt @ 2023-08-30 13:22 UTC (permalink / raw)
To: nathan, keescook, akpm
Cc: Paul Walmsley, aou, akpm, Conor Dooley, ndesaulniers, trix,
linux-riscv, llvm, patches, lkp, nathan
On Wed, 16 Aug 2023 10:35:43 PDT (-0700), nathan@kernel.org 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_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.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1914
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 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(+)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d6798513a8c2..bd51274f4771 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -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,
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
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.
>
> ---
> base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> change-id: 20230816-riscv-debug_info_split-0713571a1ac2
>
> Best regards,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-30 13:22 ` Palmer Dabbelt
@ 2023-08-30 15:36 ` Nathan Chancellor
2023-08-30 23:44 ` Kees Cook
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2023-08-30 15:36 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: keescook, akpm, Paul Walmsley, aou, Conor Dooley, ndesaulniers,
trix, linux-riscv, llvm, patches, lkp
On Wed, Aug 30, 2023 at 06:22:45AM -0700, Palmer Dabbelt wrote:
> On Wed, 16 Aug 2023 10:35:43 PDT (-0700), nathan@kernel.org 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_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.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1914
> > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > 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(+)
> >
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index d6798513a8c2..bd51274f4771 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -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,
>
> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
>
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V
2023-08-30 15:36 ` Nathan Chancellor
@ 2023-08-30 23:44 ` Kees Cook
0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2023-08-30 23:44 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Palmer Dabbelt, akpm, Paul Walmsley, aou, Conor Dooley,
ndesaulniers, trix, linux-riscv, llvm, patches, lkp
On Wed, Aug 30, 2023 at 08:36:46AM -0700, Nathan Chancellor wrote:
> On Wed, Aug 30, 2023 at 06:22:45AM -0700, Palmer Dabbelt wrote:
> > On Wed, 16 Aug 2023 10:35:43 PDT (-0700), nathan@kernel.org 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_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.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1914
> > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > > 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(+)
> > >
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index d6798513a8c2..bd51274f4771 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -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,
> >
> > Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
> > Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> >
> > 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.
Agreed -- got for it. :)
--
Kees Cook
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-08-30 23:44 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 17:35 [PATCH] lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V Nathan Chancellor
2023-08-16 22:04 ` Fangrui Song
2023-08-16 22:35 ` Nick Desaulniers
2023-08-16 22:41 ` Fangrui Song
2023-08-16 22:43 ` Nick Desaulniers
2023-08-30 13:20 ` patchwork-bot+linux-riscv
2023-08-30 13:22 ` Palmer Dabbelt
2023-08-30 15:36 ` Nathan Chancellor
2023-08-30 23:44 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).