Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7196043rwi; Mon, 24 Oct 2022 11:04:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+TFuorogaOxwcOXz47N5WM7DnDJYydLJqvbhw7zvtZbN83ObjpvhE9d3v5/Gvx1gm5TrQ X-Received: by 2002:a17:90a:2e89:b0:212:ea82:bbb with SMTP id r9-20020a17090a2e8900b00212ea820bbbmr14263787pjd.171.1666634644101; Mon, 24 Oct 2022 11:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666634644; cv=none; d=google.com; s=arc-20160816; b=Tsb7PcL1TeUaQ6pH0o6nnK4ZUYxXFvGZkih+ndrL+MjVzMFZytKpZKAeirB0EwlrhN 7LvLuXZlTVrqO6NPn0BrcnL2OaReKs7mxMdR5YJgFEFSOJi45r2X3cMucQEXkCDzNqRZ YVPctdJF92DHQtfkG9I0fE6GxFoKuvDq6UM+3kmhKD8gifxFsSavpS4RP0ZGwpyoAZo/ kW9REf9Emu8KF9LE7GmiaKmY0KOHXg3ccQmYYfYgV+X+EOXw/xdsdf6YSrCjgyrCLdAN dWREeqOKO7gCoFviRKYJMHi4a8gh4mC9lO1dXox2rjI4Hq2wNhNm3QFjQ1zgu5AvfrLF 03Fw== 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=yDrOkvmDDJFd4hBqm1KHm7el3jw76dlnZteHWtgo3bo=; b=naOXKS+I0mpkaUwvKemoA+TmzlIq6TxndTBSlfozHOLWFdYz4hmfCrJYUfpt1f01Dv 7iY2July9FkHswxy4Url1T6ssfNZEBWLxKhLTqFzz1rTEJ0Cm420oNY09sDJXOSnVlFG 7qubK5mhRag59k7coRmR3UG5CGd6VVz/ald0Azbi++wAcdFhiOYtTmWqyzm67s77uvKp DqTmzcOlTz1kIkjjzW4eNWF4iQrvmyWQU4cFeznhYPuY1qDvAon++TgDTU6WNq/IuhW1 gNH0Uq7w1Q/nH1FE/O+pLdsiZ6+cU64dIuNIAJATZC25AiOCs5KTumhnIGkQIvuymUUd TvhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GUVN0tHk; 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 83-20020a630156000000b0046ef21af717si103670pgb.683.2022.10.24.11.03.51; Mon, 24 Oct 2022 11:04:04 -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=GUVN0tHk; 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 S232809AbiJXQv2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:51:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232898AbiJXQsp (ORCPT ); Mon, 24 Oct 2022 12:48:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BFE1BE9C; Mon, 24 Oct 2022 08:31:51 -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 53094B8164E; Mon, 24 Oct 2022 12:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1D93C433D6; Mon, 24 Oct 2022 12:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666616170; bh=nTvLyMk8o6gBGLsVFKxjp5Tas2PM0jRXs3Hr1HrQzYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GUVN0tHkcxPE0XprLsHkBhlawFh4aSQg2LHzxqakJk5zrBsikWP2dbJzHp1nJEhoO mEqIZdONzYe2ndtUBis9X994rOsUSvYEyNeUrAnlPuAqYFhLFYLXprkPbGMOFX0L53 l+j+chOJANbBfkhU23VG88LtFF2znmy6R2/jCTaY= 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.15 526/530] lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 Date: Mon, 24 Oct 2022 13:34:30 +0200 Message-Id: <20221024113108.815110599@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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.6 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 [nathan: Fix conflicts due to lack of f9b3cd24578401e] Signed-off-by: Nathan Chancellor 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 @@ -208,6 +208,11 @@ config DEBUG_BUGVERBOSE endmenu # "printk and dmesg options" +# 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:) + menu "Compile-time checks and compiler options" config DEBUG_INFO @@ -274,7 +279,7 @@ choice config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" - 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. @@ -296,7 +301,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" - 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) depends on !DEBUG_INFO_BTF help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc