2009-10-19 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / solib-irix.c
CommitLineData
dabbe2c0 1/* Shared library support for IRIX.
6aba47ca 2 Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004,
0fb0cc75 3 2007, 2008, 2009 Free Software Foundation, Inc.
dabbe2c0
KB
4
5 This file was created using portions of irix5-nat.c originally
6 contributed to GDB by Ian Lance Taylor.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
a9762ec7 12 the Free Software Foundation; either version 3 of the License, or
dabbe2c0
KB
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
a9762ec7 21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
dabbe2c0
KB
22
23#include "defs.h"
24
25#include "symtab.h"
26#include "bfd.h"
9ab9195f
EZ
27/* FIXME: ezannoni/2004-02-13 Verify that the include below is
28 really needed. */
dabbe2c0
KB
29#include "symfile.h"
30#include "objfiles.h"
31#include "gdbcore.h"
32#include "target.h"
33#include "inferior.h"
2020b7ab 34#include "gdbthread.h"
dabbe2c0
KB
35
36#include "solist.h"
734598d9
UW
37#include "solib.h"
38#include "solib-irix.h"
39
dabbe2c0
KB
40
41/* Link map info to include in an allocate so_list entry. Unlike some
42 of the other solib backends, this (Irix) backend chooses to decode
43 the link map info obtained from the target and store it as (mostly)
44 CORE_ADDRs which need no further decoding. This is more convenient
45 because there are three different link map formats to worry about.
46 We use a single routine (fetch_lm_info) to read (and decode) the target
47 specific link map data. */
48
49struct lm_info
50{
51 CORE_ADDR addr; /* address of obj_info or obj_list
52 struct on target (from which the
53 following information is obtained). */
54 CORE_ADDR next; /* address of next item in list. */
55 CORE_ADDR reloc_offset; /* amount to relocate by */
56 CORE_ADDR pathname_addr; /* address of pathname */
57 int pathname_len; /* length of pathname */
58};
59
60/* It's not desirable to use the system header files to obtain the
61 structure of the obj_list or obj_info structs. Therefore, we use a
62 platform neutral representation which has been derived from the IRIX
63 header files. */
64
65typedef struct
66{
725a826f 67 gdb_byte b[4];
dabbe2c0
KB
68}
69gdb_int32_bytes;
70typedef struct
71{
725a826f 72 gdb_byte b[8];
dabbe2c0
KB
73}
74gdb_int64_bytes;
75
76/* The "old" obj_list struct. This is used with old (o32) binaries.
77 The ``data'' member points at a much larger and more complicated
78 struct which we will only refer to by offsets. See
79 fetch_lm_info(). */
80
81struct irix_obj_list
82{
83 gdb_int32_bytes data;
84 gdb_int32_bytes next;
85 gdb_int32_bytes prev;
86};
87
88/* The ELF32 and ELF64 versions of the above struct. The oi_magic value
89 corresponds to the ``data'' value in the "old" struct. When this value
90 is 0xffffffff, the data will be in one of the following formats. The
91 ``oi_size'' field is used to decide which one we actually have. */
92
93struct irix_elf32_obj_info
94{
95 gdb_int32_bytes oi_magic;
96 gdb_int32_bytes oi_size;
97 gdb_int32_bytes oi_next;
98 gdb_int32_bytes oi_prev;
99 gdb_int32_bytes oi_ehdr;
100 gdb_int32_bytes oi_orig_ehdr;
101 gdb_int32_bytes oi_pathname;
102 gdb_int32_bytes oi_pathname_len;
103};
104
105struct irix_elf64_obj_info
106{
107 gdb_int32_bytes oi_magic;
108 gdb_int32_bytes oi_size;
109 gdb_int64_bytes oi_next;
110 gdb_int64_bytes oi_prev;
111 gdb_int64_bytes oi_ehdr;
112 gdb_int64_bytes oi_orig_ehdr;
113 gdb_int64_bytes oi_pathname;
114 gdb_int32_bytes oi_pathname_len;
115 gdb_int32_bytes padding;
116};
117
118/* Union of all of the above (plus a split out magic field). */
119
120union irix_obj_info
121{
122 gdb_int32_bytes magic;
123 struct irix_obj_list ol32;
124 struct irix_elf32_obj_info oi32;
125 struct irix_elf64_obj_info oi64;
126};
127
128/* MIPS sign extends its 32 bit addresses. We could conceivably use
129 extract_typed_address here, but to do so, we'd have to construct an
ae0167b9 130 appropriate type. Calling extract_signed_integer seems simpler. */
dabbe2c0
KB
131
132static CORE_ADDR
e17a4113 133extract_mips_address (void *addr, int len, enum bfd_endian byte_order)
dabbe2c0 134{
e17a4113 135 return extract_signed_integer (addr, len, byte_order);
dabbe2c0
KB
136}
137
138/* Fetch and return the link map data associated with ADDR. Note that
139 this routine automatically determines which (of three) link map
140 formats is in use by the target. */
141
63807e1d 142static struct lm_info
dabbe2c0
KB
143fetch_lm_info (CORE_ADDR addr)
144{
e17a4113 145 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
dabbe2c0
KB
146 struct lm_info li;
147 union irix_obj_info buf;
148
149 li.addr = addr;
150
151 /* The smallest region that we'll need is for buf.ol32. We'll read
152 that first. We'll read more of the buffer later if we have to deal
153 with one of the other cases. (We don't want to incur a memory error
154 if we were to read a larger region that generates an error due to
155 being at the end of a page or the like.) */
156 read_memory (addr, (char *) &buf, sizeof (buf.ol32));
157
e17a4113
UW
158 if (extract_unsigned_integer (buf.magic.b, sizeof (buf.magic), byte_order)
159 != 0xffffffff)
dabbe2c0
KB
160 {
161 /* Use buf.ol32... */
162 char obj_buf[432];
163 CORE_ADDR obj_addr = extract_mips_address (&buf.ol32.data,
e17a4113
UW
164 sizeof (buf.ol32.data),
165 byte_order);
166 li.next = extract_mips_address (&buf.ol32.next,
167 sizeof (buf.ol32.next), byte_order);
dabbe2c0
KB
168
169 read_memory (obj_addr, obj_buf, sizeof (obj_buf));
170
e17a4113 171 li.pathname_addr = extract_mips_address (&obj_buf[236], 4, byte_order);
dabbe2c0 172 li.pathname_len = 0; /* unknown */
e17a4113
UW
173 li.reloc_offset = extract_mips_address (&obj_buf[196], 4, byte_order)
174 - extract_mips_address (&obj_buf[248], 4, byte_order);
dabbe2c0
KB
175
176 }
725a826f 177 else if (extract_unsigned_integer (buf.oi32.oi_size.b,
e17a4113 178 sizeof (buf.oi32.oi_size), byte_order)
dabbe2c0
KB
179 == sizeof (buf.oi32))
180 {
181 /* Use buf.oi32... */
182
183 /* Read rest of buffer. */
184 read_memory (addr + sizeof (buf.ol32),
185 ((char *) &buf) + sizeof (buf.ol32),
186 sizeof (buf.oi32) - sizeof (buf.ol32));
187
188 /* Fill in fields using buffer contents. */
189 li.next = extract_mips_address (&buf.oi32.oi_next,
e17a4113 190 sizeof (buf.oi32.oi_next), byte_order);
dabbe2c0 191 li.reloc_offset = extract_mips_address (&buf.oi32.oi_ehdr,
e17a4113
UW
192 sizeof (buf.oi32.oi_ehdr),
193 byte_order)
dabbe2c0 194 - extract_mips_address (&buf.oi32.oi_orig_ehdr,
e17a4113 195 sizeof (buf.oi32.oi_orig_ehdr), byte_order);
dabbe2c0 196 li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
e17a4113
UW
197 sizeof (buf.oi32.oi_pathname),
198 byte_order);
725a826f 199 li.pathname_len = extract_unsigned_integer (buf.oi32.oi_pathname_len.b,
dabbe2c0 200 sizeof (buf.oi32.
e17a4113
UW
201 oi_pathname_len),
202 byte_order);
dabbe2c0 203 }
725a826f 204 else if (extract_unsigned_integer (buf.oi64.oi_size.b,
e17a4113 205 sizeof (buf.oi64.oi_size), byte_order)
dabbe2c0
KB
206 == sizeof (buf.oi64))
207 {
208 /* Use buf.oi64... */
209
210 /* Read rest of buffer. */
211 read_memory (addr + sizeof (buf.ol32),
212 ((char *) &buf) + sizeof (buf.ol32),
213 sizeof (buf.oi64) - sizeof (buf.ol32));
214
215 /* Fill in fields using buffer contents. */
216 li.next = extract_mips_address (&buf.oi64.oi_next,
e17a4113 217 sizeof (buf.oi64.oi_next), byte_order);
dabbe2c0 218 li.reloc_offset = extract_mips_address (&buf.oi64.oi_ehdr,
e17a4113
UW
219 sizeof (buf.oi64.oi_ehdr),
220 byte_order)
dabbe2c0 221 - extract_mips_address (&buf.oi64.oi_orig_ehdr,
e17a4113 222 sizeof (buf.oi64.oi_orig_ehdr), byte_order);
dabbe2c0 223 li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
e17a4113
UW
224 sizeof (buf.oi64.oi_pathname),
225 byte_order);
725a826f 226 li.pathname_len = extract_unsigned_integer (buf.oi64.oi_pathname_len.b,
dabbe2c0 227 sizeof (buf.oi64.
e17a4113
UW
228 oi_pathname_len),
229 byte_order);
dabbe2c0
KB
230 }
231 else
232 {
8a3fe4f8 233 error (_("Unable to fetch shared library obj_info or obj_list info."));
dabbe2c0
KB
234 }
235
236 return li;
237}
238
239/* The symbol which starts off the list of shared libraries. */
240#define DEBUG_BASE "__rld_obj_head"
241
8181d85f 242static void *base_breakpoint;
dabbe2c0
KB
243
244static CORE_ADDR debug_base; /* Base of dynamic linker structures */
dabbe2c0
KB
245
246/*
247
248 LOCAL FUNCTION
249
250 locate_base -- locate the base address of dynamic linker structs
251
252 SYNOPSIS
253
254 CORE_ADDR locate_base (void)
255
256 DESCRIPTION
257
258 For both the SunOS and SVR4 shared library implementations, if the
259 inferior executable has been linked dynamically, there is a single
260 address somewhere in the inferior's data space which is the key to
261 locating all of the dynamic linker's runtime structures. This
262 address is the value of the symbol defined by the macro DEBUG_BASE.
263 The job of this function is to find and return that address, or to
264 return 0 if there is no such address (the executable is statically
265 linked for example).
266
267 For SunOS, the job is almost trivial, since the dynamic linker and
268 all of it's structures are statically linked to the executable at
269 link time. Thus the symbol for the address we are looking for has
270 already been added to the minimal symbol table for the executable's
271 objfile at the time the symbol file's symbols were read, and all we
272 have to do is look it up there. Note that we explicitly do NOT want
273 to find the copies in the shared library.
274
275 The SVR4 version is much more complicated because the dynamic linker
276 and it's structures are located in the shared C library, which gets
277 run as the executable's "interpreter" by the kernel. We have to go
278 to a lot more work to discover the address of DEBUG_BASE. Because
279 of this complexity, we cache the value we find and return that value
280 on subsequent invocations. Note there is no copy in the executable
281 symbol tables.
282
283 Irix 5 is basically like SunOS.
284
285 Note that we can assume nothing about the process state at the time
286 we need to find this address. We may be stopped on the first instruc-
287 tion of the interpreter (C shared library), the first instruction of
288 the executable itself, or somewhere else entirely (if we attached
289 to the process for example).
290
291 */
292
293static CORE_ADDR
294locate_base (void)
295{
296 struct minimal_symbol *msymbol;
297 CORE_ADDR address = 0;
298
299 msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile);
300 if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
301 {
302 address = SYMBOL_VALUE_ADDRESS (msymbol);
303 }
304 return (address);
305}
306
307/*
308
309 LOCAL FUNCTION
310
311 disable_break -- remove the "mapping changed" breakpoint
312
313 SYNOPSIS
314
315 static int disable_break ()
316
317 DESCRIPTION
318
319 Removes the breakpoint that gets hit when the dynamic linker
320 completes a mapping change.
321
322 */
323
324static int
325disable_break (void)
326{
327 int status = 1;
328
329
330 /* Note that breakpoint address and original contents are in our address
331 space, so we just need to write the original contents back. */
332
a6d9a66e 333 if (deprecated_remove_raw_breakpoint (target_gdbarch, base_breakpoint) != 0)
dabbe2c0
KB
334 {
335 status = 0;
336 }
337
8181d85f
DJ
338 base_breakpoint = NULL;
339
9185ddce
JB
340 /* Note that it is possible that we have stopped at a location that
341 is different from the location where we inserted our breakpoint.
342 On mips-irix, we can actually land in __dbx_init(), so we should
343 not check the PC against our breakpoint address here. See procfs.c
344 for more details. */
dabbe2c0
KB
345
346 return (status);
347}
348
349/*
350
351 LOCAL FUNCTION
352
353 enable_break -- arrange for dynamic linker to hit breakpoint
354
355 SYNOPSIS
356
357 int enable_break (void)
358
359 DESCRIPTION
360
361 This functions inserts a breakpoint at the entry point of the
362 main executable, where all shared libraries are mapped in.
363 */
364
365static int
366enable_break (void)
367{
6c95b8df 368 if (symfile_objfile != NULL && has_stack_frames ())
dabbe2c0 369 {
6c95b8df
PA
370 struct frame_info *frame = get_current_frame ();
371 struct address_space *aspace = get_frame_address_space (frame);
372
8181d85f 373 base_breakpoint
a6d9a66e 374 = deprecated_insert_raw_breakpoint (target_gdbarch,
6c95b8df 375 aspace,
a6d9a66e 376 entry_point_address ());
8181d85f
DJ
377
378 if (base_breakpoint != NULL)
379 return 1;
dabbe2c0
KB
380 }
381
382 return 0;
383}
384
385/*
386
387 LOCAL FUNCTION
388
389 irix_solib_create_inferior_hook -- shared library startup support
390
391 SYNOPSIS
392
7095b863 393 void solib_create_inferior_hook ()
dabbe2c0
KB
394
395 DESCRIPTION
396
397 When gdb starts up the inferior, it nurses it along (through the
398 shell) until it is ready to execute it's first instruction. At this
399 point, this function gets called via expansion of the macro
400 SOLIB_CREATE_INFERIOR_HOOK.
401
402 For SunOS executables, this first instruction is typically the
403 one at "_start", or a similar text label, regardless of whether
404 the executable is statically or dynamically linked. The runtime
405 startup code takes care of dynamically linking in any shared
406 libraries, once gdb allows the inferior to continue.
407
408 For SVR4 executables, this first instruction is either the first
409 instruction in the dynamic linker (for dynamically linked
410 executables) or the instruction at "start" for statically linked
411 executables. For dynamically linked executables, the system
412 first exec's /lib/libc.so.N, which contains the dynamic linker,
413 and starts it running. The dynamic linker maps in any needed
414 shared libraries, maps in the actual user executable, and then
415 jumps to "start" in the user executable.
416
417 For both SunOS shared libraries, and SVR4 shared libraries, we
418 can arrange to cooperate with the dynamic linker to discover the
419 names of shared libraries that are dynamically linked, and the
420 base addresses to which they are linked.
421
422 This function is responsible for discovering those names and
423 addresses, and saving sufficient information about them to allow
424 their symbols to be read at a later time.
425
426 FIXME
427
428 Between enable_break() and disable_break(), this code does not
429 properly handle hitting breakpoints which the user might have
430 set in the startup code or in the dynamic linker itself. Proper
431 handling will probably have to wait until the implementation is
432 changed to use the "breakpoint handler function" method.
433
434 Also, what if child has exit()ed? Must exit loop somehow.
435 */
436
437static void
438irix_solib_create_inferior_hook (void)
439{
d6b48e9c 440 struct inferior *inf;
2020b7ab
PA
441 struct thread_info *tp;
442
dabbe2c0
KB
443 if (!enable_break ())
444 {
8a3fe4f8 445 warning (_("shared library handler failed to enable breakpoint"));
dabbe2c0
KB
446 return;
447 }
448
449 /* Now run the target. It will eventually hit the breakpoint, at
450 which point all of the libraries will have been mapped in and we
451 can go groveling around in the dynamic linker structures to find
452 out what we need to know about them. */
453
d6b48e9c 454 inf = current_inferior ();
2020b7ab 455 tp = inferior_thread ();
d6b48e9c 456
dabbe2c0 457 clear_proceed_status ();
d6b48e9c
PA
458
459 inf->stop_soon = STOP_QUIETLY;
2020b7ab 460 tp->stop_signal = TARGET_SIGNAL_0;
d6b48e9c 461
dabbe2c0
KB
462 do
463 {
2020b7ab 464 target_resume (pid_to_ptid (-1), 0, tp->stop_signal);
ae123ec6 465 wait_for_inferior (0);
dabbe2c0 466 }
2020b7ab 467 while (tp->stop_signal != TARGET_SIGNAL_TRAP);
dabbe2c0
KB
468
469 /* We are now either at the "mapping complete" breakpoint (or somewhere
470 else, a condition we aren't prepared to deal with anyway), so adjust
471 the PC as necessary after a breakpoint, disable the breakpoint, and
472 add any shared libraries that were mapped in. */
473
474 if (!disable_break ())
475 {
8a3fe4f8 476 warning (_("shared library handler failed to disable breakpoint"));
dabbe2c0
KB
477 }
478
479 /* solib_add will call reinit_frame_cache.
480 But we are stopped in the startup code and we might not have symbols
481 for the startup code, so heuristic_proc_start could be called
482 and will put out an annoying warning.
c0236d92 483 Delaying the resetting of stop_soon until after symbol loading
dabbe2c0
KB
484 suppresses the warning. */
485 solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
d6b48e9c 486 inf->stop_soon = NO_STOP_QUIETLY;
dabbe2c0
KB
487}
488
489/* LOCAL FUNCTION
490
491 current_sos -- build a list of currently loaded shared objects
492
493 SYNOPSIS
494
495 struct so_list *current_sos ()
496
497 DESCRIPTION
498
499 Build a list of `struct so_list' objects describing the shared
500 objects currently loaded in the inferior. This list does not
501 include an entry for the main executable file.
502
503 Note that we only gather information directly available from the
504 inferior --- we don't examine any of the shared library files
505 themselves. The declaration of `struct so_list' says which fields
506 we provide values for. */
507
508static struct so_list *
509irix_current_sos (void)
510{
e17a4113
UW
511 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
512 int addr_size = gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT;
dabbe2c0
KB
513 CORE_ADDR lma;
514 char addr_buf[8];
515 struct so_list *head = 0;
516 struct so_list **link_ptr = &head;
517 int is_first = 1;
518 struct lm_info lm;
519
520 /* Make sure we've looked up the inferior's dynamic linker's base
521 structure. */
522 if (!debug_base)
523 {
524 debug_base = locate_base ();
525
526 /* If we can't find the dynamic linker's base structure, this
527 must not be a dynamically linked executable. Hmm. */
528 if (!debug_base)
529 return 0;
530 }
531
e17a4113
UW
532 read_memory (debug_base, addr_buf, addr_size);
533 lma = extract_mips_address (addr_buf, addr_size, byte_order);
dabbe2c0
KB
534
535 while (lma)
536 {
537 lm = fetch_lm_info (lma);
538 if (!is_first)
539 {
540 int errcode;
541 char *name_buf;
542 int name_size;
543 struct so_list *new
544 = (struct so_list *) xmalloc (sizeof (struct so_list));
545 struct cleanup *old_chain = make_cleanup (xfree, new);
546
547 memset (new, 0, sizeof (*new));
548
549 new->lm_info = xmalloc (sizeof (struct lm_info));
550 make_cleanup (xfree, new->lm_info);
551
552 *new->lm_info = lm;
553
554 /* Extract this shared object's name. */
555 name_size = lm.pathname_len;
556 if (name_size == 0)
557 name_size = SO_NAME_MAX_PATH_SIZE - 1;
558
559 if (name_size >= SO_NAME_MAX_PATH_SIZE)
560 {
561 name_size = SO_NAME_MAX_PATH_SIZE - 1;
562 warning
563 ("current_sos: truncating name of %d characters to only %d characters",
564 lm.pathname_len, name_size);
565 }
566
567 target_read_string (lm.pathname_addr, &name_buf,
568 name_size, &errcode);
569 if (errcode != 0)
8a3fe4f8 570 warning (_("Can't read pathname for load map: %s."),
dabbe2c0 571 safe_strerror (errcode));
dabbe2c0
KB
572 else
573 {
574 strncpy (new->so_name, name_buf, name_size);
575 new->so_name[name_size] = '\0';
576 xfree (name_buf);
577 strcpy (new->so_original_name, new->so_name);
578 }
579
580 new->next = 0;
581 *link_ptr = new;
582 link_ptr = &new->next;
583
584 discard_cleanups (old_chain);
585 }
586 is_first = 0;
587 lma = lm.next;
588 }
589
590 return head;
591}
592
593/*
594
595 LOCAL FUNCTION
596
597 irix_open_symbol_file_object
598
599 SYNOPSIS
600
601 void irix_open_symbol_file_object (void *from_tty)
602
603 DESCRIPTION
604
605 If no open symbol file, attempt to locate and open the main symbol
606 file. On IRIX, this is the first link map entry. If its name is
607 here, we can open it. Useful when attaching to a process without
608 first loading its symbol file.
609
610 If FROM_TTYP dereferences to a non-zero integer, allow messages to
611 be printed. This parameter is a pointer rather than an int because
612 open_symbol_file_object() is called via catch_errors() and
613 catch_errors() requires a pointer argument. */
614
615static int
616irix_open_symbol_file_object (void *from_ttyp)
617{
e17a4113
UW
618 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
619 int addr_size = gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT;
dabbe2c0
KB
620 CORE_ADDR lma;
621 char addr_buf[8];
622 struct lm_info lm;
623 struct cleanup *cleanups;
624 int errcode;
625 int from_tty = *(int *) from_ttyp;
626 char *filename;
627
628 if (symfile_objfile)
9e2f0ad4 629 if (!query (_("Attempt to reload symbols from process? ")))
dabbe2c0
KB
630 return 0;
631
632 if ((debug_base = locate_base ()) == 0)
633 return 0; /* failed somehow... */
634
635 /* First link map member should be the executable. */
e17a4113
UW
636 read_memory (debug_base, addr_buf, addr_size);
637 lma = extract_mips_address (addr_buf, addr_size, byte_order);
dabbe2c0
KB
638 if (lma == 0)
639 return 0; /* failed somehow... */
640
641 lm = fetch_lm_info (lma);
642
643 if (lm.pathname_addr == 0)
644 return 0; /* No filename. */
645
646 /* Now fetch the filename from target memory. */
647 target_read_string (lm.pathname_addr, &filename, SO_NAME_MAX_PATH_SIZE - 1,
648 &errcode);
649
650 if (errcode)
651 {
8a3fe4f8 652 warning (_("failed to read exec filename from attached file: %s"),
dabbe2c0
KB
653 safe_strerror (errcode));
654 return 0;
655 }
656
657 cleanups = make_cleanup (xfree, filename);
658 /* Have a pathname: read the symbol file. */
659 symbol_file_add_main (filename, from_tty);
660
661 do_cleanups (cleanups);
662
663 return 1;
664}
665
666
667/*
668
669 LOCAL FUNCTION
670
671 irix_special_symbol_handling -- additional shared library symbol handling
672
673 SYNOPSIS
674
675 void irix_special_symbol_handling ()
676
677 DESCRIPTION
678
679 Once the symbols from a shared object have been loaded in the usual
680 way, we are called to do any system specific symbol handling that
681 is needed.
682
683 For SunOS4, this consisted of grunging around in the dynamic
684 linkers structures to find symbol definitions for "common" symbols
685 and adding them to the minimal symbol table for the runtime common
686 objfile.
687
688 However, for IRIX, there's nothing to do.
689
690 */
691
692static void
693irix_special_symbol_handling (void)
694{
695}
696
697/* Using the solist entry SO, relocate the addresses in SEC. */
698
699static void
700irix_relocate_section_addresses (struct so_list *so,
0542c86d 701 struct target_section *sec)
dabbe2c0
KB
702{
703 sec->addr += so->lm_info->reloc_offset;
704 sec->endaddr += so->lm_info->reloc_offset;
705}
706
707/* Free the lm_info struct. */
708
709static void
710irix_free_so (struct so_list *so)
711{
712 xfree (so->lm_info);
713}
714
715/* Clear backend specific state. */
716
717static void
718irix_clear_solib (void)
719{
720 debug_base = 0;
721}
722
723/* Return 1 if PC lies in the dynamic symbol resolution code of the
724 run time loader. */
725static int
726irix_in_dynsym_resolve_code (CORE_ADDR pc)
727{
728 return 0;
729}
730
734598d9 731struct target_so_ops irix_so_ops;
dabbe2c0 732
63807e1d
PA
733/* Provide a prototype to silence -Wmissing-prototypes. */
734extern initialize_file_ftype _initialize_irix_solib;
735
dabbe2c0
KB
736void
737_initialize_irix_solib (void)
738{
739 irix_so_ops.relocate_section_addresses = irix_relocate_section_addresses;
740 irix_so_ops.free_so = irix_free_so;
741 irix_so_ops.clear_solib = irix_clear_solib;
742 irix_so_ops.solib_create_inferior_hook = irix_solib_create_inferior_hook;
743 irix_so_ops.special_symbol_handling = irix_special_symbol_handling;
744 irix_so_ops.current_sos = irix_current_sos;
745 irix_so_ops.open_symbol_file_object = irix_open_symbol_file_object;
746 irix_so_ops.in_dynsym_resolve_code = irix_in_dynsym_resolve_code;
831a0c44 747 irix_so_ops.bfd_open = solib_bfd_open;
dabbe2c0 748}
This page took 2.198441 seconds and 4 git commands to generate.