[PATCH 01/12] Handle another edge case for TLS variable lookups.
John Baldwin
jhb@FreeBSD.org
Wed Mar 23 21:00:40 GMT 2022
This is similar to the change in
df22c1e5d53c38f38bce6072bb46de240f9e0e2b but applies to the main
object file. The original change I encountered when testing TLS on
RISC-V for which I was unable to test TLS variables in the main
executable due to issues with compiler-generated debug info, so I only
checked for a backlink before walking the list of shared library
object files.
However, I ran into this issue again (of a separate debug object file
being passed to svr4_fetch_objfile_link_map) when testing TLS
variables on 32-bit arm. To fix, move the check for a backlink
earlier before the check for the main object file.
---
gdb/solib-svr4.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 69f2991f5e6..aba476f6cf2 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1449,15 +1449,15 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
if (info->main_lm_addr == 0)
solib_add (NULL, 0, auto_solib_add);
- /* svr4_current_sos() will set main_lm_addr for the main executable. */
- if (objfile == current_program_space->symfile_object_file)
- return info->main_lm_addr;
-
/* If OBJFILE is a separate debug object file, look for the
original object file. */
if (objfile->separate_debug_objfile_backlink != NULL)
objfile = objfile->separate_debug_objfile_backlink;
+ /* svr4_current_sos() will set main_lm_addr for the main executable. */
+ if (objfile == current_program_space->symfile_object_file)
+ return info->main_lm_addr;
+
/* The other link map addresses may be found by examining the list
of shared libraries. */
for (struct so_list *so : current_program_space->solibs ())
--
2.34.1
More information about the Gdb-patches
mailing list