From: Luis Machado <luis.machado@arm.com>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 05/11] Internal TLS support for aarch64, x86_64, riscv, ppc64, and s390x
Date: Fri, 11 Oct 2024 09:12:55 +0100 [thread overview]
Message-ID: <2e2cd12e-4b1d-45db-92f8-ed37ef469fbb@arm.com> (raw)
In-Reply-To: <20241010022552.47637-6-kevinb@redhat.com>
Thanks for the patch.
On 10/10/24 03:16, Kevin Buettner wrote:
> For each architecture, aarch64, x86_64, riscv, ppc64, and s390x,
> this commit defines a suitable 'get_tls_dtv_addr' method and,
> when necessary, a 'get_tls_dtp_offset' method.
>
> It also registers linux_get_thread_local_address, defined in
> linux-tdep.c (in an earlier commit), as the get_thread_local_address
> gdbarch method. It also registers its architecture specific code
> using linux_register_tls_methods().
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24548
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31563
> ---
> gdb/aarch64-linux-tdep.c | 53 +++++++++++++++++++++++++++
> gdb/amd64-linux-tdep.c | 37 +++++++++++++++++++
> gdb/ppc-linux-tdep.c | 62 ++++++++++++++++++++++++++++++++
> gdb/riscv-linux-tdep.c | 78 ++++++++++++++++++++++++++++++++++++++++
> gdb/s390-linux-tdep.c | 43 ++++++++++++++++++++++
> 5 files changed, 273 insertions(+)
>
> diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
> index c608a84bc71..b03c2162a1a 100644
> --- a/gdb/aarch64-linux-tdep.c
> +++ b/gdb/aarch64-linux-tdep.c
> @@ -35,6 +35,7 @@
> #include "target/target.h"
> #include "expop.h"
> #include "auxv.h"
> +#include "inferior.h"
>
> #include "regcache.h"
> #include "regset.h"
> @@ -2693,6 +2694,55 @@ aarch64_use_target_description_from_corefile_notes (gdbarch *gdbarch,
> return true;
> }
>
> +/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
> + Throw a suitable TLS error if something goes wrong. */
> +
> +static CORE_ADDR
> +aarch64_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
> + linux_libc libc)
> +{
> + /* On aarch64, the thread pointer is found in the tpidr register. */
> + regcache *regcache
> + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
> + aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
> + target_fetch_registers (regcache, tdep->tls_regnum_base);
> + ULONGEST thr_ptr;
> + if (regcache->cooked_read (tdep->tls_regnum_base, &thr_ptr) != REG_VALID)
Since we're relying on TPIDR now, might be worth mentioning it is currently the
first register in the TLS feature. Just in case things change later on?
Otherwise the AArch64 bits look OK to me.
Reviewed-By: Luis Machado <luis.machado@arm.com>
next prev parent reply other threads:[~2024-10-11 8:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 2:16 [PATCH 00/11] GDB-internal TLS support for Linux targets Kevin Buettner
2024-10-10 2:16 ` [PATCH 01/11] Don't attempt to find TLS address when target has no registers Kevin Buettner
2024-10-10 2:16 ` [PATCH 02/11] Allow TLS access to work in gdb.server/no-thread-db.exp Kevin Buettner
2024-10-10 2:16 ` [PATCH 03/11] Track and fetch TLS module ids for MUSL and GLIBC Kevin Buettner
2024-10-10 2:16 ` [PATCH 04/11] Implement internal TLS address lookup for Linux targets Kevin Buettner
2024-10-10 2:16 ` [PATCH 05/11] Internal TLS support for aarch64, x86_64, riscv, ppc64, and s390x Kevin Buettner
2024-10-11 8:12 ` Luis Machado [this message]
2024-10-11 19:48 ` Kevin Buettner
2024-10-10 2:16 ` [PATCH 06/11] Internal, but disabled, TLS support for i386 Kevin Buettner
2024-10-10 2:16 ` [PATCH 07/11] Delete disabled i386 internal TLS support Kevin Buettner
2024-10-10 2:16 ` [PATCH 08/11] New test - gdb.base/tls-nothreads.exp Kevin Buettner
2024-10-10 2:16 ` [PATCH 09/11] New test - gdb.base/tls-multiobj.exp Kevin Buettner
2024-10-10 2:16 ` [PATCH 10/11] New test - gdb.base/tls-dlobj.exp Kevin Buettner
2024-10-10 2:16 ` [PATCH 11/11] Add TLS NEWS entry and document 'set force-internal-tls-address-lookup' command Kevin Buettner
2024-10-10 6:01 ` Eli Zaretskii
2024-10-10 23:27 ` Kevin Buettner
2024-10-11 5:42 ` Eli Zaretskii
2024-10-11 16:15 ` Kevin Buettner
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=2e2cd12e-4b1d-45db-92f8-ed37ef469fbb@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@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