linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, conor@kernel.org, maskray@google.com,
	ndesaulniers@google.com, linux-riscv@lists.infradead.org,
	llvm@lists.linux.dev, patches@lists.linux.dev
Subject: Re: [PATCH v2 3/3] lib/Kconfig.debug: Update AS_HAS_NON_CONST_LEB128 comment and name
Date: Wed, 13 Dec 2023 16:12:20 -0800	[thread overview]
Message-ID: <ZXpIZGE9e6F2d5Hk@ghost> (raw)
In-Reply-To: <20231205-riscv-restrict-dwarf5-llvm-v2-3-aedf00a382ac@kernel.org>

On Tue, Dec 05, 2023 at 04:53:52PM -0700, Nathan Chancellor wrote:
> Fangrui noted that the comment around CONFIG_AS_HAS_NON_CONST_LEB128
> could be made more accurate because explicit .sleb128 directives are not
> emitted, only .uleb128 directives are. Rename the symbol to
> CONFIG_AS_HAS_NON_CONST_ULEB128 as a result.
> 
> Further clarifications include replacing "symbol deltas" with the more
> accurate "label differences", noting that this issue has been resolved
> in newer binutils (2.41+), and it only occurs when a port uses RISC-V
> style linker relaxation.
> 
> Suggested-by: Fangrui Song <maskray@google.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  lib/Kconfig.debug | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index a0ebce05a368..76c2cc697573 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -231,9 +231,10 @@ config DEBUG_INFO
>  	  in the "Debug information" choice below, indicating that debug
>  	  information will be generated for build targets.
>  
> -# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which
> -# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215
> -config AS_HAS_NON_CONST_LEB128
> +# Clang generates .uleb128 with label differences for DWARF v5, a feature that
> +# older binutils ports do not support when utilizing RISC-V style linker
> +# relaxation: https://sourceware.org/bugzilla/show_bug.cgi?id=27215
> +config AS_HAS_NON_CONST_ULEB128
>  	def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:)

This seems like a good change. However the wording in your commit
message seems misleading. This config only ever checked for .uleb128
with a label difference and would assume that sleb128 with label
differences were supported. This seems more like a "bug" in the config
name that this is fixing. My interpretation is that your commit
describes why this issue was never caught (because sleb128 is not
emitted), but not the root of why this change is necessary (because
non-const sleb128 is not necessarily supported if non-const uleb128 is).
Anyways, it's just a commit message so not something that is important
to change.

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

>  
>  choice
> @@ -258,7 +259,7 @@ config DEBUG_INFO_NONE
>  config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
>  	bool "Rely on the toolchain's implicit default DWARF version"
>  	select DEBUG_INFO
> -	depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
> +	depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128)
>  	help
>  	  The implicit default version of DWARF debug info produced by a
>  	  toolchain changes over time.
> @@ -283,7 +284,7 @@ config DEBUG_INFO_DWARF5
>  	bool "Generate DWARF Version 5 debuginfo"
>  	select DEBUG_INFO
>  	depends on !ARCH_HAS_BROKEN_DWARF5
> -	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
> +	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128)
>  	help
>  	  Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
>  	  5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> 
> -- 
> 2.43.0
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-12-14  0:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 23:53 [PATCH v2 0/3] RISC-V: Disable DWARF5 with known broken LLVM versions Nathan Chancellor
2023-12-05 23:53 ` [PATCH v2 1/3] riscv: Hoist linker relaxation disabling logic into Kconfig Nathan Chancellor
2023-12-05 23:53 ` [PATCH v2 2/3] riscv: Restrict DWARF5 when building with LLVM to known working versions Nathan Chancellor
2023-12-06  2:11   ` Fangrui Song
2023-12-05 23:53 ` [PATCH v2 3/3] lib/Kconfig.debug: Update AS_HAS_NON_CONST_LEB128 comment and name Nathan Chancellor
2023-12-14  0:12   ` Charlie Jenkins [this message]
2024-01-18  2:11 ` [PATCH v2 0/3] RISC-V: Disable DWARF5 with known broken LLVM versions Palmer Dabbelt
2024-01-20 21:09 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXpIZGE9e6F2d5Hk@ghost \
    --to=charlie@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=maskray@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=palmer@dabbelt.com \
    --cc=patches@lists.linux.dev \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).