Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _SYSCALL32 /* for Sparc64 cross Sparc32 */
#include "defs.h"
#include "gdbcore.h"
#include "solib-svr4.h"
#ifdef HAVE_LINK_H
+
+#ifdef HAVE_NLIST_H
+/* nlist.h needs to be included before link.h on some older *BSD systems. */
+#include <nlist.h>
+#endif
+
#include <link.h>
/* Fetch (and possibly build) an appropriate link_map_offsets structure
{
lmp = &lmo;
-#ifdef SVR4_SHARED_LIBS
+#ifdef HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS
lmo.r_debug_size = sizeof (struct r_debug);
lmo.r_map_offset = offsetof (struct r_debug, r_map);
lmo.l_name_offset = offsetof (struct link_map, l_name);
lmo.l_name_size = fieldsize (struct link_map, l_name);
-#else /* !SVR4_SHARED_LIBS */
+#else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS) */
+#ifdef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS
lmo.link_map_size = sizeof (struct link_map);
lmo.l_addr_offset = offsetof (struct link_map, lm_addr);
lmo.l_name_offset = offsetof (struct link_map, lm_name);
lmo.l_name_size = fieldsize (struct link_map, lm_name);
-#endif /* SVR4_SHARED_LIBS */
+#else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS) */
+#if HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
+ lmo.link_map_size = sizeof (struct so_map);
+
+ lmo.l_addr_offset = offsetof (struct so_map, som_addr);
+ lmo.l_addr_size = fieldsize (struct so_map, som_addr);
+
+ lmo.l_next_offset = offsetof (struct so_map, som_next);
+ lmo.l_next_size = fieldsize (struct so_map, som_next);
+
+ lmo.l_name_offset = offsetof (struct so_map, som_path);
+ lmo.l_name_size = fieldsize (struct so_map, som_path);
+#endif /* HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
+#endif /* HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
+#endif /* HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS */
}
#if defined (HAVE_STRUCT_LINK_MAP32)
#endif /* defined (HAVE_STRUCT_LINK_MAP32) */
#if defined (HAVE_STRUCT_LINK_MAP32)
- if (bfd_get_arch_size (exec_bfd) == 32)
+ if (exec_bfd != NULL)
+ {
+ if (bfd_get_arch_size (exec_bfd) == 32)
+ return lmp32;
+ }
+ if (TARGET_PTR_BIT == 32)
return lmp32;
- else
#endif
- return lmp;
+ return lmp;
}
#endif /* HAVE_LINK_H */