[07/11] Delete disabled i386 internal TLS support

Message ID 20241010022552.47637-8-kevinb@redhat.com
State New
Headers
Series GDB-internal TLS support for Linux targets |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Kevin Buettner Oct. 10, 2024, 2:16 a.m. UTC
  As mentioned in the previous commit, this commit deletes the disabled
code which could be used to implement internal TLS support for the
i386 target.
---
 gdb/i386-linux-tdep.c | 44 -------------------------------------------
 1 file changed, 44 deletions(-)
  

Patch

diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 8e9ffe984a3..9dec83ac753 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -753,45 +753,6 @@  i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
   return closure_;
 }
 
-#if 0
-/* Disabled because fetching I386_GSBASE_REGNUM causes an internal
-   error.  */
-
-/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
-   Throw a suitable TLS error if something goes wrong.  */
-
-static CORE_ADDR
-i386_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
-			     enum linux_libc libc)
-{
-  /* On i386, the thread pointer is found in the gsbase register.  */
-  regcache *regcache
-    = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
-  target_fetch_registers (regcache, I386_GSBASE_REGNUM);
-  ULONGEST gsbase;
-  if (regcache->cooked_read (I386_GSBASE_REGNUM, &gsbase) != REG_VALID)
-    throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
-
-  /* The thread pointer (gsbase) points at the TCB (thread control
-     block).  The first two members of this struct are both pointers,
-     where the first will be a pointer to the TCB (i.e. it points at
-     itself) and the second will be a pointer to the DTV (dynamic
-     thread vector).  There are many other fields too, but the one
-     we care about here is the DTV pointer.  Compute the address
-     of the DTV pointer, fetch it, and convert it to an address.  */
-  CORE_ADDR dtv_ptr_addr
-    = gsbase + gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
-  gdb_byte buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT];
-  if (target_read_memory (dtv_ptr_addr, buf, sizeof buf) != 0)
-    throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
-
-  const struct builtin_type *builtin = builtin_type (gdbarch);
-  CORE_ADDR dtv_addr = gdbarch_pointer_to_address
-			 (gdbarch, builtin->builtin_data_ptr, buf);
-  return dtv_addr;
-}
-#endif
-
 static void
 i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -1027,11 +988,6 @@  i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
 					     svr4_fetch_objfile_link_map);
-#if 0
-  set_gdbarch_get_thread_local_address (gdbarch,
-					linux_get_thread_local_address);
-  linux_register_tls_methods (info, gdbarch, i386_linux_get_tls_dtv_addr);
-#endif
 
   /* Core file support.  */
   set_gdbarch_iterate_over_regset_sections