+2005-03-31 Kevin Buettner <kevinb@redhat.com>
+
+ * solib-frv.c (struct lm_info): Add new field ``lm_addr''.
+ (main_lm_addr): New static global.
+ (frv_current_sos): Retain the link map address for each entry.
+ (frv_clear_solib): Clear main_lm_addr.
+ (frv_fetch_objfile_link_map): New function.
+ * frv-tdep.c (frv_gdbarch_init): Register TLS load module fetcher.
+ * frv-tdep.h (frv_fetch_objfile_link_map): Declare.
+
2005-03-31 Kevin Buettner <kevinb@redhat.com>
* gdbarch.sh (fetch_tls_load_module_address): New architecture method.
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().
/* 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
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));
*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));
}
lm_base_cache = 0;
enable_break1_done = 0;
enable_break2_done = 0;
+ main_lm_addr = 0;
}
static void
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