aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-frv.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2005-03-31 20:39:14 +0000
committerKevin Buettner <kevinb@redhat.com>2005-03-31 20:39:14 +0000
commit186993b45845f14288bdb57ea581914decd9b024 (patch)
treedc4722e39802fc8be60734d8ffb5736e9cacdb7c /gdb/solib-frv.c
parentb27569303241f8fde83dc9f8ea6ba6193e32a419 (diff)
downloadfsf-binutils-gdb-186993b45845f14288bdb57ea581914decd9b024.zip
fsf-binutils-gdb-186993b45845f14288bdb57ea581914decd9b024.tar.gz
fsf-binutils-gdb-186993b45845f14288bdb57ea581914decd9b024.tar.bz2
Add TLS load module support for FRV.
Diffstat (limited to 'gdb/solib-frv.c')
-rw-r--r--gdb/solib-frv.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 3fb5424..ecc791a 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -201,6 +201,8 @@ struct lm_info
struct int_elf32_fdpic_loadmap *map;
/* The GOT address for this link map entry. */
CORE_ADDR got_value;
+ /* The link map address, needed for frv_fetch_objfile_link_map(). */
+ CORE_ADDR lm_addr;
/* Cached dynamic symbol table and dynamic relocs initialized and
used only by find_canonical_descriptor_in_load_object().
@@ -341,6 +343,9 @@ open_symbol_file_object (void *from_ttyp)
/* Cached value for lm_base(), below. */
static CORE_ADDR lm_base_cache = 0;
+/* Link map address for main module. */
+static CORE_ADDR main_lm_addr = 0;
+
/* Return the address from which the link map chain may be found. On
the FR-V, this may be found in a number of ways. Assuming that the
main executable has already been relocated, the easiest way to find
@@ -467,6 +472,7 @@ frv_current_sos (void)
sop->lm_info = xcalloc (1, sizeof (struct lm_info));
sop->lm_info->map = loadmap;
sop->lm_info->got_value = got_addr;
+ sop->lm_info->lm_addr = lm_addr;
/* Fetch the name. */
addr = extract_unsigned_integer (&lm_buf.l_name,
sizeof (lm_buf.l_name));
@@ -491,6 +497,10 @@ frv_current_sos (void)
*sos_next_ptr = sop;
sos_next_ptr = &sop->next;
}
+ else
+ {
+ main_lm_addr = lm_addr;
+ }
lm_addr = extract_unsigned_integer (&lm_buf.l_next, sizeof (lm_buf.l_next));
}
@@ -949,6 +959,7 @@ frv_clear_solib (void)
lm_base_cache = 0;
enable_break1_done = 0;
enable_break2_done = 0;
+ main_lm_addr = 0;
}
static void
@@ -1200,6 +1211,33 @@ find_canonical_descriptor_in_load_object
return addr;
}
+/* Given an objfile, return the address of its link map. This value is
+ needed for TLS support. */
+CORE_ADDR
+frv_fetch_objfile_link_map (struct objfile *objfile)
+{
+ struct so_list *so;
+
+ /* Cause frv_current_sos() to be run if it hasn't been already. */
+ if (main_lm_addr == 0)
+ solib_add (0, 0, 0, 1);
+
+ /* frv_current_sos() will set main_lm_addr for the main executable. */
+ if (objfile == symfile_objfile)
+ return main_lm_addr;
+
+ /* The other link map addresses may be found by examining the list
+ of shared libraries. */
+ for (so = master_so_list (); so; so = so->next)
+ {
+ if (so->objfile == objfile)
+ return so->lm_info->lm_addr;
+ }
+
+ /* Not found! */
+ return 0;
+}
+
static struct target_so_ops frv_so_ops;
void