Skip to content

Commit 89775a2

Browse files
nathanchancepalmer-dabbelt
authored andcommitted
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. Link: ClangBuiltLinux#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> Reviewed-by: Fangrui Song <maskray@google.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230816-riscv-debug_info_split-v1-1-d1019d6ccc11@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 94f0038 commit 89775a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Kconfig.debug

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ endchoice # "Compressed Debug information"
355355
config DEBUG_INFO_SPLIT
356356
bool "Produce split debuginfo in .dwo files"
357357
depends on $(cc-option,-gsplit-dwarf)
358+
# RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC
359+
# prior to 12.x:
360+
# https://github.com/llvm/llvm-project/issues/56642
361+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
362+
depends on !RISCV || GCC_VERSION >= 120000
358363
help
359364
Generate debug info into separate .dwo files. This significantly
360365
reduces the build directory size for builds with DEBUG_INFO,

0 commit comments

Comments
 (0)