Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3927446rwi; Sat, 22 Oct 2022 02:21:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zlBEUnlUpnayKw7RSTW4NKZ0ogB1+GoCp38aCCUWiwugybG3W7EFGq0mQugADikmscVeu X-Received: by 2002:a17:90b:1a8d:b0:20d:be0b:a320 with SMTP id ng13-20020a17090b1a8d00b0020dbe0ba320mr48138559pjb.107.1666430490249; Sat, 22 Oct 2022 02:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430490; cv=none; d=google.com; s=arc-20160816; b=DN6KXZsczN1PaAiOVYMcgViSQQlV8s12LJsW9VmyZ3L1tnYk6E8a44g8gL0dBJe4Ul uv1F2DOr8mr6sB8o7SLG1yyxQv+m/Z/R84FggVWEFP2UFvRmYN07M07sB0s0FZWuHC0Q m9MAa+hTk7grc8EYzHKNzuG3qgawtS8RioOuiEkmtSdvAbOc9e1NixqDcOUQYzun8DPE 8EButdIzk2PHn4IX5Z7lbyuuJP//V68FVvziFPUOQorZ6hhCP2o9WzAvMv2dDbw2McYB DymwdieEEvcDbexqN3HvbeH7DNm4h3mA4ECryY4sUhJ0Hc+KOUTAD1dPHmNanZuPIfBE n6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gEXdejJfQmrxPYr9JOX8OPpO9WnXqVJ8F6fxO6eXNGU=; b=BM0Qidkf/L3yEYagilZ9XMH0b22FlZLVAT6lzYfu3qO1cVIJ0Y1KgaWFqfdlAS90Ad po0OzFj0EhD36cJPaW22RpZ708kjKlB9Ayik6J0pUyIRkhnfAhx1hU7ndOUTdXgLsqTh QkDE700xfhylF54dYbsczrW7KqEm37lJYqcjNrvB3TJCqNbfTjOY3BZMPPRGo9VR9O1z FytSFnmjS82FL8Fx6knUQVXCF4cNRAmE7X3NvrxV42tFmLfDeUvb9k0wg+hG3fX5SVyj rCqSfNXzSX8yrH2QWax0Ct8WjSJUZkA+NRxNO0Qv/f5U39CQUOJDaT9IGnUCY3IL4es6 5dAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M74X4bZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170903110f00b00178b88d40ebsi32876934plh.51.2022.10.22.02.21.18; Sat, 22 Oct 2022 02:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M74X4bZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234929AbiJVIun (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235094AbiJVItf (ORCPT ); Sat, 22 Oct 2022 04:49:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70CD28C318; Sat, 22 Oct 2022 01:10:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 813E9B82E0C; Sat, 22 Oct 2022 08:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF247C433D7; Sat, 22 Oct 2022 08:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426081; bh=QexgGbePdpSUxSJVDrDa2mgDst0/2mVL7ZvWwc9hdg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M74X4bZyZuggXw6RsyOJBxG+/4oh3fDNYP81PyjBDHT/Sxsu9MmVoyNqSpx1IrMqM IG5v/3q/6hPAYw4m5OCWgZ3/NzJ4N0sdMFXs2mZP5XSxfTL4ciSwSI0PcLvEPDyyG6 czfF34bD1WVQ28vMRYTH8ZH5eStvdrNioU6H+Jvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Masahiro Yamada Subject: [PATCH 5.19 712/717] lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 Date: Sat, 22 Oct 2022 09:29:51 +0200 Message-Id: <20221022072529.954572792@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor commit 0a6de78cff600cb991f2a1b7ed376935871796a0 upstream. When building with a RISC-V kernel with DWARF5 debug info using clang and the GNU assembler, several instances of the following error appear: /tmp/vgettimeofday-48aa35.s:2963: Error: non-constant .uleb128 is not supported Dumping the .s file reveals these .uleb128 directives come from .debug_loc and .debug_ranges: .Ldebug_loc0: .byte 4 # DW_LLE_offset_pair .uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset .uleb128 .Ltmp1-.Lfunc_begin0 # ending offset .byte 1 # Loc expr size .byte 90 # DW_OP_reg10 .byte 0 # DW_LLE_end_of_list .Ldebug_ranges0: .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp6-.Lfunc_begin0 # starting offset .uleb128 .Ltmp27-.Lfunc_begin0 # ending offset .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp28-.Lfunc_begin0 # starting offset .uleb128 .Ltmp30-.Lfunc_begin0 # ending offset .byte 0 # DW_RLE_end_of_list There is an outstanding binutils issue to support a non-constant operand to .sleb128 and .uleb128 in GAS for RISC-V but there does not appear to be any movement on it, due to concerns over how it would work with linker relaxation. To avoid these build errors, prevent DWARF5 from being selected when using clang and an assembler that does not have support for these symbol deltas, which can be easily checked in Kconfig with as-instr plus the small test program from the dwz test suite from the binutils issue. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 Link: https://github.com/ClangBuiltLinux/linux/issues/1719 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -231,6 +231,11 @@ 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 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL @@ -253,7 +258,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) + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time. @@ -277,7 +282,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) 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