public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/14] Support for Thread Local Storage (TLS) variables on FreeBSD arm and aarch64 architectures.
@ 2022-04-12 23:46 John Baldwin
  2022-04-12 23:46 ` [PATCH v2 01/14] fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET John Baldwin
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: John Baldwin @ 2022-04-12 23:46 UTC (permalink / raw)
  To: gdb-patches

Changes since V1:

- I changed the register number for TPIDR on Aarch64 to a fixed value
  locally in GDB itself.  (I had misparsed Luis's original reply to
  using a fixed register on 32-bit ARM.)  This does work in my testing
  on both FreeBSD and Linux, but it is a debatable point if new
  extensions should use fixed register numbers (as on amd64/i386) or
  variable register numbers with base register numbers in the per-arch
  tdep class (as Aarch64 has done more recently).

  An advantage of fixed register numbers is that regcache_map_entry
  arrays used with regsets can be const globals and shared between
  *-tdep.c and *-nat.c files.  A disadvantage is that fixed numbers
  leave gaps in some of the internal arrays stored in a tdesc.  I'm
  also not sure that they can be used as easily in gdbserver.  At
  least for TPIDR on on Linux Aarch64 I had to lookup gdbserver's
  register number dynmically vs using the constant.

- I added support for TPIDR on Linux Aarch64.  There are some XXX
  comments as I didn't add any tests to see if NT_ARM_TLS is supported
  or not but just assume it is always present (since other places that
  use NT_ARM_TLS seem to assume it is always present).  The Linux
  changes do not try to change TLS variable resolution, but simply
  report the register's value.  I did do light testing on a RPi both
  for core dumps, native, and gdbserver showing that $tpidr showed a
  sensible value for all three cases for a simple test program which
  prints out the address of a TLS variable in the main executable (and
  verified that the tpidr register value was "close" to the printed
  address).

John Baldwin (14):
  fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET.
  Create pseudo sections for NT_ARM_TLS notes on FreeBSD.
  Add an arm-tls feature which includes the tpidruro register from CP15.
  Read the tpidruro register from NT_ARM_TLS core dump notes on
    FreeBSD/arm.
  Support TLS variables on FreeBSD/arm.
  Fetch the NT_ARM_TLS register set for native FreeBSD/arm processes.
  Add an aarch64-tls feature which includes the tpidr register.
  Read the tpidr register from NT_ARM_TLS core dump notes on
    FreeBSD/Aarch64.
  Support TLS variables on FreeBSD/Aarch64.
  Fetch the NT_ARM_TLS register set for native FreeBSD/Aarch64
    processes.
  NEWS: Add a note for TLS support on FreeBSD/arm and FreeBSD/Aarch64.
  Read the tpidr register from NT_ARM_TLS core dump notes on Linux
    Aarch64.
  gdbserver: Read the tpidr register from NT_ARM_TLS on Linux.
  Read the tpidr register from NT_ARM_TLS on Linux.

 bfd/ChangeLog                    |  4 ++
 bfd/elf.c                        |  3 ++
 gdb/NEWS                         |  3 ++
 gdb/aarch64-fbsd-nat.c           | 26 +++++++++++
 gdb/aarch64-fbsd-tdep.c          | 61 ++++++++++++++++++++++++++
 gdb/aarch64-fbsd-tdep.h          |  4 ++
 gdb/aarch64-linux-nat.c          | 57 +++++++++++++++++++++++-
 gdb/aarch64-linux-tdep.c         | 20 ++++++++-
 gdb/aarch64-linux-tdep.h         |  4 ++
 gdb/aarch64-tdep.c               | 30 ++++++++++---
 gdb/aarch64-tdep.h               | 10 ++++-
 gdb/arch/aarch32.c               |  2 +
 gdb/arch/aarch64.c               |  7 ++-
 gdb/arch/aarch64.h               |  9 +++-
 gdb/arch/arm.c                   |  6 ++-
 gdb/arch/arm.h                   |  7 +--
 gdb/arm-fbsd-nat.c               | 15 ++++++-
 gdb/arm-fbsd-tdep.c              | 57 +++++++++++++++++++++---
 gdb/arm-fbsd-tdep.h              |  6 ++-
 gdb/arm-linux-nat.c              |  6 +--
 gdb/arm-linux-tdep.c             |  4 +-
 gdb/arm-netbsd-nat.c             |  4 +-
 gdb/arm-tdep.c                   | 20 ++++++---
 gdb/arm-tdep.h                   |  2 +-
 gdb/fbsd-nat.c                   | 75 ++++++++++++++++++++++++++++++++
 gdb/fbsd-nat.h                   | 38 ++++++++++++++++
 gdb/features/Makefile            |  2 +
 gdb/features/aarch64-tls.c       | 14 ++++++
 gdb/features/aarch64-tls.xml     | 11 +++++
 gdb/features/arm/arm-tls.c       | 14 ++++++
 gdb/features/arm/arm-tls.xml     | 11 +++++
 gdbserver/linux-aarch64-ipa.cc   |  8 ++--
 gdbserver/linux-aarch64-low.cc   | 28 +++++++++++-
 gdbserver/linux-aarch64-tdesc.cc | 11 ++---
 gdbserver/linux-aarch64-tdesc.h  |  2 +-
 gdbserver/netbsd-aarch64-low.cc  |  2 +-
 36 files changed, 533 insertions(+), 50 deletions(-)
 create mode 100644 gdb/features/aarch64-tls.c
 create mode 100644 gdb/features/aarch64-tls.xml
 create mode 100644 gdb/features/arm/arm-tls.c
 create mode 100644 gdb/features/arm/arm-tls.xml

-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-04-13  2:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 23:46 [PATCH v2 00/14] Support for Thread Local Storage (TLS) variables on FreeBSD arm and aarch64 architectures John Baldwin
2022-04-12 23:46 ` [PATCH v2 01/14] fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET John Baldwin
2022-04-12 23:46 ` [PATCH v2 02/14] Create pseudo sections for NT_ARM_TLS notes on FreeBSD John Baldwin
2022-04-12 23:46 ` [PATCH v2 03/14] Add an arm-tls feature which includes the tpidruro register from CP15 John Baldwin
2022-04-12 23:46 ` [PATCH v2 04/14] Read the tpidruro register from NT_ARM_TLS core dump notes on FreeBSD/arm John Baldwin
2022-04-12 23:46 ` [PATCH v2 05/14] Support TLS variables " John Baldwin
2022-04-12 23:46 ` [PATCH v2 06/14] Fetch the NT_ARM_TLS register set for native FreeBSD/arm processes John Baldwin
2022-04-12 23:46 ` [PATCH v2 07/14] Add an aarch64-tls feature which includes the tpidr register John Baldwin
2022-04-12 23:46 ` [PATCH v2 08/14] Read the tpidr register from NT_ARM_TLS core dump notes on FreeBSD/Aarch64 John Baldwin
2022-04-12 23:46 ` [PATCH v2 09/14] Support TLS variables " John Baldwin
2022-04-12 23:46 ` [PATCH v2 10/14] Fetch the NT_ARM_TLS register set for native FreeBSD/Aarch64 processes John Baldwin
2022-04-12 23:46 ` [PATCH v2 11/14] NEWS: Add a note for TLS support on FreeBSD/arm and FreeBSD/Aarch64 John Baldwin
2022-04-13  2:31   ` Eli Zaretskii
2022-04-12 23:46 ` [PATCH v2 12/14] Read the tpidr register from NT_ARM_TLS core dump notes on Linux Aarch64 John Baldwin
2022-04-12 23:46 ` [PATCH v2 13/14] gdbserver: Read the tpidr register from NT_ARM_TLS on Linux John Baldwin
2022-04-12 23:46 ` [PATCH v2 14/14] " John Baldwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).