From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id FAmZN7L/M2oYlw0AWB0awg (envelope-from ) for ; Thu, 18 Jun 2026 10:24:50 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E5wB1mvM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D1FA11E024; Thu, 18 Jun 2026 10:24:50 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 92ABB1E024 for ; Thu, 18 Jun 2026 10:24:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4E9F4BA23CC for ; Thu, 18 Jun 2026 14:24:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4E9F4BA23CC Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E5wB1mvM Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 6DF6F4BA799B for ; Thu, 18 Jun 2026 14:24:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DF6F4BA799B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6DF6F4BA799B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781792642; cv=none; b=L+Yva7/mTeqbrjkT/RF1zNozlWWghENcEncxHcTsUzx4EAK57P5AjBi6MbWl/+qfbSzm+HDrewQMpme1BL17DL5gdyvR9OoshoVsmC5d5o+AEFbXIiNtHlKv+iW3MMf46Z29j+2NDMeRTDll4+XSYbyYZAc7ZR4xWWbg51/5fcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781792642; c=relaxed/simple; bh=qIWpF21UpqNYlJSsLbEE7Tap6gEGwWor9K5NsQSSlpc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ga9Si+VjgOrPs7zwlJ8Mw1U0OmqkhJZkPunLT6l3DulvPiTR+BHp2GZhTM/KL2vShQBx8nABse5/a80uTm2TOBLgEnblXZS3/LZArAu0t0/cFzUIa1KKMoypO6VAwJtwoCtbBwQCQLSTAJgZI/R1IK2fxykinkjZrts28t0v2Zc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E5wB1mvM DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DF6F4BA799B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781792642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cP1K3KC266SrKwvuTyXNt2uCayJ7I2tlWS0ENXD2nVo=; b=E5wB1mvMzVGzdafN9jjT/yAFMiaUygIC6RLeBZH7njyEYC+RJqueb2zuzIxahbvlHERziW 9f8P23JHV0uwoqQ2LypGgonFhz52CEnzfX72rukyJnqOJtpXdtX3lAR2eveknHaCW88wpP gwoorvcCwBO6I+RkeZ7ZmwTsICMvrPk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-Fd-MJKIBM9KwDtAa-F1ebA-1; Thu, 18 Jun 2026 10:24:00 -0400 X-MC-Unique: Fd-MJKIBM9KwDtAa-F1ebA-1 X-Mimecast-MFC-AGG-ID: Fd-MJKIBM9KwDtAa-F1ebA_1781792640 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4FFC19560BB for ; Thu, 18 Jun 2026 14:23:59 +0000 (UTC) Received: from keiths-thinkpadp1gen7.rmtuswa.csb (unknown [10.22.65.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 036581956044 for ; Thu, 18 Jun 2026 14:23:58 +0000 (UTC) From: Keith Seitz To: gdb-patches@sourceware.org Subject: [PATCH 1/2] regdat.sh: generate const_target_desc_up for register descriptions Date: Thu, 18 Jun 2026 07:23:55 -0700 Message-ID: <3b7d26075e66f53cafc44f571165de54527d923b.1781792506.git.keiths@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: emcPxjzgmdtX0m1xXU1VeGypHz0NoFFDcr4eBHi4Krg_1781792640 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Late last year, a patch propagated the use of target_desc unique pointers (commit 1a5362ce51ef79ffb61caa20c93284dc368dc74a). At the time, the "old regformats/regdat.sh [weren't] changed because their target_desc objects are statically allocated in the generated files." Unfortunately that re-introduced ODR violations on ppc64le: CXXLD gdbserver ../../src/gdbserver/../gdb/arch/ppc-linux-tdesc.h:46:29: error: ‘tdesc_powerpc_isa207_htm_vsx64l’ violates the C++ One Definition Rule [-Werror=odr] 46 | extern const_target_desc_up tdesc_powerpc_isa207_htm_vsx64l; | ^ powerpc-isa207-htm-vsx64l-generated.cc:26:27: note: ‘tdesc_powerpc_isa207_htm_vsx64l’ was previously declared here 26 | const struct target_desc *tdesc_powerpc_isa207_htm_vsx64l; | ^ powerpc-isa207-htm-vsx64l-generated.cc:26:27: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used Update regdat.sh so that generated init_registers_* code matches the const-unique_ptr-based target description API, resolving the ODR violation. A follow-up patch updates various gdbserver architectures to accommodate this API change. Tested on ppc64le and s390x Fedora 43 and mips-linux cross build (all with LTO). Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28444 --- gdb/regformats/regdat.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh index aeb41f6b7ad..af2bdc28810 100755 --- a/gdb/regformats/regdat.sh +++ b/gdb/regformats/regdat.sh @@ -125,7 +125,7 @@ do if test "${type}" = "name"; then name="${entry}" - echo "const struct target_desc *tdesc_${name};" + echo "const_target_desc_up tdesc_${name};" echo "" # This is necessary for -Wmissing-declarations. @@ -134,9 +134,8 @@ do echo "void" echo "init_registers_${name} (void)" echo "{" - echo " static struct target_desc tdesc_${name}_s;" - echo " struct target_desc *result = &tdesc_${name}_s;" - echo " struct tdesc_feature *feature = tdesc_create_feature (result, \"${name}\");" + echo " target_desc_up result = allocate_target_description ();" + echo " struct tdesc_feature *feature = tdesc_create_feature (result.get (), \"${name}\");" continue elif test "${type}" = "xmltarget"; then xmltarget="${entry}" @@ -195,12 +194,12 @@ echo osabi_enum=$(grep "${osabi}" "$2" | sed 's/.*(\([^,]\+\),.*/GDB_OSABI_\1/') cat <xmltarget = xmltarget_${name}; + result.get ()->xmltarget = xmltarget_${name}; #endif - init_target_desc (result, expedite_regs_${name}, ${osabi_enum}); + init_target_desc (result.get (), expedite_regs_${name}, ${osabi_enum}); - tdesc_${name} = result; + tdesc_${name} = std::move (result); } EOF -- 2.53.0