Commit | Line | Data |
---|---|---|
684a832f SG |
1 | /* Read HP PA/Risc object files for GDB. |
2 | Copyright 1991, 1992 Free Software Foundation, Inc. | |
3 | Written by Fred Fish at Cygnus Support. | |
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 | |
9 | the Free Software Foundation; either version 2 of the License, or | |
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 | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
684a832f SG |
21 | #include "defs.h" |
22 | #include "bfd.h" | |
1225fcbd | 23 | #include <time.h> /* For time_t in libbfd.h. */ |
ddf5d7e8 | 24 | #include <sys/types.h> /* For time_t, if not in time.h. */ |
684a832f | 25 | #include "libbfd.h" |
61a29659 | 26 | #include "som.h" |
003ccb90 | 27 | #include "libhppa.h" |
684a832f SG |
28 | #include <syms.h> |
29 | #include "symtab.h" | |
30 | #include "symfile.h" | |
31 | #include "objfiles.h" | |
32 | #include "buildsym.h" | |
2731625a | 33 | #include "stabsread.h" |
684a832f SG |
34 | #include "gdb-stabs.h" |
35 | #include "complaints.h" | |
36 | #include <string.h> | |
37 | #include "demangle.h" | |
38 | #include <sys/file.h> | |
1225fcbd JK |
39 | |
40 | /* Size of n_value and n_strx fields in a stab symbol. */ | |
41 | #define BYTES_IN_WORD 4 | |
42 | ||
0213d96f | 43 | #include "aout/aout64.h" |
684a832f SG |
44 | |
45 | /* Various things we might complain about... */ | |
46 | ||
47 | static void | |
48 | pa_symfile_init PARAMS ((struct objfile *)); | |
49 | ||
50 | static void | |
51 | pa_new_init PARAMS ((struct objfile *)); | |
52 | ||
53 | static void | |
54 | pa_symfile_read PARAMS ((struct objfile *, struct section_offsets *, int)); | |
55 | ||
56 | static void | |
57 | pa_symfile_finish PARAMS ((struct objfile *)); | |
58 | ||
59 | static void | |
60 | pa_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *)); | |
61 | ||
62 | static void | |
63 | free_painfo PARAMS ((PTR)); | |
64 | ||
65 | static struct section_offsets * | |
66 | pa_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); | |
67 | ||
68 | static void | |
69 | record_minimal_symbol PARAMS ((char *, CORE_ADDR, | |
70 | enum minimal_symbol_type, | |
71 | struct objfile *)); | |
72 | ||
73 | static void | |
74 | record_minimal_symbol (name, address, ms_type, objfile) | |
75 | char *name; | |
76 | CORE_ADDR address; | |
77 | enum minimal_symbol_type ms_type; | |
78 | struct objfile *objfile; | |
79 | { | |
80 | name = obsavestring (name, strlen (name), &objfile -> symbol_obstack); | |
8d60affd | 81 | prim_record_minimal_symbol (name, address, ms_type, objfile); |
684a832f SG |
82 | } |
83 | ||
84 | /* | |
85 | ||
86 | LOCAL FUNCTION | |
87 | ||
88 | pa_symtab_read -- read the symbol table of a PA file | |
89 | ||
90 | SYNOPSIS | |
91 | ||
92 | void pa_symtab_read (bfd *abfd, CORE_ADDR addr, | |
93 | struct objfile *objfile) | |
94 | ||
95 | DESCRIPTION | |
96 | ||
97 | Given an open bfd, a base address to relocate symbols to, and a | |
98 | flag that specifies whether or not this bfd is for an executable | |
99 | or not (may be shared library for example), add all the global | |
100 | function and data symbols to the minimal symbol table. | |
101 | */ | |
102 | ||
103 | static void | |
104 | pa_symtab_read (abfd, addr, objfile) | |
105 | bfd *abfd; | |
106 | CORE_ADDR addr; | |
107 | struct objfile *objfile; | |
108 | { | |
109 | unsigned int number_of_symbols; | |
110 | unsigned int i; | |
699daa9c | 111 | int val, dynamic; |
684a832f | 112 | char *stringtab; |
699daa9c | 113 | asection *shlib_info; |
3cde1ffa JK |
114 | struct symbol_dictionary_record *buf, *bufp, *endbufp; |
115 | char *symname; | |
0213d96f | 116 | CONST int symsize = sizeof (struct symbol_dictionary_record); |
684a832f | 117 | |
0213d96f | 118 | number_of_symbols = bfd_get_symcount (abfd); |
684a832f | 119 | |
0213d96f | 120 | buf = alloca (symsize * number_of_symbols); |
003ccb90 | 121 | bfd_seek (abfd, obj_som_sym_filepos (abfd), L_SET); |
0213d96f SG |
122 | val = bfd_read (buf, symsize * number_of_symbols, 1, abfd); |
123 | if (val != symsize * number_of_symbols) | |
684a832f SG |
124 | error ("Couldn't read symbol dictionary!"); |
125 | ||
003ccb90 KR |
126 | stringtab = alloca (obj_som_stringtab_size (abfd)); |
127 | bfd_seek (abfd, obj_som_str_filepos (abfd), L_SET); | |
128 | val = bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd); | |
129 | if (val != obj_som_stringtab_size (abfd)) | |
684a832f | 130 | error ("Can't read in HP string table."); |
3cde1ffa | 131 | |
699daa9c JL |
132 | /* We need to determine if objfile is a dynamic executable (so we |
133 | can do the right thing for ST_ENTRY vs ST_CODE symbols). | |
134 | ||
135 | There's nothing in the header which easily allows us to do | |
136 | this. The only reliable way I know of is to check for the | |
137 | existance of a $SHLIB_INFO$ section with a non-zero size. */ | |
138 | shlib_info = bfd_get_section_by_name (objfile->obfd, "$SHLIB_INFO$"); | |
139 | if (shlib_info) | |
140 | dynamic = (bfd_section_size (objfile->obfd, shlib_info) != 0); | |
141 | else | |
142 | dynamic = 0; | |
143 | ||
3cde1ffa JK |
144 | endbufp = buf + number_of_symbols; |
145 | for (bufp = buf; bufp < endbufp; ++bufp) | |
684a832f SG |
146 | { |
147 | enum minimal_symbol_type ms_type; | |
148 | ||
149 | QUIT; | |
150 | ||
3cde1ffa JK |
151 | switch (bufp->symbol_scope) |
152 | { | |
153 | case SS_UNIVERSAL: | |
699daa9c | 154 | case SS_EXTERNAL: |
3cde1ffa JK |
155 | switch (bufp->symbol_type) |
156 | { | |
157 | case ST_SYM_EXT: | |
158 | case ST_ARG_EXT: | |
159 | continue; | |
160 | ||
161 | case ST_CODE: | |
162 | case ST_PRI_PROG: | |
163 | case ST_SEC_PROG: | |
3cde1ffa JK |
164 | case ST_MILLICODE: |
165 | symname = bufp->name.n_strx + stringtab; | |
166 | ms_type = mst_text; | |
9fdb3f7a JK |
167 | #ifdef SMASH_TEXT_ADDRESS |
168 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
169 | #endif | |
3cde1ffa | 170 | break; |
699daa9c JL |
171 | |
172 | case ST_ENTRY: | |
173 | symname = bufp->name.n_strx + stringtab; | |
174 | /* For a dynamic executable, ST_ENTRY symbols are | |
175 | the stubs, while the ST_CODE symbol is the real | |
176 | function. */ | |
177 | if (dynamic) | |
178 | ms_type = mst_solib_trampoline; | |
179 | else | |
180 | ms_type = mst_text; | |
181 | #ifdef SMASH_TEXT_ADDRESS | |
182 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
183 | #endif | |
184 | break; | |
185 | ||
186 | case ST_STUB: | |
187 | symname = bufp->name.n_strx + stringtab; | |
188 | ms_type = mst_solib_trampoline; | |
189 | #ifdef SMASH_TEXT_ADDRESS | |
190 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
191 | #endif | |
192 | break; | |
193 | ||
3cde1ffa JK |
194 | case ST_DATA: |
195 | symname = bufp->name.n_strx + stringtab; | |
196 | ms_type = mst_data; | |
197 | break; | |
198 | default: | |
199 | continue; | |
200 | } | |
201 | break; | |
202 | ||
247145e6 JK |
203 | #if 0 |
204 | /* SS_GLOBAL and SS_LOCAL are two names for the same thing (!). */ | |
3cde1ffa | 205 | case SS_GLOBAL: |
247145e6 | 206 | #endif |
3cde1ffa JK |
207 | case SS_LOCAL: |
208 | switch (bufp->symbol_type) | |
209 | { | |
210 | case ST_SYM_EXT: | |
211 | case ST_ARG_EXT: | |
212 | continue; | |
213 | ||
214 | case ST_CODE: | |
215 | symname = bufp->name.n_strx + stringtab; | |
247145e6 | 216 | ms_type = mst_file_text; |
9fdb3f7a JK |
217 | #ifdef SMASH_TEXT_ADDRESS |
218 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
219 | #endif | |
247145e6 JK |
220 | |
221 | check_strange_names: | |
d64956fa JL |
222 | /* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local |
223 | label prefixes for stabs, constant data, etc. So we need | |
224 | only filter out L$ symbols which are left in due to | |
225 | limitations in how GAS generates SOM relocations. | |
226 | ||
227 | When linking in the HPUX C-library the HP linker has | |
228 | the nasty habit of placing section symbols from the literal | |
229 | subspaces in the middle of the program's text. Filter | |
230 | those out as best we can. Check for first and last character | |
231 | being '$'. */ | |
232 | if ((symname[0] == 'L' && symname[1] == '$') | |
233 | || (symname[0] == '$' && symname[strlen(symname) - 1] == '$')) | |
3cde1ffa | 234 | continue; |
3cde1ffa JK |
235 | break; |
236 | ||
237 | case ST_PRI_PROG: | |
238 | case ST_SEC_PROG: | |
3cde1ffa JK |
239 | case ST_MILLICODE: |
240 | symname = bufp->name.n_strx + stringtab; | |
241 | ms_type = mst_file_text; | |
9fdb3f7a JK |
242 | #ifdef SMASH_TEXT_ADDRESS |
243 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
244 | #endif | |
3cde1ffa | 245 | break; |
247145e6 | 246 | |
699daa9c JL |
247 | case ST_ENTRY: |
248 | symname = bufp->name.n_strx + stringtab; | |
249 | /* For a dynamic executable, ST_ENTRY symbols are | |
250 | the stubs, while the ST_CODE symbol is the real | |
251 | function. */ | |
252 | if (dynamic) | |
253 | ms_type = mst_solib_trampoline; | |
254 | else | |
255 | ms_type = mst_file_text; | |
256 | #ifdef SMASH_TEXT_ADDRESS | |
257 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
258 | #endif | |
259 | break; | |
260 | ||
261 | case ST_STUB: | |
262 | symname = bufp->name.n_strx + stringtab; | |
263 | ms_type = mst_solib_trampoline; | |
264 | #ifdef SMASH_TEXT_ADDRESS | |
265 | SMASH_TEXT_ADDRESS (bufp->symbol_value); | |
266 | #endif | |
267 | break; | |
268 | ||
269 | ||
3cde1ffa JK |
270 | case ST_DATA: |
271 | symname = bufp->name.n_strx + stringtab; | |
272 | ms_type = mst_file_data; | |
247145e6 JK |
273 | goto check_strange_names; |
274 | ||
3cde1ffa JK |
275 | default: |
276 | continue; | |
277 | } | |
247145e6 JK |
278 | break; |
279 | ||
3cde1ffa JK |
280 | default: |
281 | continue; | |
282 | } | |
684a832f | 283 | |
003ccb90 | 284 | if (bufp->name.n_strx > obj_som_stringtab_size (abfd)) |
684a832f SG |
285 | error ("Invalid symbol data; bad HP string table offset: %d", |
286 | bufp->name.n_strx); | |
287 | ||
3cde1ffa | 288 | record_minimal_symbol (symname, |
684a832f SG |
289 | bufp->symbol_value, ms_type, |
290 | objfile); | |
291 | } | |
292 | ||
293 | install_minimal_symbols (objfile); | |
294 | } | |
295 | ||
296 | /* Scan and build partial symbols for a symbol file. | |
297 | We have been initialized by a call to pa_symfile_init, which | |
298 | currently does nothing. | |
299 | ||
300 | SECTION_OFFSETS is a set of offsets to apply to relocate the symbols | |
301 | in each section. This is ignored, as it isn't needed for the PA. | |
302 | ||
303 | MAINLINE is true if we are reading the main symbol | |
304 | table (as opposed to a shared lib or dynamically loaded file). | |
305 | ||
306 | This function only does the minimum work necessary for letting the | |
307 | user "name" things symbolically; it does not read the entire symtab. | |
308 | Instead, it reads the external and static symbols and puts them in partial | |
309 | symbol tables. When more extensive information is requested of a | |
310 | file, the corresponding partial symbol table is mutated into a full | |
311 | fledged symbol table by going back and reading the symbols | |
312 | for real. | |
313 | ||
314 | We look for sections with specific names, to tell us what debug | |
315 | format to look for: FIXME!!! | |
316 | ||
317 | pastab_build_psymtabs() handles STABS symbols. | |
318 | ||
319 | Note that PA files have a "minimal" symbol table, which is vaguely | |
320 | reminiscent of a COFF symbol table, but has only the minimal information | |
321 | necessary for linking. We process this also, and use the information to | |
322 | build gdb's minimal symbol table. This gives us some minimal debugging | |
323 | capability even for files compiled without -g. */ | |
324 | ||
325 | static void | |
326 | pa_symfile_read (objfile, section_offsets, mainline) | |
327 | struct objfile *objfile; | |
328 | struct section_offsets *section_offsets; | |
329 | int mainline; | |
330 | { | |
331 | bfd *abfd = objfile->obfd; | |
332 | struct cleanup *back_to; | |
333 | CORE_ADDR offset; | |
334 | ||
335 | init_minimal_symbol_collection (); | |
336 | back_to = make_cleanup (discard_minimal_symbols, 0); | |
337 | ||
338 | make_cleanup (free_painfo, (PTR) objfile); | |
339 | ||
340 | /* Process the normal PA symbol table first. */ | |
341 | ||
342 | /* FIXME, should take a section_offsets param, not just an offset. */ | |
343 | ||
344 | offset = ANOFFSET (section_offsets, 0); | |
345 | pa_symtab_read (abfd, offset, objfile); | |
346 | ||
347 | /* Now process debugging information, which is contained in | |
348 | special PA sections. */ | |
349 | ||
350 | pastab_build_psymtabs (objfile, section_offsets, mainline); | |
351 | ||
352 | do_cleanups (back_to); | |
353 | } | |
354 | ||
965a5c32 | 355 | /* This cleans up the objfile's sym_stab_info pointer, and the chain of |
684a832f SG |
356 | stab_section_info's, that might be dangling from it. */ |
357 | ||
358 | static void | |
359 | free_painfo (objp) | |
360 | PTR objp; | |
361 | { | |
362 | struct objfile *objfile = (struct objfile *)objp; | |
363 | struct dbx_symfile_info *dbxinfo = (struct dbx_symfile_info *) | |
965a5c32 | 364 | objfile->sym_stab_info; |
684a832f SG |
365 | struct stab_section_info *ssi, *nssi; |
366 | ||
367 | ssi = dbxinfo->stab_section_info; | |
368 | while (ssi) | |
369 | { | |
370 | nssi = ssi->next; | |
371 | mfree (objfile->md, ssi); | |
372 | ssi = nssi; | |
373 | } | |
374 | ||
375 | dbxinfo->stab_section_info = 0; /* Just say No mo info about this. */ | |
376 | } | |
377 | ||
378 | /* Initialize anything that needs initializing when a completely new symbol | |
379 | file is specified (not just adding some symbols from another file, e.g. a | |
380 | shared library). | |
381 | ||
382 | We reinitialize buildsym, since we may be reading stabs from a PA file. */ | |
383 | ||
384 | static void | |
385 | pa_new_init (ignore) | |
386 | struct objfile *ignore; | |
387 | { | |
388 | stabsread_new_init (); | |
389 | buildsym_new_init (); | |
390 | } | |
391 | ||
392 | /* Perform any local cleanups required when we are done with a particular | |
393 | objfile. I.E, we are in the process of discarding all symbol information | |
394 | for an objfile, freeing up all memory held for it, and unlinking the | |
395 | objfile struct from the global list of known objfiles. */ | |
396 | ||
397 | static void | |
398 | pa_symfile_finish (objfile) | |
399 | struct objfile *objfile; | |
400 | { | |
965a5c32 | 401 | if (objfile -> sym_stab_info != NULL) |
684a832f | 402 | { |
965a5c32 | 403 | mfree (objfile -> md, objfile -> sym_stab_info); |
684a832f SG |
404 | } |
405 | } | |
406 | ||
684a832f SG |
407 | /* PA specific initialization routine for reading symbols. |
408 | ||
409 | It is passed a pointer to a struct sym_fns which contains, among other | |
410 | things, the BFD for the file whose symbols are being read, and a slot for | |
411 | a pointer to "private data" which we can fill with goodies. | |
412 | ||
413 | This routine is almost a complete ripoff of dbx_symfile_init. The | |
414 | common parts of these routines should be extracted and used instead of | |
415 | duplicating this code. FIXME. */ | |
416 | ||
417 | static void | |
418 | pa_symfile_init (objfile) | |
419 | struct objfile *objfile; | |
420 | { | |
421 | int val; | |
422 | bfd *sym_bfd = objfile->obfd; | |
423 | char *name = bfd_get_filename (sym_bfd); | |
0213d96f SG |
424 | asection *stabsect; /* Section containing symbol table entries */ |
425 | asection *stringsect; /* Section containing symbol name strings */ | |
426 | ||
427 | stabsect = bfd_get_section_by_name (sym_bfd, "$GDB_SYMBOLS$"); | |
428 | stringsect = bfd_get_section_by_name (sym_bfd, "$GDB_STRINGS$"); | |
684a832f SG |
429 | |
430 | /* Allocate struct to keep track of the symfile */ | |
965a5c32 | 431 | objfile->sym_stab_info = (PTR) |
684a832f SG |
432 | xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info)); |
433 | ||
965a5c32 | 434 | memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info)); |
0213d96f | 435 | |
0213d96f | 436 | |
684a832f | 437 | /* FIXME POKING INSIDE BFD DATA STRUCTURES */ |
0213d96f SG |
438 | #define STRING_TABLE_OFFSET (stringsect->filepos) |
439 | #define SYMBOL_TABLE_OFFSET (stabsect->filepos) | |
684a832f SG |
440 | |
441 | /* FIXME POKING INSIDE BFD DATA STRUCTURES */ | |
442 | ||
443 | DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL; | |
db98e4d8 | 444 | DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, "$TEXT$"); |
684a832f | 445 | if (!DBX_TEXT_SECT (objfile)) |
db98e4d8 | 446 | error ("Can't find $TEXT$ section in symbol file"); |
684a832f | 447 | |
f3628b39 FF |
448 | if (!stabsect) |
449 | return; | |
450 | ||
451 | if (!stringsect) | |
452 | error ("Found stabs, but not string section"); | |
453 | ||
1225fcbd JK |
454 | /* FIXME: I suspect this should be external_nlist. The size of host |
455 | types like long and bfd_vma should not affect how we read the | |
456 | file. */ | |
0213d96f SG |
457 | DBX_SYMBOL_SIZE (objfile) = sizeof (struct internal_nlist); |
458 | DBX_SYMCOUNT (objfile) = bfd_section_size (sym_bfd, stabsect) | |
459 | / DBX_SYMBOL_SIZE (objfile); | |
684a832f SG |
460 | DBX_SYMTAB_OFFSET (objfile) = SYMBOL_TABLE_OFFSET; |
461 | ||
462 | /* Read the string table and stash it away in the psymbol_obstack. It is | |
463 | only needed as long as we need to expand psymbols into full symbols, | |
464 | so when we blow away the psymbol the string table goes away as well. | |
465 | Note that gdb used to use the results of attempting to malloc the | |
466 | string table, based on the size it read, as a form of sanity check | |
467 | for botched byte swapping, on the theory that a byte swapped string | |
468 | table size would be so totally bogus that the malloc would fail. Now | |
469 | that we put in on the psymbol_obstack, we can't do this since gdb gets | |
470 | a fatal error (out of virtual memory) if the size is bogus. We can | |
471 | however at least check to see if the size is zero or some negative | |
472 | value. */ | |
473 | ||
0213d96f | 474 | DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (sym_bfd, stringsect); |
684a832f SG |
475 | |
476 | if (DBX_SYMCOUNT (objfile) == 0 | |
477 | || DBX_STRINGTAB_SIZE (objfile) == 0) | |
478 | return; | |
479 | ||
480 | if (DBX_STRINGTAB_SIZE (objfile) <= 0 | |
481 | || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd)) | |
482 | error ("ridiculous string table size (%d bytes).", | |
483 | DBX_STRINGTAB_SIZE (objfile)); | |
484 | ||
485 | DBX_STRINGTAB (objfile) = | |
486 | (char *) obstack_alloc (&objfile -> psymbol_obstack, | |
487 | DBX_STRINGTAB_SIZE (objfile)); | |
488 | ||
489 | /* Now read in the string table in one big gulp. */ | |
490 | ||
491 | val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET); | |
492 | if (val < 0) | |
493 | perror_with_name (name); | |
494 | val = bfd_read (DBX_STRINGTAB (objfile), DBX_STRINGTAB_SIZE (objfile), 1, | |
495 | sym_bfd); | |
93af329a JK |
496 | if (val == 0) |
497 | error ("End of file reading string table"); | |
498 | else if (val < 0) | |
499 | /* It's possible bfd_read should be setting bfd_error, and we should be | |
500 | checking that. But currently it doesn't set bfd_error. */ | |
684a832f | 501 | perror_with_name (name); |
93af329a JK |
502 | else if (val != DBX_STRINGTAB_SIZE (objfile)) |
503 | error ("Short read reading string table"); | |
684a832f SG |
504 | } |
505 | ||
506 | /* PA specific parsing routine for section offsets. | |
507 | ||
508 | Plain and simple for now. */ | |
509 | ||
510 | static struct section_offsets * | |
511 | pa_symfile_offsets (objfile, addr) | |
512 | struct objfile *objfile; | |
513 | CORE_ADDR addr; | |
514 | { | |
515 | struct section_offsets *section_offsets; | |
516 | int i; | |
4d57c599 JK |
517 | |
518 | objfile->num_sections = SECT_OFF_MAX; | |
684a832f SG |
519 | section_offsets = (struct section_offsets *) |
520 | obstack_alloc (&objfile -> psymbol_obstack, | |
4d57c599 JK |
521 | sizeof (struct section_offsets) |
522 | + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); | |
684a832f SG |
523 | |
524 | for (i = 0; i < SECT_OFF_MAX; i++) | |
525 | ANOFFSET (section_offsets, i) = addr; | |
4d57c599 | 526 | |
684a832f SG |
527 | return section_offsets; |
528 | } | |
529 | \f | |
00b02f17 | 530 | /* Register that we are able to handle SOM object file formats. */ |
684a832f | 531 | |
684a832f SG |
532 | static struct sym_fns pa_sym_fns = |
533 | { | |
55449edd | 534 | bfd_target_som_flavour, |
684a832f SG |
535 | pa_new_init, /* sym_new_init: init anything gbl to entire symtab */ |
536 | pa_symfile_init, /* sym_init: read initial info, setup for sym_read() */ | |
537 | pa_symfile_read, /* sym_read: read a symbol file into symtab */ | |
538 | pa_symfile_finish, /* sym_finish: finished with file, cleanup */ | |
539 | pa_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ | |
540 | NULL /* next: pointer to next struct sym_fns */ | |
541 | }; | |
542 | ||
543 | void | |
544 | _initialize_paread () | |
545 | { | |
546 | add_symtab_fns (&pa_sym_fns); | |
547 | } |