]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/solib-pa64.c
Updated copyright notices for most files.
[thirdparty/binutils-gdb.git] / gdb / solib-pa64.c
CommitLineData
419b8bfb
RC
1/* Handle PA64 shared libraries for GDB, the GNU Debugger.
2
0fb0cc75 3 Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
419b8bfb
RC
4
5 This file is part of GDB.
6
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
419b8bfb
RC
10 (at your option) any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>.
419b8bfb
RC
19
20 HP in their infinite stupidity choose not to use standard ELF dynamic
21 linker interfaces. They also choose not to make their ELF dymamic
22 linker interfaces compatible with the SOM dynamic linker. The
23 net result is we can not use either of the existing somsolib.c or
24 solib.c. What a crock.
25
26 Even more disgusting. This file depends on functions provided only
27 in certain PA64 libraries. Thus this file is supposed to only be
28 used native. When will HP ever learn that they need to provide the
29 same functionality in all their libraries! */
30
31#include "defs.h"
419b8bfb
RC
32#include "symtab.h"
33#include "bfd.h"
34#include "symfile.h"
35#include "objfiles.h"
36#include "gdbcore.h"
37#include "target.h"
38#include "inferior.h"
39
40#include "hppa-tdep.h"
41#include "solist.h"
d542061a 42#include "solib.h"
419b8bfb
RC
43#include "solib-pa64.h"
44
45#undef SOLIB_PA64_DBG
46
d542061a
UW
47/* We can build this file only when running natively on 64-bit HP/UX.
48 We check for that by checking for the elf_hp.h header file. */
fb6d93b2 49#if defined(HAVE_ELF_HP_H) && defined(__LP64__)
419b8bfb 50
d0ac9ef8
MK
51/* FIXME: kettenis/20041213: These includes should be eliminated. */
52#include <dlfcn.h>
53#include <elf.h>
54#include <elf_hp.h>
55
419b8bfb
RC
56struct lm_info {
57 struct load_module_desc desc;
58 CORE_ADDR desc_addr;
59};
60
61/* When adding fields, be sure to clear them in _initialize_pa64_solib. */
62typedef struct
63 {
64 CORE_ADDR dld_flags_addr;
65 LONGEST dld_flags;
66 struct bfd_section *dyninfo_sect;
67 int have_read_dld_descriptor;
68 int is_valid;
69 CORE_ADDR load_map;
70 CORE_ADDR load_map_addr;
71 struct load_module_desc dld_desc;
72 }
73dld_cache_t;
74
75static dld_cache_t dld_cache;
76
77static int
78read_dynamic_info (asection *dyninfo_sect, dld_cache_t *dld_cache_p);
79
80static void
81pa64_relocate_section_addresses (struct so_list *so,
82 struct section_table *sec)
83{
45851e00
RC
84 asection *asec = sec->the_bfd_section;
85 CORE_ADDR load_offset;
86
87 /* Relocate all the sections based on where they got loaded. */
88
89 load_offset = bfd_section_vma (so->abfd, asec) - asec->filepos;
90
91 if (asec->flags & SEC_CODE)
92 {
93 sec->addr += so->lm_info->desc.text_base - load_offset;
94 sec->endaddr += so->lm_info->desc.text_base - load_offset;
95 }
96 else if (asec->flags & SEC_DATA)
97 {
98 sec->addr += so->lm_info->desc.data_base - load_offset;
99 sec->endaddr += so->lm_info->desc.data_base - load_offset;
100 }
419b8bfb
RC
101}
102
103static void
104pa64_free_so (struct so_list *so)
105{
106 xfree (so->lm_info);
107}
108
109static void
110pa64_clear_solib (void)
111{
112}
113
114/* Wrapper for target_read_memory for dlgetmodinfo. */
115
116static void *
117pa64_target_read_memory (void *buffer, CORE_ADDR ptr, size_t bufsiz, int ident)
118{
119 if (target_read_memory (ptr, buffer, bufsiz) != 0)
120 return 0;
121 return buffer;
122}
123
124/* Read the dynamic linker's internal shared library descriptor.
125
126 This must happen after dld starts running, so we can't do it in
127 read_dynamic_info. Record the fact that we have loaded the
6536cc32
DA
128 descriptor. If the library is archive bound or the load map
129 hasn't been setup, then return zero; else return nonzero. */
419b8bfb
RC
130
131static int
132read_dld_descriptor (void)
133{
134 char *dll_path;
135 asection *dyninfo_sect;
136
137 /* If necessary call read_dynamic_info to extract the contents of the
138 .dynamic section from the shared library. */
139 if (!dld_cache.is_valid)
140 {
141 if (symfile_objfile == NULL)
8a3fe4f8 142 error (_("No object file symbols."));
419b8bfb
RC
143
144 dyninfo_sect = bfd_get_section_by_name (symfile_objfile->obfd,
145 ".dynamic");
146 if (!dyninfo_sect)
147 {
148 return 0;
149 }
150
151 if (!read_dynamic_info (dyninfo_sect, &dld_cache))
8a3fe4f8 152 error (_("Unable to read in .dynamic section information."));
419b8bfb
RC
153 }
154
155 /* Read the load map pointer. */
156 if (target_read_memory (dld_cache.load_map_addr,
157 (char *) &dld_cache.load_map,
158 sizeof (dld_cache.load_map))
159 != 0)
160 {
8a3fe4f8 161 error (_("Error while reading in load map pointer."));
419b8bfb
RC
162 }
163
6536cc32
DA
164 if (!dld_cache.load_map)
165 return 0;
166
419b8bfb
RC
167 /* Read in the dld load module descriptor */
168 if (dlgetmodinfo (-1,
169 &dld_cache.dld_desc,
170 sizeof (dld_cache.dld_desc),
171 pa64_target_read_memory,
172 0,
173 dld_cache.load_map)
174 == 0)
175 {
8a3fe4f8 176 error (_("Error trying to get information about dynamic linker."));
419b8bfb
RC
177 }
178
179 /* Indicate that we have loaded the dld descriptor. */
180 dld_cache.have_read_dld_descriptor = 1;
181
182 return 1;
183}
184
185
186/* Read the .dynamic section and extract the information of interest,
187 which is stored in dld_cache. The routine elf_locate_base in solib.c
188 was used as a model for this. */
189
190static int
191read_dynamic_info (asection *dyninfo_sect, dld_cache_t *dld_cache_p)
192{
193 char *buf;
194 char *bufend;
195 CORE_ADDR dyninfo_addr;
196 int dyninfo_sect_size;
197 CORE_ADDR entry_addr;
198
199 /* Read in .dynamic section, silently ignore errors. */
200 dyninfo_addr = bfd_section_vma (symfile_objfile->obfd, dyninfo_sect);
201 dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
202 buf = alloca (dyninfo_sect_size);
203 if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
204 return 0;
205
206 /* Scan the .dynamic section and record the items of interest.
207 In particular, DT_HP_DLD_FLAGS */
208 for (bufend = buf + dyninfo_sect_size, entry_addr = dyninfo_addr;
209 buf < bufend;
210 buf += sizeof (Elf64_Dyn), entry_addr += sizeof (Elf64_Dyn))
211 {
212 Elf64_Dyn *x_dynp = (Elf64_Dyn*)buf;
213 Elf64_Sxword dyn_tag;
214 CORE_ADDR dyn_ptr;
215 char *pbuf;
216
819844ad 217 pbuf = alloca (gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT);
419b8bfb
RC
218 dyn_tag = bfd_h_get_64 (symfile_objfile->obfd,
219 (bfd_byte*) &x_dynp->d_tag);
220
221 /* We can't use a switch here because dyn_tag is 64 bits and HP's
222 lame comiler does not handle 64bit items in switch statements. */
223 if (dyn_tag == DT_NULL)
224 break;
225 else if (dyn_tag == DT_HP_DLD_FLAGS)
226 {
227 /* Set dld_flags_addr and dld_flags in *dld_cache_p */
228 dld_cache_p->dld_flags_addr = entry_addr + offsetof(Elf64_Dyn, d_un);
229 if (target_read_memory (dld_cache_p->dld_flags_addr,
230 (char*) &dld_cache_p->dld_flags,
231 sizeof (dld_cache_p->dld_flags))
232 != 0)
233 {
8a3fe4f8 234 error (_("Error while reading in .dynamic section of the program."));
419b8bfb
RC
235 }
236 }
237 else if (dyn_tag == DT_HP_LOAD_MAP)
238 {
239 /* Dld will place the address of the load map at load_map_addr
240 after it starts running. */
241 if (target_read_memory (entry_addr + offsetof(Elf64_Dyn,
242 d_un.d_ptr),
243 (char*) &dld_cache_p->load_map_addr,
244 sizeof (dld_cache_p->load_map_addr))
245 != 0)
246 {
8a3fe4f8 247 error (_("Error while reading in .dynamic section of the program."));
419b8bfb
RC
248 }
249 }
250 else
251 {
252 /* tag is not of interest */
253 }
254 }
255
256 /* Record other information and set is_valid to 1. */
257 dld_cache_p->dyninfo_sect = dyninfo_sect;
258
259 /* Verify that we read in required info. These fields are re-set to zero
260 in pa64_solib_restart. */
261
262 if (dld_cache_p->dld_flags_addr != 0 && dld_cache_p->load_map_addr != 0)
263 dld_cache_p->is_valid = 1;
264 else
265 return 0;
266
267 return 1;
268}
269
270/*
271 bfd_lookup_symbol -- lookup the value for a specific symbol
272
273 An expensive way to lookup the value of a single symbol for
274 bfd's that are only temporary anyway. This is used by the
275 shared library support to find the address of the debugger
276 interface structures in the shared library.
277
278 Note that 0 is specifically allowed as an error return (no
279 such symbol).
280 */
281
282static CORE_ADDR
283bfd_lookup_symbol (bfd *abfd, char *symname)
284{
285 unsigned int storage_needed;
286 asymbol *sym;
287 asymbol **symbol_table;
288 unsigned int number_of_symbols;
289 unsigned int i;
290 struct cleanup *back_to;
291 CORE_ADDR symaddr = 0;
292
293 storage_needed = bfd_get_symtab_upper_bound (abfd);
294
295 if (storage_needed > 0)
296 {
297 symbol_table = (asymbol **) xmalloc (storage_needed);
298 back_to = make_cleanup (xfree, symbol_table);
299 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
300
301 for (i = 0; i < number_of_symbols; i++)
302 {
303 sym = *symbol_table++;
304 if (strcmp (sym->name, symname) == 0)
305 {
306 /* Bfd symbols are section relative. */
307 symaddr = sym->value + sym->section->vma;
308 break;
309 }
310 }
311 do_cleanups (back_to);
312 }
313 return (symaddr);
314}
315
316
317/* This hook gets called just before the first instruction in the
318 inferior process is executed.
319
320 This is our opportunity to set magic flags in the inferior so
321 that GDB can be notified when a shared library is mapped in and
322 to tell the dynamic linker that a private copy of the library is
323 needed (so GDB can set breakpoints in the library).
324
7be67755
DA
325 We need to set DT_HP_DEBUG_CALLBACK to indicate that we want the
326 dynamic linker to call the breakpoint routine for significant events.
327 We used to set DT_HP_DEBUG_PRIVATE to indicate that shared libraries
328 should be mapped private. However, this flag can be set using
329 "chatr +dbg enable". Not setting DT_HP_DEBUG_PRIVATE allows debugging
330 with shared libraries mapped shareable. */
419b8bfb
RC
331
332static void
333pa64_solib_create_inferior_hook (void)
334{
335 struct minimal_symbol *msymbol;
336 unsigned int dld_flags, status;
337 asection *shlib_info, *interp_sect;
338 char buf[4];
339 struct objfile *objfile;
340 CORE_ADDR anaddr;
341
342 /* First, remove all the solib event breakpoints. Their addresses
343 may have changed since the last time we ran the program. */
344 remove_solib_event_breakpoints ();
345
346 if (symfile_objfile == NULL)
347 return;
348
349 /* First see if the objfile was dynamically linked. */
350 shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, ".dynamic");
351 if (!shlib_info)
352 return;
353
354 /* It's got a .dynamic section, make sure it's not empty. */
355 if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0)
356 return;
357
358 /* Read in the .dynamic section. */
359 if (! read_dynamic_info (shlib_info, &dld_cache))
8a3fe4f8 360 error (_("Unable to read the .dynamic section."));
419b8bfb 361
7be67755
DA
362 /* If the libraries were not mapped private, warn the user. */
363 if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
364 warning
365 (_("Private mapping of shared library text was not specified\n"
366 "by the executable; setting a breakpoint in a shared library which\n"
367 "is not privately mapped will not work. See the HP-UX 11i v3 chatr\n"
368 "manpage for methods to privately map shared library text."));
369
419b8bfb 370 /* Turn on the flags we care about. */
419b8bfb
RC
371 dld_cache.dld_flags |= DT_HP_DEBUG_CALLBACK;
372 status = target_write_memory (dld_cache.dld_flags_addr,
373 (char *) &dld_cache.dld_flags,
374 sizeof (dld_cache.dld_flags));
375 if (status != 0)
8a3fe4f8 376 error (_("Unable to modify dynamic linker flags."));
419b8bfb
RC
377
378 /* Now we have to create a shared library breakpoint in the dynamic
379 linker. This can be somewhat tricky since the symbol is inside
380 the dynamic linker (for which we do not have symbols or a base
381 load address! Luckily I wrote this code for solib.c years ago. */
382 interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
383 if (interp_sect)
384 {
385 unsigned int interp_sect_size;
386 char *buf;
387 CORE_ADDR load_addr;
388 bfd *tmp_bfd;
389 CORE_ADDR sym_addr = 0;
390
391 /* Read the contents of the .interp section into a local buffer;
392 the contents specify the dynamic linker this program uses. */
393 interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
394 buf = alloca (interp_sect_size);
395 bfd_get_section_contents (exec_bfd, interp_sect,
396 buf, 0, interp_sect_size);
397
398 /* Now we need to figure out where the dynamic linker was
399 loaded so that we can load its symbols and place a breakpoint
400 in the dynamic linker itself.
401
402 This address is stored on the stack. However, I've been unable
403 to find any magic formula to find it for Solaris (appears to
404 be trivial on GNU/Linux). Therefore, we have to try an alternate
405 mechanism to find the dynamic linker's base address. */
406 tmp_bfd = bfd_openr (buf, gnutarget);
407 if (tmp_bfd == NULL)
408 return;
409
410 /* Make sure the dynamic linker's really a useful object. */
411 if (!bfd_check_format (tmp_bfd, bfd_object))
412 {
8a3fe4f8 413 warning (_("Unable to grok dynamic linker %s as an object file"), buf);
419b8bfb
RC
414 bfd_close (tmp_bfd);
415 return;
416 }
417
418 /* We find the dynamic linker's base address by examining the
419 current pc (which point at the entry point for the dynamic
420 linker) and subtracting the offset of the entry point.
421
422 Also note the breakpoint is the second instruction in the
423 routine. */
424 load_addr = read_pc () - tmp_bfd->start_address;
425 sym_addr = bfd_lookup_symbol (tmp_bfd, "__dld_break");
426 sym_addr = load_addr + sym_addr + 4;
427
428 /* Create the shared library breakpoint. */
429 {
430 struct breakpoint *b
431 = create_solib_event_breakpoint (sym_addr);
432
433 /* The breakpoint is actually hard-coded into the dynamic linker,
434 so we don't need to actually insert a breakpoint instruction
435 there. In fact, the dynamic linker's code is immutable, even to
436 ttrace, so we shouldn't even try to do that. For cases like
437 this, we have "permanent" breakpoints. */
438 make_breakpoint_permanent (b);
439 }
440
441 /* We're done with the temporary bfd. */
442 bfd_close (tmp_bfd);
443 }
444}
445
446static void
447pa64_special_symbol_handling (void)
448{
449}
450
451static struct so_list *
452pa64_current_sos (void)
453{
454 struct so_list *head = 0;
455 struct so_list **link_ptr = &head;
456 int dll_index;
457
458 /* Read in the load map pointer if we have not done so already. */
459 if (! dld_cache.have_read_dld_descriptor)
460 if (! read_dld_descriptor ())
461 return NULL;
462
45851e00 463 for (dll_index = -1; ; dll_index++)
419b8bfb
RC
464 {
465 struct load_module_desc dll_desc;
466 char *dll_path;
467 struct so_list *new;
468 struct cleanup *old_chain;
469
45851e00
RC
470 if (dll_index == 0)
471 continue;
472
419b8bfb
RC
473 /* Read in the load module descriptor. */
474 if (dlgetmodinfo (dll_index, &dll_desc, sizeof (dll_desc),
475 pa64_target_read_memory, 0, dld_cache.load_map)
476 == 0)
477 break;
478
479 /* Get the name of the shared library. */
480 dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc),
481 pa64_target_read_memory,
482 0, dld_cache.load_map);
483
419b8bfb
RC
484 new = (struct so_list *) xmalloc (sizeof (struct so_list));
485 memset (new, 0, sizeof (struct so_list));
486 new->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
487 memset (new->lm_info, 0, sizeof (struct lm_info));
488
489 strncpy (new->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
490 new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
491 strcpy (new->so_original_name, new->so_name);
492
493 memcpy (&new->lm_info->desc, &dll_desc, sizeof (dll_desc));
494
495#ifdef SOLIB_PA64_DBG
496 {
497 struct load_module_desc *d = &new->lm_info->desc;
498 printf ("\n+ library \"%s\" is described at index %d\n", new->so_name,
499 dll_index);
500 printf (" text_base = 0x%llx\n", d->text_base);
501 printf (" text_size = 0x%llx\n", d->text_size);
502 printf (" data_base = 0x%llx\n", d->data_base);
503 printf (" data_size = 0x%llx\n", d->data_size);
504 printf (" unwind_base = 0x%llx\n", d->unwind_base);
505 printf (" linkage_ptr = 0x%llx\n", d->linkage_ptr);
506 printf (" phdr_base = 0x%llx\n", d->phdr_base);
507 printf (" tls_size = 0x%llx\n", d->tls_size);
508 printf (" tls_start_addr = 0x%llx\n", d->tls_start_addr);
509 printf (" unwind_size = 0x%llx\n", d->unwind_size);
510 printf (" tls_index = 0x%llx\n", d->tls_index);
511 }
512#endif
513
514 /* Link the new object onto the list. */
515 new->next = NULL;
516 *link_ptr = new;
517 link_ptr = &new->next;
518 }
519
520 return head;
521}
522
523static int
524pa64_open_symbol_file_object (void *from_ttyp)
525{
526 int from_tty = *(int *)from_ttyp;
527 char buf[4];
528 struct load_module_desc dll_desc;
529 char *dll_path;
530
531 if (symfile_objfile)
532 if (!query ("Attempt to reload symbols from process? "))
533 return 0;
534
535 /* Read in the load map pointer if we have not done so already. */
536 if (! dld_cache.have_read_dld_descriptor)
537 if (! read_dld_descriptor ())
538 return 0;
539
540 /* Read in the load module descriptor. */
541 if (dlgetmodinfo (0, &dll_desc, sizeof (dll_desc),
542 pa64_target_read_memory, 0, dld_cache.load_map) == 0)
543 return 0;
544
545 /* Get the name of the shared library. */
546 dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc),
547 pa64_target_read_memory,
548 0, dld_cache.load_map);
549
550 /* Have a pathname: read the symbol file. */
551 symbol_file_add_main (dll_path, from_tty);
552
553 return 1;
554}
555
556/* Return nonzero if PC is an address inside the dynamic linker. */
557static int
558pa64_in_dynsym_resolve_code (CORE_ADDR pc)
559{
560 asection *shlib_info;
561
562 if (symfile_objfile == NULL)
563 return 0;
564
565 if (!dld_cache.have_read_dld_descriptor)
566 if (!read_dld_descriptor ())
567 return 0;
568
569 return (pc >= dld_cache.dld_desc.text_base
570 && pc < dld_cache.dld_desc.text_base + dld_cache.dld_desc.text_size);
571}
572
573
574/* Return the GOT value for the shared library in which ADDR belongs. If
575 ADDR isn't in any known shared library, return zero. */
576
577static CORE_ADDR
578pa64_solib_get_got_by_pc (CORE_ADDR addr)
579{
580 struct so_list *so_list = master_so_list ();
581 CORE_ADDR got_value = 0;
582
583 while (so_list)
584 {
585 if (so_list->lm_info->desc.text_base <= addr
586 && ((so_list->lm_info->desc.text_base
587 + so_list->lm_info->desc.text_size)
588 > addr))
45851e00 589 {
419b8bfb 590 got_value = so_list->lm_info->desc.linkage_ptr;
45851e00 591 break;
419b8bfb
RC
592 }
593 so_list = so_list->next;
594 }
595 return got_value;
596}
597
598/* Get some HPUX-specific data from a shared lib. */
599static CORE_ADDR
600pa64_solib_thread_start_addr (struct so_list *so)
601{
602 return so->lm_info->desc.tls_start_addr;
603}
604
605
606/* Return the address of the handle of the shared library in which ADDR
45851e00 607 belongs. If ADDR isn't in any known shared library, return zero. */
419b8bfb
RC
608
609static CORE_ADDR
610pa64_solib_get_solib_by_pc (CORE_ADDR addr)
611{
612 struct so_list *so_list = master_so_list ();
613 CORE_ADDR retval = 0;
614
615 while (so_list)
616 {
617 if (so_list->lm_info->desc.text_base <= addr
618 && ((so_list->lm_info->desc.text_base
619 + so_list->lm_info->desc.text_size)
620 > addr))
621 {
622 retval = so_list->lm_info->desc_addr;
623 break;
624 }
625 so_list = so_list->next;
626 }
627 return retval;
628}
629
45851e00
RC
630/* pa64 libraries do not seem to set the section offsets in a standard (i.e.
631 SVr4) way; the text section offset stored in the file doesn't correspond
632 to the place where the library is actually loaded into memory. Instead,
633 we rely on the dll descriptor to tell us where things were loaded. */
634static CORE_ADDR
635pa64_solib_get_text_base (struct objfile *objfile)
636{
637 struct so_list *so;
638
639 for (so = master_so_list (); so; so = so->next)
640 if (so->objfile == objfile)
641 return so->lm_info->desc.text_base;
642
643 return 0;
644}
645
419b8bfb
RC
646static struct target_so_ops pa64_so_ops;
647
648extern initialize_file_ftype _initialize_pa64_solib; /* -Wmissing-prototypes */
649
650void
651_initialize_pa64_solib (void)
652{
653 pa64_so_ops.relocate_section_addresses = pa64_relocate_section_addresses;
654 pa64_so_ops.free_so = pa64_free_so;
655 pa64_so_ops.clear_solib = pa64_clear_solib;
656 pa64_so_ops.solib_create_inferior_hook = pa64_solib_create_inferior_hook;
657 pa64_so_ops.special_symbol_handling = pa64_special_symbol_handling;
658 pa64_so_ops.current_sos = pa64_current_sos;
659 pa64_so_ops.open_symbol_file_object = pa64_open_symbol_file_object;
660 pa64_so_ops.in_dynsym_resolve_code = pa64_in_dynsym_resolve_code;
661
662 memset (&dld_cache, 0, sizeof (dld_cache));
663}
664
d542061a 665void pa64_solib_select (struct gdbarch *gdbarch)
419b8bfb 666{
d542061a
UW
667 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
668 set_solib_ops (gdbarch, &pa64_so_ops);
419b8bfb
RC
669
670 tdep->solib_thread_start_addr = pa64_solib_thread_start_addr;
671 tdep->solib_get_got_by_pc = pa64_solib_get_got_by_pc;
672 tdep->solib_get_solib_by_pc = pa64_solib_get_solib_by_pc;
45851e00 673 tdep->solib_get_text_base = pa64_solib_get_text_base;
419b8bfb
RC
674}
675
d542061a 676#else /* HAVE_ELF_HP_H */
419b8bfb
RC
677
678extern initialize_file_ftype _initialize_pa64_solib; /* -Wmissing-prototypes */
679
680void
681_initialize_pa64_solib (void)
682{
683}
684
d542061a 685void pa64_solib_select (struct gdbarch *gdbarch)
419b8bfb
RC
686{
687 /* For a SOM-only target, there is no pa64 solib support. This is needed
688 for hppa-hpux-tdep.c to build. */
8a3fe4f8 689 error (_("Cannot select pa64 solib support for this configuration."));
419b8bfb
RC
690}
691#endif