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