From: Simon Marchi <simark@simark.ca>
To: Keith Seitz <keiths@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/2] Fix ODR violations in regformat target descriptions
Date: Thu, 18 Jun 2026 11:57:46 -0400 [thread overview]
Message-ID: <3ce6ea60-f107-480a-8ca3-d8a2de2ec6ec@simark.ca> (raw)
In-Reply-To: <cover.1781792506.git.keiths@redhat.com>
On 2026-06-18 10:23, Keith Seitz wrote:
> Commit 1a5362ce51ef ("gdb, gdbserver: propagate use of target_desc unique
> pointers") changd most target descriptions to "const_target_desc_up," but
> deliberately left gdb/regformats/regdat.sh unchanged because those descriptions
> were still emitted as file-local static "struct target_desc" objects declared
> "const struct target_desc *".
>
> That mismatch breaks gdbserver on ppc64le when LTO is enabled. The shared
> header gdb/arch/ppc-linux-tdesc.h declares symbols such as
> "tdesc_powerpc_isa207_htm_vsx64l" as "const_target_desc_up," while regdat-
> generated translation units still define them as raw pointers. This reintroduces
> previously settled ODR violations.
>
> This series updates regdat.sh to generate code consistent with the unique-pointer
> API, then updates gdbserver targets that declare those symbols locally.
>
> There are no intended user-visible changes.
Other than the little nit I sent on patch 1, this series LGTM (although
I still don't fully understand why regdat exists and how it works).
Approved-By: Simon Marchi <simon.marchi@efficios.com>
It's unfortunate that this problem was only found by building with LTO.
If one builds without LTO, then I suppose it goes unnoticed and the
program could misbehave. Although in this case, a unique_ptr and a raw
pointer have the same memory footprint, so it was probably fine, by
chance.
The problem is that we have hardcoded declarations for whatever is in
the generated files. And since the generated files don't see the
declarations, the compiler doesn't complain about any mismatch. I think
it would be nice to change the scripts that generate these .c files to
also generate header files with matching declarations, and then have
the hand-written source files include these generated header files.
Simon
next prev parent reply other threads:[~2026-06-18 15:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 14:23 Keith Seitz
2026-06-18 14:23 ` [PATCH 1/2] regdat.sh: generate const_target_desc_up for register descriptions Keith Seitz
2026-06-18 15:52 ` Simon Marchi
2026-06-18 14:23 ` [PATCH 2/2] [gdbserver] Use const_target_desc_up for regformat tdescs Keith Seitz
2026-06-18 15:57 ` Simon Marchi [this message]
2026-06-18 17:10 ` [PATCH 0/2] Fix ODR violations in regformat target descriptions Tom Tromey
2026-07-07 19:49 ` Keith Seitz
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=3ce6ea60-f107-480a-8ca3-d8a2de2ec6ec@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.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