Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp875031rwi; Wed, 19 Oct 2022 04:11:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5H8fr/bvwiHDds090zYWFedxjZgUrzgcqmKvzfY8RUKeE9IxzzC2tTS07+Oqnh/U2V9Hof X-Received: by 2002:a17:907:a4c:b0:77b:ba98:d3e with SMTP id be12-20020a1709070a4c00b0077bba980d3emr6283913ejc.13.1666177852751; Wed, 19 Oct 2022 04:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177852; cv=none; d=google.com; s=arc-20160816; b=flSwlgpOhmJ8I4U/thvhcu3GTR2W9YBrGzCbEhpGHxRMtQ8e2FaMDvRtABo+WRouRh TnrkNgqRa4Cmv6YedoxrNLlPqejXzvHOgPSS4h+O354+l3Zn/koB3B40sO1RXX/1BShX rpdpEagKEla1VvZC/cv1dVikZRSTAiyv5YE6VxnyMy/eEjC1Z7kpVWv1KByVv0tK5/jO /8f2e9udD2wAXn+pe2Ko3kR8vP4OGsk9xplmMlEZXcVdwRd1+0ciyL6RgTWp4X/Afhvi a7xu8OHXB0wmo9UFK6+5T7bAAP84zDUt7Wnvwuj3O1BywJDRWbzmGgC+jkPcfPfUWK/G HJ7Q== 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=Hd7mFaXNRxeStsY2+muccd5YL1BhCRD+h9pOR/ob+pK9s6MMmIrUYBcAQPkrOkD0xZ j0LNf9dKz+wOQs2TWzmUIN64R4d4Dl/Q/vOy7PXUdERXt1bZU/leN5QltI0WIKsAe4Bw r+sk7KHVAdrmjGD503pfD1nH2EaVahzyQzGhXM6cfWrwLxXIHBBR7c1hU1jG0dIGfnT6 YRED1Ra5yFk0P+t0+TXpejNJdCw5yzURO3l3WAaL2Q5HnIkOCtXprGxXZxck6ECoZVg6 R5pOxSy4bbBus+l7Cfmi7fwn5HZFnQ6dw3rZJcV9xHFlKp4kX7LHh10ZHPsWJDsSms7P 5Mtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TtiFKQ2Q; 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 sc11-20020a1709078a0b00b0078de51e1c3dsi13857622ejc.840.2022.10.19.04.10.14; Wed, 19 Oct 2022 04:10:52 -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=TtiFKQ2Q; 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 S234233AbiJSJnq (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234494AbiJSJke (ORCPT ); Wed, 19 Oct 2022 05:40:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 259FDF034C; Wed, 19 Oct 2022 02:17:03 -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 dfw.source.kernel.org (Postfix) with ESMTPS id EC4D2617D4; Wed, 19 Oct 2022 09:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF97C433D6; Wed, 19 Oct 2022 09:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170985; bh=QexgGbePdpSUxSJVDrDa2mgDst0/2mVL7ZvWwc9hdg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtiFKQ2QcSimwPXZrXwENvmC7w4H0TsyGY9ZovRjrdu4TlCMrX5cXIix5TF8WMON0 UgniEYQ2gwLxEVryboTjTg3p6KfxsE9WJsnH/0G3CiHG1y3IzJ47JYi5y/JYaJRlBn znuWmjdweXTbTH9prsS3IxB2Qx927J1Pb/7B/plI= 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 6.0 862/862] lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 Date: Wed, 19 Oct 2022 10:35:49 +0200 Message-Id: <20221019083327.989995776@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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