1 /* Handle SOM shared libraries for GDB, the GNU Debugger.
3 Copyright 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
32 #include "hppa-tdep.h"
37 /* These ought to be defined in some public interface, but aren't. They
38 define the meaning of the various bits in the distinguished __dld_flags
39 variable that is declared in every debuggable a.out on HP-UX, and that
40 is shared between the debugger and the dynamic linker.
42 #define DLD_FLAGS_MAPPRIVATE 0x1
43 #define DLD_FLAGS_HOOKVALID 0x2
44 #define DLD_FLAGS_LISTVALID 0x4
45 #define DLD_FLAGS_BOR_ENABLE 0x8
49 /* Version of this structure (it is expected to change again in hpux10). */
50 unsigned char struct_version;
52 /* Binding mode for this library. */
53 unsigned char bind_mode;
55 /* Version of this library. */
56 short library_version;
58 /* Start of text address,
59 link-time text location (length of text area),
60 end of text address. */
62 CORE_ADDR text_link_addr;
65 /* Start of data, start of bss and end of data. */
70 /* Value of linkage pointer (%r19). */
73 /* Address in target of offset from thread-local register of
74 start of this thread's data. I.e., the first thread-local
75 variable in this shared library starts at *(tsd_start_addr)
76 from that area pointed to by cr27 (mpsfu_hi).
78 We do the indirection as soon as we read it, so from then
79 on it's the offset itself. */
80 CORE_ADDR tsd_start_addr;
82 /* Address of the link map entry in the loader. */
86 /* These addresses should be filled in by som_solib_create_inferior_hook.
87 They are also used elsewhere in this module.
92 struct unwind_table_entry *unwind;
96 /* When adding fields, be sure to clear them in _initialize_som_solib. */
100 addr_and_unwind_t hook;
101 addr_and_unwind_t hook_stub;
102 addr_and_unwind_t load;
103 addr_and_unwind_t load_stub;
104 addr_and_unwind_t unload;
105 addr_and_unwind_t unload2;
106 addr_and_unwind_t unload_stub;
111 som_relocate_section_addresses (struct so_list *so,
112 struct section_table *sec)
114 flagword aflag = bfd_get_section_flags(so->abfd, sec->the_bfd_section);
116 /* solib.c does something similar, but it only recognizes ".text", SOM calls
117 the text section "$CODE$". */
118 if (strcmp (sec->the_bfd_section->name, "$CODE$") == 0)
120 so->textsection = sec;
123 if (aflag & SEC_CODE)
125 sec->addr += so->lm_info->text_addr - so->lm_info->text_link_addr;
126 sec->endaddr += so->lm_info->text_addr - so->lm_info->text_link_addr;
128 else if (aflag & SEC_DATA)
130 sec->addr += so->lm_info->data_start;
131 sec->endaddr += so->lm_info->data_start;
137 /* This hook gets called just before the first instruction in the
138 inferior process is executed.
140 This is our opportunity to set magic flags in the inferior so
141 that GDB can be notified when a shared library is mapped in and
142 to tell the dynamic linker that a private copy of the library is
143 needed (so GDB can set breakpoints in the library).
145 __dld_flags is the location of the magic flags; as of this implementation
146 there are 3 flags of interest:
148 bit 0 when set indicates that private copies of the libraries are needed
149 bit 1 when set indicates that the callback hook routine is valid
150 bit 2 when set indicates that the dynamic linker should maintain the
151 __dld_list structure when loading/unloading libraries.
153 Note that shared libraries are not mapped in at this time, so we have
154 run the inferior until the libraries are mapped in. Typically this
155 means running until the "_start" is called. */
158 som_solib_create_inferior_hook (void)
160 struct minimal_symbol *msymbol;
161 unsigned int dld_flags, status, have_endo;
162 asection *shlib_info;
166 /* First, remove all the solib event breakpoints. Their addresses
167 may have changed since the last time we ran the program. */
168 remove_solib_event_breakpoints ();
170 if (symfile_objfile == NULL)
173 /* First see if the objfile was dynamically linked. */
174 shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, "$SHLIB_INFO$");
178 /* It's got a $SHLIB_INFO$ section, make sure it's not empty. */
179 if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0)
183 /* Slam the pid of the process into __d_pid.
185 We used to warn when this failed, but that warning is only useful
186 on very old HP systems (hpux9 and older). The warnings are an
187 annoyance to users of modern systems and foul up the testsuite as
188 well. As a result, the warnings have been disabled. */
189 msymbol = lookup_minimal_symbol ("__d_pid", NULL, symfile_objfile);
193 anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
194 store_unsigned_integer (buf, 4, PIDGET (inferior_ptid));
195 status = target_write_memory (anaddr, buf, 4);
198 warning ("Unable to write __d_pid");
199 warning ("Suggest linking with /opt/langtools/lib/end.o.");
200 warning ("GDB will be unable to track shl_load/shl_unload calls");
204 /* Get the value of _DLD_HOOK (an export stub) and put it in __dld_hook;
205 This will force the dynamic linker to call __d_trap when significant
208 Note that the above is the pre-HP-UX 9.0 behaviour. At 9.0 and above,
209 the dld provides an export stub named "__d_trap" as well as the
210 function named "__d_trap" itself, but doesn't provide "_DLD_HOOK".
211 We'll look first for the old flavor and then the new.
213 msymbol = lookup_minimal_symbol ("_DLD_HOOK", NULL, symfile_objfile);
215 msymbol = lookup_minimal_symbol ("__d_trap", NULL, symfile_objfile);
218 warning ("Unable to find _DLD_HOOK symbol in object file.");
219 warning ("Suggest linking with /opt/langtools/lib/end.o.");
220 warning ("GDB will be unable to track shl_load/shl_unload calls");
223 anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
224 dld_cache.hook.address = anaddr;
226 /* Grrr, this might not be an export symbol! We have to find the
228 msymbol = hppa_lookup_stub_minimal_symbol (SYMBOL_LINKAGE_NAME (msymbol),
232 anaddr = SYMBOL_VALUE (msymbol);
233 dld_cache.hook_stub.address = anaddr;
235 store_unsigned_integer (buf, 4, anaddr);
237 msymbol = lookup_minimal_symbol ("__dld_hook", NULL, symfile_objfile);
240 warning ("Unable to find __dld_hook symbol in object file.");
241 warning ("Suggest linking with /opt/langtools/lib/end.o.");
242 warning ("GDB will be unable to track shl_load/shl_unload calls");
245 anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
246 status = target_write_memory (anaddr, buf, 4);
248 /* Now set a shlib_event breakpoint at __d_trap so we can track
249 significant shared library events. */
250 msymbol = lookup_minimal_symbol ("__d_trap", NULL, symfile_objfile);
253 warning ("Unable to find __dld_d_trap symbol in object file.");
254 warning ("Suggest linking with /opt/langtools/lib/end.o.");
255 warning ("GDB will be unable to track shl_load/shl_unload calls");
258 create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
260 /* We have all the support usually found in end.o, so we can track
261 shl_load and shl_unload calls. */
266 /* Get the address of __dld_flags, if no such symbol exists, then we can
267 not debug the shared code. */
268 msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
271 error ("Unable to find __dld_flags symbol in object file.\n");
274 anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
276 /* Read the current contents. */
277 status = target_read_memory (anaddr, buf, 4);
280 error ("Unable to read __dld_flags\n");
282 dld_flags = extract_unsigned_integer (buf, 4);
284 /* Turn on the flags we care about. */
285 dld_flags |= DLD_FLAGS_MAPPRIVATE;
287 dld_flags |= DLD_FLAGS_HOOKVALID;
288 store_unsigned_integer (buf, 4, dld_flags);
289 status = target_write_memory (anaddr, buf, 4);
292 error ("Unable to write __dld_flags\n");
295 /* Now find the address of _start and set a breakpoint there.
296 We still need this code for two reasons:
298 * Not all sites have /opt/langtools/lib/end.o, so it's not always
299 possible to track the dynamic linker's events.
301 * At this time no events are triggered for shared libraries
302 loaded at startup time (what a crock). */
304 msymbol = lookup_minimal_symbol ("_start", NULL, symfile_objfile);
307 error ("Unable to find _start symbol in object file.\n");
310 anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
312 /* Make the breakpoint at "_start" a shared library event breakpoint. */
313 create_solib_event_breakpoint (anaddr);
315 clear_symtab_users ();
318 /* This operation removes the "hook" between GDB and the dynamic linker,
319 which causes the dld to notify GDB of shared library events.
321 After this operation completes, the dld will no longer notify GDB of
322 shared library events. To resume notifications, GDB must call
323 som_solib_create_inferior_hook.
325 This operation does not remove any knowledge of shared libraries which
326 GDB may already have been notified of.
329 som_solib_remove_inferior_hook (int pid)
332 struct minimal_symbol *msymbol;
334 char dld_flags_buffer[4];
335 unsigned int dld_flags_value;
336 struct cleanup *old_cleanups = save_inferior_ptid ();
338 /* Ensure that we're really operating on the specified process. */
339 inferior_ptid = pid_to_ptid (pid);
341 /* We won't bother to remove the solib breakpoints from this process.
343 In fact, on PA64 the breakpoint is hard-coded into the dld callback,
344 and thus we're not supposed to remove it.
346 Rather, we'll merely clear the dld_flags bit that enables callbacks.
348 msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
350 addr = SYMBOL_VALUE_ADDRESS (msymbol);
351 status = target_read_memory (addr, dld_flags_buffer, 4);
353 dld_flags_value = extract_unsigned_integer (dld_flags_buffer, 4);
355 dld_flags_value &= ~DLD_FLAGS_HOOKVALID;
356 store_unsigned_integer (dld_flags_buffer, 4, dld_flags_value);
357 status = target_write_memory (addr, dld_flags_buffer, 4);
359 do_cleanups (old_cleanups);
363 som_special_symbol_handling (void)
368 som_solib_desire_dynamic_linker_symbols (void)
370 struct objfile *objfile;
371 struct unwind_table_entry *u;
372 struct minimal_symbol *dld_msymbol;
374 /* Do we already know the value of these symbols? If so, then
377 (If you add clauses to this test, be sure to likewise update the
378 test within the loop.)
380 if (dld_cache.is_valid)
383 ALL_OBJFILES (objfile)
385 dld_msymbol = lookup_minimal_symbol ("shl_load", NULL, objfile);
386 if (dld_msymbol != NULL)
388 dld_cache.load.address = SYMBOL_VALUE (dld_msymbol);
389 dld_cache.load.unwind = find_unwind_entry (dld_cache.load.address);
392 dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_load",
394 if (dld_msymbol != NULL)
396 if (SYMBOL_TYPE (dld_msymbol) == mst_solib_trampoline)
398 u = find_unwind_entry (SYMBOL_VALUE (dld_msymbol));
399 if ((u != NULL) && (u->stub_unwind.stub_type == EXPORT))
401 dld_cache.load_stub.address = SYMBOL_VALUE (dld_msymbol);
402 dld_cache.load_stub.unwind = u;
407 dld_msymbol = lookup_minimal_symbol ("shl_unload", NULL, objfile);
408 if (dld_msymbol != NULL)
410 dld_cache.unload.address = SYMBOL_VALUE (dld_msymbol);
411 dld_cache.unload.unwind = find_unwind_entry (dld_cache.unload.address);
413 /* ??rehrauer: I'm not sure exactly what this is, but it appears
414 that on some HPUX 10.x versions, there's two unwind regions to
415 cover the body of "shl_unload", the second being 4 bytes past
416 the end of the first. This is a large hack to handle that
417 case, but since I don't seem to have any legitimate way to
418 look for this thing via the symbol table...
420 if (dld_cache.unload.unwind != NULL)
422 u = find_unwind_entry (dld_cache.unload.unwind->region_end + 4);
425 dld_cache.unload2.address = u->region_start;
426 dld_cache.unload2.unwind = u;
431 dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_unload",
433 if (dld_msymbol != NULL)
435 if (SYMBOL_TYPE (dld_msymbol) == mst_solib_trampoline)
437 u = find_unwind_entry (SYMBOL_VALUE (dld_msymbol));
438 if ((u != NULL) && (u->stub_unwind.stub_type == EXPORT))
440 dld_cache.unload_stub.address = SYMBOL_VALUE (dld_msymbol);
441 dld_cache.unload_stub.unwind = u;
446 /* Did we find everything we were looking for? If so, stop. */
447 if ((dld_cache.load.address != 0)
448 && (dld_cache.load_stub.address != 0)
449 && (dld_cache.unload.address != 0)
450 && (dld_cache.unload_stub.address != 0))
452 dld_cache.is_valid = 1;
457 dld_cache.hook.unwind = find_unwind_entry (dld_cache.hook.address);
458 dld_cache.hook_stub.unwind = find_unwind_entry (dld_cache.hook_stub.address);
460 /* We're prepared not to find some of these symbols, which is why
461 this function is a "desire" operation, and not a "require".
466 som_in_dynsym_resolve_code (CORE_ADDR pc)
468 struct unwind_table_entry *u_pc;
470 /* Are we in the dld itself?
472 ??rehrauer: Large hack -- We'll assume that any address in a
473 shared text region is the dld's text. This would obviously
474 fall down if the user attached to a process, whose shlibs
475 weren't mapped to a (writeable) private region. However, in
476 that case the debugger probably isn't able to set the fundamental
477 breakpoint in the dld callback anyways, so this hack should be
480 if ((pc & (CORE_ADDR) 0xc0000000) == (CORE_ADDR) 0xc0000000)
483 /* Cache the address of some symbols that are part of the dynamic
484 linker, if not already known.
486 som_solib_desire_dynamic_linker_symbols ();
488 /* Are we in the dld callback? Or its export stub? */
489 u_pc = find_unwind_entry (pc);
493 if ((u_pc == dld_cache.hook.unwind) || (u_pc == dld_cache.hook_stub.unwind))
496 /* Or the interface of the dld (i.e., "shl_load" or friends)? */
497 if ((u_pc == dld_cache.load.unwind)
498 || (u_pc == dld_cache.unload.unwind)
499 || (u_pc == dld_cache.unload2.unwind)
500 || (u_pc == dld_cache.load_stub.unwind)
501 || (u_pc == dld_cache.unload_stub.unwind))
504 /* Apparently this address isn't part of the dld's text. */
509 som_clear_solib (void)
517 char text_link_addr[4];
524 char tsd_start_addr_ptr[4];
528 link_map_start (void)
530 struct minimal_symbol *sym;
533 unsigned int dld_flags;
535 sym = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
538 error ("Unable to find __dld_flags symbol in object file.\n");
541 addr = SYMBOL_VALUE_ADDRESS (sym);
542 read_memory (addr, buf, 4);
543 dld_flags = extract_unsigned_integer (buf, 4);
544 if ((dld_flags & DLD_FLAGS_LISTVALID) == 0)
546 error ("__dld_list is not valid according to __dld_flags.\n");
550 /* If the libraries were not mapped private, warn the user. */
551 if ((dld_flags & DLD_FLAGS_MAPPRIVATE) == 0)
552 warning ("The shared libraries were not privately mapped; setting a\n"
553 "breakpoint in a shared library will not work until you rerun the "
556 sym = lookup_minimal_symbol ("__dld_list", NULL, NULL);
559 /* Older crt0.o files (hpux8) don't have __dld_list as a symbol,
560 but the data is still available if you know where to look. */
561 sym = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
564 error ("Unable to find dynamic library list.\n");
567 addr = SYMBOL_VALUE_ADDRESS (sym) - 8;
570 addr = SYMBOL_VALUE_ADDRESS (sym);
572 read_memory (addr, buf, 4);
573 addr = extract_unsigned_integer (buf, 4);
576 error ("Debugging dynamic executables loaded via the hpux8 dld.sl is not supported.\n");
580 read_memory (addr, buf, 4);
581 return extract_unsigned_integer (buf, 4);
584 /* Does this so's name match the main binary? */
586 match_main (const char *name)
588 return strcmp (name, symfile_objfile->name) == 0;
591 static struct so_list *
592 som_current_sos (void)
595 struct so_list *head = 0;
596 struct so_list **link_ptr = &head;
598 for (lm = link_map_start (); lm; )
603 struct cleanup *old_chain;
605 struct dld_list dbuf;
608 new = (struct so_list *) xmalloc (sizeof (struct so_list));
609 old_chain = make_cleanup (xfree, new);
611 memset (new, 0, sizeof (*new));
612 new->lm_info = xmalloc (sizeof (struct lm_info));
613 make_cleanup (xfree, new->lm_info);
615 read_memory (lm, (char *)&dbuf, sizeof (struct dld_list));
617 addr = extract_unsigned_integer (&dbuf.name, sizeof (dbuf.name));
618 target_read_string (addr, &namebuf, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
621 warning ("current_sos: Can't read pathname for load map: %s\n",
622 safe_strerror (errcode));
626 strncpy (new->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
627 new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
629 strcpy (new->so_original_name, new->so_name);
632 if (new->so_name[0] && !match_main (new->so_name))
634 struct lm_info *lmi = new->lm_info;
639 #define EXTRACT(_fld) \
640 extract_unsigned_integer (&dbuf._fld, sizeof (dbuf._fld));
642 lmi->text_addr = EXTRACT (text_addr);
643 tmp = EXTRACT (info);
644 lmi->library_version = (tmp >> 16) & 0xffff;
645 lmi->bind_mode = (tmp >> 8) & 0xff;
646 lmi->struct_version = tmp & 0xff;
647 lmi->text_link_addr = EXTRACT (text_link_addr);
648 lmi->text_end = EXTRACT (text_end);
649 lmi->data_start = EXTRACT (data_start);
650 lmi->bss_start = EXTRACT (bss_start);
651 lmi->data_end = EXTRACT (data_end);
652 lmi->got_value = EXTRACT (got_value);
653 tmp = EXTRACT (tsd_start_addr_ptr);
654 read_memory (tmp, tsdbuf, 4);
655 lmi->tsd_start_addr = extract_unsigned_integer (tsdbuf, 4);
658 printf ("\n+ library \"%s\" is described at 0x%s\n", new->so_name,
660 printf (" 'version' is %d\n", new->lm_info->struct_version);
661 printf (" 'bind_mode' is %d\n", new->lm_info->bind_mode);
662 printf (" 'library_version' is %d\n",
663 new->lm_info->library_version);
664 printf (" 'text_addr' is 0x%s\n",
665 paddr_nz (new->lm_info->text_addr));
666 printf (" 'text_link_addr' is 0x%s\n",
667 paddr_nz (new->lm_info->text_link_addr));
668 printf (" 'text_end' is 0x%s\n",
669 paddr_nz (new->lm_info->text_end));
670 printf (" 'data_start' is 0x%s\n",
671 paddr_nz (new->lm_info->data_start));
672 printf (" 'bss_start' is 0x%s\n",
673 paddr_nz (new->lm_info->bss_start));
674 printf (" 'data_end' is 0x%s\n",
675 paddr_nz (new->lm_info->data_end));
676 printf (" 'got_value' is %s\n",
677 paddr_nz (new->lm_info->got_value));
678 printf (" 'tsd_start_addr' is 0x%s\n",
679 paddr_nz (new->lm_info->tsd_start_addr));
682 /* Link the new object onto the list. */
685 link_ptr = &new->next;
693 discard_cleanups (old_chain);
697 /* TODO: The original somsolib code has logic to detect and eliminate
698 duplicate entries. Do we need that? */
704 som_open_symbol_file_object (void *from_ttyp)
706 CORE_ADDR lm, l_name;
709 int from_tty = *(int *)from_ttyp;
713 if (!query ("Attempt to reload symbols from process? "))
716 /* First link map member should be the executable. */
717 if ((lm = link_map_start ()) == 0)
718 return 0; /* failed somehow... */
720 /* Read address of name from target memory to GDB. */
721 read_memory (lm + offsetof (struct dld_list, name), buf, 4);
723 /* Convert the address to host format. Assume that the address is
725 l_name = extract_unsigned_integer (buf, 4);
728 return 0; /* No filename. */
730 /* Now fetch the filename from target memory. */
731 target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
735 warning ("failed to read exec filename from attached file: %s",
736 safe_strerror (errcode));
740 make_cleanup (xfree, filename);
741 /* Have a pathname: read the symbol file. */
742 symbol_file_add_main (filename, from_tty);
748 som_free_so (struct so_list *so)
754 som_solib_thread_start_addr (struct so_list *so)
756 return so->lm_info->tsd_start_addr;
759 /* Return the GOT value for the shared library in which ADDR belongs. If
760 ADDR isn't in any known shared library, return zero. */
763 som_solib_get_got_by_pc (CORE_ADDR addr)
765 struct so_list *so_list = master_so_list ();
766 CORE_ADDR got_value = 0;
770 if (so_list->lm_info->text_addr <= addr
771 && so_list->lm_info->text_end > addr)
773 got_value = so_list->lm_info->got_value;
776 so_list = so_list->next;
781 /* Return the address of the handle of the shared library in which ADDR belongs.
782 If ADDR isn't in any known shared library, return zero. */
783 /* this function is used in initialize_hp_cxx_exception_support in
787 som_solib_get_solib_by_pc (CORE_ADDR addr)
789 struct so_list *so_list = master_so_list ();
793 if (so_list->lm_info->text_addr <= addr
794 && so_list->lm_info->text_end > addr)
798 so_list = so_list->next;
801 return so_list->lm_info->lm_addr;
807 static struct target_so_ops som_so_ops;
809 extern initialize_file_ftype _initialize_som_solib; /* -Wmissing-prototypes */
812 _initialize_som_solib (void)
814 som_so_ops.relocate_section_addresses = som_relocate_section_addresses;
815 som_so_ops.free_so = som_free_so;
816 som_so_ops.clear_solib = som_clear_solib;
817 som_so_ops.solib_create_inferior_hook = som_solib_create_inferior_hook;
818 som_so_ops.special_symbol_handling = som_special_symbol_handling;
819 som_so_ops.current_sos = som_current_sos;
820 som_so_ops.open_symbol_file_object = som_open_symbol_file_object;
821 som_so_ops.in_dynsym_resolve_code = som_in_dynsym_resolve_code;
824 void som_solib_select (struct gdbarch_tdep *tdep)
826 current_target_so_ops = &som_so_ops;
828 tdep->solib_thread_start_addr = som_solib_thread_start_addr;
829 tdep->solib_get_got_by_pc = som_solib_get_got_by_pc;
830 tdep->solib_get_solib_by_pc = som_solib_get_solib_by_pc;
833 /* The rest of these functions are not part of the solib interface; they
834 are used by somread.c or hppa-hpux-tdep.c */
837 som_solib_section_offsets (struct objfile *objfile,
838 struct section_offsets *offsets)
840 struct so_list *so_list = master_so_list ();
844 /* Oh what a pain! We need the offsets before so_list->objfile
845 is valid. The BFDs will never match. Make a best guess. */
846 if (strstr (objfile->name, so_list->so_name))
848 asection *private_section;
850 /* The text offset is easy. */
851 offsets->offsets[SECT_OFF_TEXT (objfile)]
852 = (so_list->lm_info->text_addr
853 - so_list->lm_info->text_link_addr);
854 offsets->offsets[SECT_OFF_RODATA (objfile)]
855 = ANOFFSET (offsets, SECT_OFF_TEXT (objfile));
857 /* We should look at presumed_dp in the SOM header, but
858 that's not easily available. This should be OK though. */
859 private_section = bfd_get_section_by_name (objfile->obfd,
861 if (!private_section)
863 warning ("Unable to find $PRIVATE$ in shared library!");
864 offsets->offsets[SECT_OFF_DATA (objfile)] = 0;
865 offsets->offsets[SECT_OFF_BSS (objfile)] = 0;
868 offsets->offsets[SECT_OFF_DATA (objfile)]
869 = (so_list->lm_info->data_start - private_section->vma);
870 offsets->offsets[SECT_OFF_BSS (objfile)]
871 = ANOFFSET (offsets, SECT_OFF_DATA (objfile));
874 so_list = so_list->next;