+ struct target_section *sec)
+{
+ sec->addr = svr4_truncate_ptr (sec->addr + LM_ADDR_CHECK (so,
+ sec->bfd));
+ sec->endaddr = svr4_truncate_ptr (sec->endaddr + LM_ADDR_CHECK (so,
+ sec->bfd));
+}
+\f
+
+/* Architecture-specific operations. */
+
+/* Per-architecture data key. */
+static struct gdbarch_data *solib_svr4_data;
+
+struct solib_svr4_ops
+{
+ /* Return a description of the layout of `struct link_map'. */
+ struct link_map_offsets *(*fetch_link_map_offsets)(void);
+};
+
+/* Return a default for the architecture-specific operations. */
+
+static void *
+solib_svr4_init (struct obstack *obstack)
+{
+ struct solib_svr4_ops *ops;
+
+ ops = OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
+ ops->fetch_link_map_offsets = NULL;
+ return ops;
+}
+
+/* Set the architecture-specific `struct link_map_offsets' fetcher for
+ GDBARCH to FLMO. Also, install SVR4 solib_ops into GDBARCH. */
+
+void
+set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
+ struct link_map_offsets *(*flmo) (void))
+{
+ struct solib_svr4_ops *ops = gdbarch_data (gdbarch, solib_svr4_data);
+
+ ops->fetch_link_map_offsets = flmo;
+
+ set_solib_ops (gdbarch, &svr4_so_ops);
+}
+
+/* Fetch a link_map_offsets structure using the architecture-specific
+ `struct link_map_offsets' fetcher. */
+
+static struct link_map_offsets *
+svr4_fetch_link_map_offsets (void)
+{
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data);
+
+ gdb_assert (ops->fetch_link_map_offsets);
+ return ops->fetch_link_map_offsets ();
+}
+
+/* Return 1 if a link map offset fetcher has been defined, 0 otherwise. */
+
+static int
+svr4_have_link_map_offsets (void)
+{
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data);
+ return (ops->fetch_link_map_offsets != NULL);
+}
+\f
+
+/* Most OS'es that have SVR4-style ELF dynamic libraries define a
+ `struct r_debug' and a `struct link_map' that are binary compatible
+ with the origional SVR4 implementation. */
+
+/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
+ for an ILP32 SVR4 system. */
+
+struct link_map_offsets *
+svr4_ilp32_fetch_link_map_offsets (void)