Don't #ifdef inside printf in case printf is a macro.
[deliverable/binutils-gdb.git] / binutils / nm.c
1 /* nm.c -- Describe symbol table of a rel file.
2 Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
3 Free Software Foundation, Inc.
4
5 This file is part of GNU Binutils.
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., 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22 #include "bfd.h"
23 #include "progress.h"
24 #include "bucomm.h"
25 #include "getopt.h"
26 #include "aout/stab_gnu.h"
27 #include "aout/ranlib.h"
28 #include "demangle.h"
29 #include "libiberty.h"
30
31 /* When sorting by size, we use this structure to hold the size and a
32 pointer to the minisymbol. */
33
34 struct size_sym
35 {
36 const PTR minisym;
37 bfd_vma size;
38 };
39
40 /* When fetching relocs, we use this structure to pass information to
41 get_relocs. */
42
43 struct get_relocs_info
44 {
45 asection **secs;
46 arelent ***relocs;
47 long *relcount;
48 asymbol **syms;
49 };
50
51 static void
52 usage PARAMS ((FILE *, int));
53
54 static void
55 set_print_radix PARAMS ((char *));
56
57 static void
58 set_output_format PARAMS ((char *));
59
60 static void
61 display_archive PARAMS ((bfd *));
62
63 static boolean
64 display_file PARAMS ((char *filename));
65
66 static void
67 display_rel_file PARAMS ((bfd * file, bfd * archive));
68
69 static long
70 filter_symbols PARAMS ((bfd *, boolean, PTR, long, unsigned int));
71
72 static long
73 sort_symbols_by_size PARAMS ((bfd *, boolean, PTR, long, unsigned int,
74 struct size_sym **));
75
76 static void
77 print_symbols PARAMS ((bfd *, boolean, PTR, long, unsigned int, bfd *));
78
79 static void
80 print_size_symbols PARAMS ((bfd *, boolean, struct size_sym *, long, bfd *));
81
82 static void
83 print_symname PARAMS ((const char *, const char *, bfd *));
84
85 static void
86 print_symbol PARAMS ((bfd *, asymbol *, bfd *));
87
88 static void
89 print_symdef_entry PARAMS ((bfd * abfd));
90
91 /* The sorting functions. */
92
93 static int
94 numeric_forward PARAMS ((const PTR, const PTR));
95
96 static int
97 numeric_reverse PARAMS ((const PTR, const PTR));
98
99 static int
100 non_numeric_forward PARAMS ((const PTR, const PTR));
101
102 static int
103 non_numeric_reverse PARAMS ((const PTR, const PTR));
104
105 static int
106 size_forward1 PARAMS ((const PTR, const PTR));
107
108 static int
109 size_forward2 PARAMS ((const PTR, const PTR));
110
111 /* The output formatting functions. */
112
113 static void
114 print_object_filename_bsd PARAMS ((char *filename));
115
116 static void
117 print_object_filename_sysv PARAMS ((char *filename));
118
119 static void
120 print_object_filename_posix PARAMS ((char *filename));
121
122
123 static void
124 print_archive_filename_bsd PARAMS ((char *filename));
125
126 static void
127 print_archive_filename_sysv PARAMS ((char *filename));
128
129 static void
130 print_archive_filename_posix PARAMS ((char *filename));
131
132
133 static void
134 print_archive_member_bsd PARAMS ((char *archive, CONST char *filename));
135
136 static void
137 print_archive_member_sysv PARAMS ((char *archive, CONST char *filename));
138
139 static void
140 print_archive_member_posix PARAMS ((char *archive, CONST char *filename));
141
142
143 static void
144 print_symbol_filename_bsd PARAMS ((bfd * archive_bfd, bfd * abfd));
145
146 static void
147 print_symbol_filename_sysv PARAMS ((bfd * archive_bfd, bfd * abfd));
148
149 static void
150 print_symbol_filename_posix PARAMS ((bfd * archive_bfd, bfd * abfd));
151
152
153 static void
154 print_value PARAMS ((bfd_vma));
155
156 static void
157 print_symbol_info_bsd PARAMS ((symbol_info * info, bfd * abfd));
158
159 static void
160 print_symbol_info_sysv PARAMS ((symbol_info * info, bfd * abfd));
161
162 static void
163 print_symbol_info_posix PARAMS ((symbol_info * info, bfd * abfd));
164
165 static void
166 get_relocs PARAMS ((bfd *, asection *, PTR));
167
168 /* Support for different output formats. */
169 struct output_fns
170 {
171 /* Print the name of an object file given on the command line. */
172 void (*print_object_filename) PARAMS ((char *filename));
173
174 /* Print the name of an archive file given on the command line. */
175 void (*print_archive_filename) PARAMS ((char *filename));
176
177 /* Print the name of an archive member file. */
178 void (*print_archive_member) PARAMS ((char *archive, CONST char *filename));
179
180 /* Print the name of the file (and archive, if there is one)
181 containing a symbol. */
182 void (*print_symbol_filename) PARAMS ((bfd * archive_bfd, bfd * abfd));
183
184 /* Print a line of information about a symbol. */
185 void (*print_symbol_info) PARAMS ((symbol_info * info, bfd * abfd));
186 };
187 static struct output_fns formats[] =
188 {
189 {print_object_filename_bsd,
190 print_archive_filename_bsd,
191 print_archive_member_bsd,
192 print_symbol_filename_bsd,
193 print_symbol_info_bsd},
194 {print_object_filename_sysv,
195 print_archive_filename_sysv,
196 print_archive_member_sysv,
197 print_symbol_filename_sysv,
198 print_symbol_info_sysv},
199 {print_object_filename_posix,
200 print_archive_filename_posix,
201 print_archive_member_posix,
202 print_symbol_filename_posix,
203 print_symbol_info_posix}
204 };
205
206 /* Indices in `formats'. */
207 #define FORMAT_BSD 0
208 #define FORMAT_SYSV 1
209 #define FORMAT_POSIX 2
210 #define FORMAT_DEFAULT FORMAT_BSD
211
212 /* The output format to use. */
213 static struct output_fns *format = &formats[FORMAT_DEFAULT];
214
215
216 /* Command options. */
217
218 static int do_demangle = 0; /* Pretty print C++ symbol names. */
219 static int external_only = 0; /* print external symbols only */
220 static int defined_only = 0; /* Print defined symbols only */
221 static int no_sort = 0; /* don't sort; print syms in order found */
222 static int print_debug_syms = 0; /* print debugger-only symbols too */
223 static int print_armap = 0; /* describe __.SYMDEF data in archive files. */
224 static int reverse_sort = 0; /* sort in downward(alpha or numeric) order */
225 static int sort_numerically = 0; /* sort in numeric rather than alpha order */
226 static int sort_by_size = 0; /* sort by size of symbol */
227 static int undefined_only = 0; /* print undefined symbols only */
228 static int dynamic = 0; /* print dynamic symbols. */
229 static int show_version = 0; /* show the version number */
230 static int show_stats = 0; /* show statistics */
231 static int line_numbers = 0; /* print line numbers for symbols */
232
233 /* When to print the names of files. Not mutually exclusive in SYSV format. */
234 static int filename_per_file = 0; /* Once per file, on its own line. */
235 static int filename_per_symbol = 0; /* Once per symbol, at start of line. */
236
237 /* Print formats for printing a symbol value. */
238 #ifndef BFD64
239 static char value_format[] = "%08lx";
240 #else
241 #if BFD_HOST_64BIT_LONG
242 static char value_format[] = "%016lx";
243 #else
244 /* We don't use value_format for this case. */
245 #endif
246 #endif
247 static int print_radix = 16;
248 /* Print formats for printing stab info. */
249 static char other_format[] = "%02x";
250 static char desc_format[] = "%04x";
251
252 static char *target = NULL;
253
254 /* Used to cache the line numbers for a BFD. */
255 static bfd *lineno_cache_bfd;
256 static bfd *lineno_cache_rel_bfd;
257
258 #define OPTION_TARGET 200
259
260 static struct option long_options[] =
261 {
262 {"debug-syms", no_argument, &print_debug_syms, 1},
263 {"demangle", optional_argument, 0, 'C'},
264 {"dynamic", no_argument, &dynamic, 1},
265 {"extern-only", no_argument, &external_only, 1},
266 {"format", required_argument, 0, 'f'},
267 {"help", no_argument, 0, 'h'},
268 {"line-numbers", no_argument, 0, 'l'},
269 {"no-cplus", no_argument, &do_demangle, 0}, /* Linux compatibility. */
270 {"no-demangle", no_argument, &do_demangle, 0},
271 {"no-sort", no_argument, &no_sort, 1},
272 {"numeric-sort", no_argument, &sort_numerically, 1},
273 {"portability", no_argument, 0, 'P'},
274 {"print-armap", no_argument, &print_armap, 1},
275 {"print-file-name", no_argument, 0, 'o'},
276 {"radix", required_argument, 0, 't'},
277 {"reverse-sort", no_argument, &reverse_sort, 1},
278 {"size-sort", no_argument, &sort_by_size, 1},
279 {"stats", no_argument, &show_stats, 1},
280 {"target", required_argument, 0, OPTION_TARGET},
281 {"defined-only", no_argument, &defined_only, 1},
282 {"undefined-only", no_argument, &undefined_only, 1},
283 {"version", no_argument, &show_version, 1},
284 {0, no_argument, 0, 0}
285 };
286 \f
287 /* Some error-reporting functions */
288
289 static void
290 usage (stream, status)
291 FILE *stream;
292 int status;
293 {
294 fprintf (stream, _("Usage: %s [OPTION]... [FILE]...\n"), program_name);
295 fprintf (stream, _("List symbols from FILEs (a.out by default).\n"));
296 fprintf (stream, _("\n\
297 -a, --debug-syms Display debugger-only symbols\n\
298 -A, --print-file-name Print name of the input file before every symbol\n\
299 -B Same as --format=bsd\n\
300 -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n\
301 The STYLE, if specified, can be `auto' (the default),\n\
302 `gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n\
303 --no-demangle Do not demangle low-level symbol names\n\
304 -D, --dynamic Display dynamic symbols instead of normal symbols\n\
305 --defined-only Display only defined symbols\n\
306 -e (ignored)\n\
307 -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\
308 `sysv' or `posix'. The default is `bsd'\n\
309 -g, --extern-only Display only external symbols\n\
310 -h, --help Display this information\n\
311 -l, --line-numbers Use debugging information to find a filename and\n\
312 line number for each symbol\n\
313 -n, --numeric-sort Sort symbols numerically by address\n\
314 -o Same as -A\n\
315 -p, --no-sort Do not sort the symbols\n\
316 -P, --portability Same as --format=posix\n\
317 -r, --reverse-sort Reverse the sense of the sort\n\
318 -s, --print-armap Include index for symbols from archive members\n\
319 --size-sort Sort symbols by size\n\
320 -t, --radix=RADIX Use RADIX for printing symbol values\n\
321 --target=BFDNAME Specify the target object format as BFDNAME\n\
322 -u, --undefined-only Display only undefined symbols\n\
323 -V, --version Display this program's version number\n\
324 -X 32_64 (ignored)\n\
325 \n"));
326 list_supported_targets (program_name, stream);
327 if (status == 0)
328 fprintf (stream, _("Report bugs to %s.\n"), REPORT_BUGS_TO);
329 exit (status);
330 }
331
332 /* Set the radix for the symbol value and size according to RADIX. */
333
334 static void
335 set_print_radix (radix)
336 char *radix;
337 {
338 switch (*radix)
339 {
340 case 'x':
341 break;
342 case 'd':
343 case 'o':
344 if (*radix == 'd')
345 print_radix = 10;
346 else
347 print_radix = 8;
348 #ifndef BFD64
349 value_format[4] = *radix;
350 #else
351 #if BFD_HOST_64BIT_LONG
352 value_format[5] = *radix;
353 #else
354 /* This case requires special handling for octal and decimal
355 printing. */
356 #endif
357 #endif
358 other_format[3] = desc_format[3] = *radix;
359 break;
360 default:
361 fatal (_("%s: invalid radix"), radix);
362 }
363 }
364
365 static void
366 set_output_format (f)
367 char *f;
368 {
369 int i;
370
371 switch (*f)
372 {
373 case 'b':
374 case 'B':
375 i = FORMAT_BSD;
376 break;
377 case 'p':
378 case 'P':
379 i = FORMAT_POSIX;
380 break;
381 case 's':
382 case 'S':
383 i = FORMAT_SYSV;
384 break;
385 default:
386 fatal (_("%s: invalid output format"), f);
387 }
388 format = &formats[i];
389 }
390 \f
391 int
392 main (argc, argv)
393 int argc;
394 char **argv;
395 {
396 int c;
397 int retval;
398
399 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
400 setlocale (LC_MESSAGES, "");
401 #endif
402 bindtextdomain (PACKAGE, LOCALEDIR);
403 textdomain (PACKAGE);
404
405 program_name = *argv;
406 xmalloc_set_program_name (program_name);
407
408 START_PROGRESS (program_name, 0);
409
410 bfd_init ();
411 set_default_bfd_target ();
412
413 while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvVX:",
414 long_options, (int *) 0)) != EOF)
415 {
416 switch (c)
417 {
418 case 'a':
419 print_debug_syms = 1;
420 break;
421 case 'A':
422 case 'o':
423 filename_per_symbol = 1;
424 break;
425 case 'B': /* For MIPS compatibility. */
426 set_output_format ("bsd");
427 break;
428 case 'C':
429 do_demangle = 1;
430 if (optarg != NULL)
431 {
432 enum demangling_styles style;
433
434 style = cplus_demangle_name_to_style (optarg);
435 if (style == unknown_demangling)
436 fatal (_("unknown demangling style `%s'"),
437 optarg);
438
439 cplus_demangle_set_style (style);
440 }
441 break;
442 case 'D':
443 dynamic = 1;
444 break;
445 case 'e':
446 /* Ignored for HP/UX compatibility. */
447 break;
448 case 'f':
449 set_output_format (optarg);
450 break;
451 case 'g':
452 external_only = 1;
453 break;
454 case 'h':
455 usage (stdout, 0);
456 case 'l':
457 line_numbers = 1;
458 break;
459 case 'n':
460 case 'v':
461 sort_numerically = 1;
462 break;
463 case 'p':
464 no_sort = 1;
465 break;
466 case 'P':
467 set_output_format ("posix");
468 break;
469 case 'r':
470 reverse_sort = 1;
471 break;
472 case 's':
473 print_armap = 1;
474 break;
475 case 't':
476 set_print_radix (optarg);
477 break;
478 case 'u':
479 undefined_only = 1;
480 break;
481 case 'V':
482 show_version = 1;
483 break;
484 case 'X':
485 /* Ignored for (partial) AIX compatibility. On AIX, the
486 argument has values 32, 64, or 32_64, and specfies that
487 only 32-bit, only 64-bit, or both kinds of objects should
488 be examined. The default is 32. So plain AIX nm on a
489 library archive with both kinds of objects will ignore
490 the 64-bit ones. For GNU nm, the default is and always
491 has been -X 32_64, and other options are not supported. */
492 if (strcmp (optarg, "32_64") != 0)
493 fatal (_("Only -X 32_64 is supported"));
494 break;
495
496 case OPTION_TARGET: /* --target */
497 target = optarg;
498 break;
499
500 case 0: /* A long option that just sets a flag. */
501 break;
502
503 default:
504 usage (stderr, 1);
505 }
506 }
507
508 if (show_version)
509 print_version ("nm");
510
511 /* OK, all options now parsed. If no filename specified, do a.out. */
512 if (optind == argc)
513 return !display_file ("a.out");
514
515 retval = 0;
516
517 if (argc - optind > 1)
518 filename_per_file = 1;
519
520 /* We were given several filenames to do. */
521 while (optind < argc)
522 {
523 PROGRESS (1);
524 if (!display_file (argv[optind++]))
525 retval++;
526 }
527
528 END_PROGRESS (program_name);
529
530 #ifdef HAVE_SBRK
531 if (show_stats)
532 {
533 char *lim = (char *) sbrk (0);
534
535 non_fatal (_("data size %ld"), (long) (lim - (char *) &environ));
536 }
537 #endif
538
539 exit (retval);
540 return retval;
541 }
542 \f
543 static void
544 display_archive (file)
545 bfd *file;
546 {
547 bfd *arfile = NULL;
548 bfd *last_arfile = NULL;
549 char **matching;
550
551 (*format->print_archive_filename) (bfd_get_filename (file));
552
553 if (print_armap)
554 print_symdef_entry (file);
555
556 for (;;)
557 {
558 PROGRESS (1);
559
560 arfile = bfd_openr_next_archived_file (file, arfile);
561
562 if (arfile == NULL)
563 {
564 if (bfd_get_error () != bfd_error_no_more_archived_files)
565 bfd_fatal (bfd_get_filename (file));
566 break;
567 }
568
569 if (bfd_check_format_matches (arfile, bfd_object, &matching))
570 {
571 (*format->print_archive_member) (bfd_get_filename (file),
572 bfd_get_filename (arfile));
573 display_rel_file (arfile, file);
574 }
575 else
576 {
577 bfd_nonfatal (bfd_get_filename (arfile));
578 if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
579 {
580 list_matching_formats (matching);
581 free (matching);
582 }
583 }
584
585 if (last_arfile != NULL)
586 {
587 bfd_close (last_arfile);
588 lineno_cache_bfd = NULL;
589 lineno_cache_rel_bfd = NULL;
590 }
591 last_arfile = arfile;
592 }
593
594 if (last_arfile != NULL)
595 {
596 bfd_close (last_arfile);
597 lineno_cache_bfd = NULL;
598 lineno_cache_rel_bfd = NULL;
599 }
600 }
601
602 static boolean
603 display_file (filename)
604 char *filename;
605 {
606 boolean retval = true;
607 bfd *file;
608 char **matching;
609
610 file = bfd_openr (filename, target);
611 if (file == NULL)
612 {
613 bfd_nonfatal (filename);
614 return false;
615 }
616
617 if (bfd_check_format (file, bfd_archive))
618 {
619 display_archive (file);
620 }
621 else if (bfd_check_format_matches (file, bfd_object, &matching))
622 {
623 (*format->print_object_filename) (filename);
624 display_rel_file (file, NULL);
625 }
626 else
627 {
628 bfd_nonfatal (filename);
629 if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
630 {
631 list_matching_formats (matching);
632 free (matching);
633 }
634 retval = false;
635 }
636
637 if (bfd_close (file) == false)
638 bfd_fatal (filename);
639
640 lineno_cache_bfd = NULL;
641 lineno_cache_rel_bfd = NULL;
642
643 return retval;
644 }
645 \f
646 /* These globals are used to pass information into the sorting
647 routines. */
648 static bfd *sort_bfd;
649 static boolean sort_dynamic;
650 static asymbol *sort_x;
651 static asymbol *sort_y;
652
653 /* Symbol-sorting predicates */
654 #define valueof(x) ((x)->section->vma + (x)->value)
655
656 /* Numeric sorts. Undefined symbols are always considered "less than"
657 defined symbols with zero values. Common symbols are not treated
658 specially -- i.e., their sizes are used as their "values". */
659
660 static int
661 numeric_forward (P_x, P_y)
662 const PTR P_x;
663 const PTR P_y;
664 {
665 asymbol *x, *y;
666 asection *xs, *ys;
667
668 x = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_x, sort_x);
669 y = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_y, sort_y);
670 if (x == NULL || y == NULL)
671 bfd_fatal (bfd_get_filename (sort_bfd));
672
673 xs = bfd_get_section (x);
674 ys = bfd_get_section (y);
675
676 if (bfd_is_und_section (xs))
677 {
678 if (! bfd_is_und_section (ys))
679 return -1;
680 }
681 else if (bfd_is_und_section (ys))
682 return 1;
683 else if (valueof (x) != valueof (y))
684 return valueof (x) < valueof (y) ? -1 : 1;
685
686 return non_numeric_forward (P_x, P_y);
687 }
688
689 static int
690 numeric_reverse (x, y)
691 const PTR x;
692 const PTR y;
693 {
694 return - numeric_forward (x, y);
695 }
696
697 static int
698 non_numeric_forward (P_x, P_y)
699 const PTR P_x;
700 const PTR P_y;
701 {
702 asymbol *x, *y;
703 const char *xn, *yn;
704
705 x = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_x, sort_x);
706 y = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_y, sort_y);
707 if (x == NULL || y == NULL)
708 bfd_fatal (bfd_get_filename (sort_bfd));
709
710 xn = bfd_asymbol_name (x);
711 yn = bfd_asymbol_name (y);
712
713 return ((xn == NULL) ? ((yn == NULL) ? 0 : -1) :
714 ((yn == NULL) ? 1 : strcmp (xn, yn)));
715 }
716
717 static int
718 non_numeric_reverse (x, y)
719 const PTR x;
720 const PTR y;
721 {
722 return - non_numeric_forward (x, y);
723 }
724
725 static int (*(sorters[2][2])) PARAMS ((const PTR, const PTR)) =
726 {
727 { non_numeric_forward, non_numeric_reverse },
728 { numeric_forward, numeric_reverse }
729 };
730
731 /* This sort routine is used by sort_symbols_by_size. It is similar
732 to numeric_forward, but when symbols have the same value it sorts
733 by section VMA. This simplifies the sort_symbols_by_size code
734 which handles symbols at the end of sections. Also, this routine
735 tries to sort file names before other symbols with the same value.
736 That will make the file name have a zero size, which will make
737 sort_symbols_by_size choose the non file name symbol, leading to
738 more meaningful output. For similar reasons, this code sorts
739 gnu_compiled_* and gcc2_compiled before other symbols with the same
740 value. */
741
742 static int
743 size_forward1 (P_x, P_y)
744 const PTR P_x;
745 const PTR P_y;
746 {
747 asymbol *x, *y;
748 asection *xs, *ys;
749 const char *xn, *yn;
750 size_t xnl, ynl;
751 int xf, yf;
752
753 x = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_x, sort_x);
754 y = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_y, sort_y);
755 if (x == NULL || y == NULL)
756 bfd_fatal (bfd_get_filename (sort_bfd));
757
758 xs = bfd_get_section (x);
759 ys = bfd_get_section (y);
760
761 if (bfd_is_und_section (xs))
762 abort ();
763 if (bfd_is_und_section (ys))
764 abort ();
765
766 if (valueof (x) != valueof (y))
767 return valueof (x) < valueof (y) ? -1 : 1;
768
769 if (xs->vma != ys->vma)
770 return xs->vma < ys->vma ? -1 : 1;
771
772 xn = bfd_asymbol_name (x);
773 yn = bfd_asymbol_name (y);
774 xnl = strlen (xn);
775 ynl = strlen (yn);
776
777 /* The symbols gnu_compiled and gcc2_compiled convey even less
778 information than the file name, so sort them out first. */
779
780 xf = (strstr (xn, "gnu_compiled") != NULL
781 || strstr (xn, "gcc2_compiled") != NULL);
782 yf = (strstr (yn, "gnu_compiled") != NULL
783 || strstr (yn, "gcc2_compiled") != NULL);
784
785 if (xf && ! yf)
786 return -1;
787 if (! xf && yf)
788 return 1;
789
790 /* We use a heuristic for the file name. It may not work on non
791 Unix systems, but it doesn't really matter; the only difference
792 is precisely which symbol names get printed. */
793
794 #define file_symbol(s, sn, snl) \
795 (((s)->flags & BSF_FILE) != 0 \
796 || ((sn)[(snl) - 2] == '.' \
797 && ((sn)[(snl) - 1] == 'o' \
798 || (sn)[(snl) - 1] == 'a')))
799
800 xf = file_symbol (x, xn, xnl);
801 yf = file_symbol (y, yn, ynl);
802
803 if (xf && ! yf)
804 return -1;
805 if (! xf && yf)
806 return 1;
807
808 return non_numeric_forward (P_x, P_y);
809 }
810
811 /* This sort routine is used by sort_symbols_by_size. It is sorting
812 an array of size_sym structures into size order. */
813
814 static int
815 size_forward2 (P_x, P_y)
816 const PTR P_x;
817 const PTR P_y;
818 {
819 const struct size_sym *x = (const struct size_sym *) P_x;
820 const struct size_sym *y = (const struct size_sym *) P_y;
821
822 if (x->size < y->size)
823 return reverse_sort ? 1 : -1;
824 else if (x->size > y->size)
825 return reverse_sort ? -1 : 1;
826 else
827 return sorters[0][reverse_sort] (x->minisym, y->minisym);
828 }
829
830 /* Sort the symbols by size. We guess the size by assuming that the
831 difference between the address of a symbol and the address of the
832 next higher symbol is the size. FIXME: ELF actually stores a size
833 with each symbol. We should use it. */
834
835 static long
836 sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
837 bfd *abfd;
838 boolean dynamic;
839 PTR minisyms;
840 long symcount;
841 unsigned int size;
842 struct size_sym **symsizesp;
843 {
844 struct size_sym *symsizes;
845 bfd_byte *from, *fromend;
846 asymbol *sym = NULL;
847 asymbol *store_sym, *store_next;
848
849 qsort (minisyms, symcount, size, size_forward1);
850
851 /* We are going to return a special set of symbols and sizes to
852 print. */
853 symsizes = (struct size_sym *) xmalloc (symcount * sizeof (struct size_sym));
854 *symsizesp = symsizes;
855
856 /* Note that filter_symbols has already removed all absolute and
857 undefined symbols. Here we remove all symbols whose size winds
858 up as zero. */
859
860 from = (bfd_byte *) minisyms;
861 fromend = from + symcount * size;
862
863 store_sym = sort_x;
864 store_next = sort_y;
865
866 if (from < fromend)
867 {
868 sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const PTR) from,
869 store_sym);
870 if (sym == NULL)
871 bfd_fatal (bfd_get_filename (abfd));
872 }
873
874 for (; from < fromend; from += size)
875 {
876 asymbol *next;
877 asection *sec;
878 bfd_vma sz;
879 asymbol *temp;
880
881 if (from + size < fromend)
882 {
883 next = bfd_minisymbol_to_symbol (abfd,
884 dynamic,
885 (const PTR) (from + size),
886 store_next);
887 if (next == NULL)
888 bfd_fatal (bfd_get_filename (abfd));
889 }
890 else
891 next = NULL;
892
893 sec = bfd_get_section (sym);
894
895 if (bfd_is_com_section (sec))
896 sz = sym->value;
897 else
898 {
899 if (from + size < fromend
900 && sec == bfd_get_section (next))
901 sz = valueof (next) - valueof (sym);
902 else
903 sz = (bfd_get_section_vma (abfd, sec)
904 + bfd_section_size (abfd, sec)
905 - valueof (sym));
906 }
907
908 if (sz != 0)
909 {
910 symsizes->minisym = (const PTR) from;
911 symsizes->size = sz;
912 ++symsizes;
913 }
914
915 sym = next;
916
917 temp = store_sym;
918 store_sym = store_next;
919 store_next = temp;
920 }
921
922 symcount = symsizes - *symsizesp;
923
924 /* We must now sort again by size. */
925 qsort ((PTR) *symsizesp, symcount, sizeof (struct size_sym), size_forward2);
926
927 return symcount;
928 }
929 \f
930 /* If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. */
931
932 static void
933 display_rel_file (abfd, archive_bfd)
934 bfd *abfd;
935 bfd *archive_bfd;
936 {
937 long symcount;
938 PTR minisyms;
939 unsigned int size;
940 struct size_sym *symsizes;
941
942 if (! dynamic)
943 {
944 if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
945 {
946 non_fatal (_("%s: no symbols"), bfd_get_filename (abfd));
947 return;
948 }
949 }
950
951 symcount = bfd_read_minisymbols (abfd, dynamic, &minisyms, &size);
952 if (symcount < 0)
953 bfd_fatal (bfd_get_filename (abfd));
954
955 if (symcount == 0)
956 {
957 non_fatal (_("%s: no symbols"), bfd_get_filename (abfd));
958 return;
959 }
960
961 /* Discard the symbols we don't want to print.
962 It's OK to do this in place; we'll free the storage anyway
963 (after printing). */
964
965 symcount = filter_symbols (abfd, dynamic, minisyms, symcount, size);
966
967 symsizes = NULL;
968 if (! no_sort)
969 {
970 sort_bfd = abfd;
971 sort_dynamic = dynamic;
972 sort_x = bfd_make_empty_symbol (abfd);
973 sort_y = bfd_make_empty_symbol (abfd);
974 if (sort_x == NULL || sort_y == NULL)
975 bfd_fatal (bfd_get_filename (abfd));
976
977 if (! sort_by_size)
978 qsort (minisyms, symcount, size,
979 sorters[sort_numerically][reverse_sort]);
980 else
981 symcount = sort_symbols_by_size (abfd, dynamic, minisyms, symcount,
982 size, &symsizes);
983 }
984
985 if (! sort_by_size)
986 print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd);
987 else
988 print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd);
989
990 free (minisyms);
991 }
992 \f
993 /* Choose which symbol entries to print;
994 compact them downward to get rid of the rest.
995 Return the number of symbols to be printed. */
996
997 static long
998 filter_symbols (abfd, dynamic, minisyms, symcount, size)
999 bfd *abfd;
1000 boolean dynamic;
1001 PTR minisyms;
1002 long symcount;
1003 unsigned int size;
1004 {
1005 bfd_byte *from, *fromend, *to;
1006 asymbol *store;
1007
1008 store = bfd_make_empty_symbol (abfd);
1009 if (store == NULL)
1010 bfd_fatal (bfd_get_filename (abfd));
1011
1012 from = (bfd_byte *) minisyms;
1013 fromend = from + symcount * size;
1014 to = (bfd_byte *) minisyms;
1015
1016 for (; from < fromend; from += size)
1017 {
1018 int keep = 0;
1019 asymbol *sym;
1020
1021 PROGRESS (1);
1022
1023 sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const PTR) from, store);
1024 if (sym == NULL)
1025 bfd_fatal (bfd_get_filename (abfd));
1026
1027 if (undefined_only)
1028 keep = bfd_is_und_section (sym->section);
1029 else if (external_only)
1030 keep = ((sym->flags & BSF_GLOBAL) != 0
1031 || (sym->flags & BSF_WEAK) != 0
1032 || bfd_is_und_section (sym->section)
1033 || bfd_is_com_section (sym->section));
1034 else
1035 keep = 1;
1036
1037 if (keep
1038 && ! print_debug_syms
1039 && (sym->flags & BSF_DEBUGGING) != 0)
1040 keep = 0;
1041
1042 if (keep
1043 && sort_by_size
1044 && (bfd_is_abs_section (sym->section)
1045 || bfd_is_und_section (sym->section)))
1046 keep = 0;
1047
1048 if (keep
1049 && defined_only)
1050 {
1051 if (bfd_is_und_section (sym->section))
1052 keep = 0;
1053 }
1054
1055 if (keep)
1056 {
1057 memcpy (to, from, size);
1058 to += size;
1059 }
1060 }
1061
1062 return (to - (bfd_byte *) minisyms) / size;
1063 }
1064 \f
1065 /* Print symbol name NAME, read from ABFD, with printf format FORMAT,
1066 demangling it if requested. */
1067
1068 static void
1069 print_symname (format, name, abfd)
1070 const char *format;
1071 const char *name;
1072 bfd *abfd;
1073 {
1074 if (do_demangle && *name)
1075 {
1076 char *res;
1077
1078 /* In this mode, give a user-level view of the symbol name
1079 even if it's not mangled; strip off any leading
1080 underscore. */
1081 if (bfd_get_symbol_leading_char (abfd) == name[0])
1082 name++;
1083
1084 res = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
1085 if (res)
1086 {
1087 printf (format, res);
1088 free (res);
1089 return;
1090 }
1091 }
1092
1093 printf (format, name);
1094 }
1095
1096 /* Print the symbols. If ARCHIVE_BFD is non-NULL, it is the archive
1097 containing ABFD. */
1098
1099 static void
1100 print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd)
1101 bfd *abfd;
1102 boolean dynamic;
1103 PTR minisyms;
1104 long symcount;
1105 unsigned int size;
1106 bfd *archive_bfd;
1107 {
1108 asymbol *store;
1109 bfd_byte *from, *fromend;
1110
1111 store = bfd_make_empty_symbol (abfd);
1112 if (store == NULL)
1113 bfd_fatal (bfd_get_filename (abfd));
1114
1115 from = (bfd_byte *) minisyms;
1116 fromend = from + symcount * size;
1117 for (; from < fromend; from += size)
1118 {
1119 asymbol *sym;
1120
1121 sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store);
1122 if (sym == NULL)
1123 bfd_fatal (bfd_get_filename (abfd));
1124
1125 print_symbol (abfd, sym, archive_bfd);
1126 }
1127 }
1128
1129 /* Print the symbols when sorting by size. */
1130
1131 static void
1132 print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd)
1133 bfd *abfd;
1134 boolean dynamic;
1135 struct size_sym *symsizes;
1136 long symcount;
1137 bfd *archive_bfd;
1138 {
1139 asymbol *store;
1140 struct size_sym *from, *fromend;
1141
1142 store = bfd_make_empty_symbol (abfd);
1143 if (store == NULL)
1144 bfd_fatal (bfd_get_filename (abfd));
1145
1146 from = symsizes;
1147 fromend = from + symcount;
1148 for (; from < fromend; from++)
1149 {
1150 asymbol *sym;
1151
1152 sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store);
1153 if (sym == NULL)
1154 bfd_fatal (bfd_get_filename (abfd));
1155
1156 /* Set the symbol value so that we actually display the symbol
1157 size. */
1158 sym->value = from->size - bfd_section_vma (abfd, bfd_get_section (sym));
1159
1160 print_symbol (abfd, sym, archive_bfd);
1161 }
1162 }
1163
1164 /* Print a single symbol. */
1165
1166 static void
1167 print_symbol (abfd, sym, archive_bfd)
1168 bfd *abfd;
1169 asymbol *sym;
1170 bfd *archive_bfd;
1171 {
1172 PROGRESS (1);
1173
1174 (*format->print_symbol_filename) (archive_bfd, abfd);
1175
1176 if (undefined_only)
1177 {
1178 if (bfd_is_und_section (bfd_get_section (sym)))
1179 print_symname ("%s", bfd_asymbol_name (sym), abfd);
1180 }
1181 else
1182 {
1183 symbol_info syminfo;
1184
1185 bfd_get_symbol_info (abfd, sym, &syminfo);
1186 (*format->print_symbol_info) (&syminfo, abfd);
1187 }
1188
1189 if (line_numbers)
1190 {
1191 static asymbol **syms;
1192 static long symcount;
1193 const char *filename, *functionname;
1194 unsigned int lineno;
1195
1196 /* We need to get the canonical symbols in order to call
1197 bfd_find_nearest_line. This is inefficient, but, then, you
1198 don't have to use --line-numbers. */
1199 if (abfd != lineno_cache_bfd && syms != NULL)
1200 {
1201 free (syms);
1202 syms = NULL;
1203 }
1204 if (syms == NULL)
1205 {
1206 long symsize;
1207
1208 symsize = bfd_get_symtab_upper_bound (abfd);
1209 if (symsize < 0)
1210 bfd_fatal (bfd_get_filename (abfd));
1211 syms = (asymbol **) xmalloc (symsize);
1212 symcount = bfd_canonicalize_symtab (abfd, syms);
1213 if (symcount < 0)
1214 bfd_fatal (bfd_get_filename (abfd));
1215 lineno_cache_bfd = abfd;
1216 }
1217
1218 if (bfd_is_und_section (bfd_get_section (sym)))
1219 {
1220 static asection **secs;
1221 static arelent ***relocs;
1222 static long *relcount;
1223 static unsigned int seccount;
1224 unsigned int i;
1225 const char *symname;
1226
1227 /* For an undefined symbol, we try to find a reloc for the
1228 symbol, and print the line number of the reloc. */
1229
1230 if (abfd != lineno_cache_rel_bfd && relocs != NULL)
1231 {
1232 for (i = 0; i < seccount; i++)
1233 if (relocs[i] != NULL)
1234 free (relocs[i]);
1235 free (secs);
1236 free (relocs);
1237 free (relcount);
1238 secs = NULL;
1239 relocs = NULL;
1240 relcount = NULL;
1241 }
1242
1243 if (relocs == NULL)
1244 {
1245 struct get_relocs_info info;
1246
1247 seccount = bfd_count_sections (abfd);
1248
1249 secs = (asection **) xmalloc (seccount * sizeof *secs);
1250 relocs = (arelent ***) xmalloc (seccount * sizeof *relocs);
1251 relcount = (long *) xmalloc (seccount * sizeof *relcount);
1252
1253 info.secs = secs;
1254 info.relocs = relocs;
1255 info.relcount = relcount;
1256 info.syms = syms;
1257 bfd_map_over_sections (abfd, get_relocs, (PTR) &info);
1258 lineno_cache_rel_bfd = abfd;
1259 }
1260
1261 symname = bfd_asymbol_name (sym);
1262 for (i = 0; i < seccount; i++)
1263 {
1264 long j;
1265
1266 for (j = 0; j < relcount[i]; j++)
1267 {
1268 arelent *r;
1269
1270 r = relocs[i][j];
1271 if (r->sym_ptr_ptr != NULL
1272 && (*r->sym_ptr_ptr)->section == sym->section
1273 && (*r->sym_ptr_ptr)->value == sym->value
1274 && strcmp (symname,
1275 bfd_asymbol_name (*r->sym_ptr_ptr)) == 0
1276 && bfd_find_nearest_line (abfd, secs[i], syms,
1277 r->address, &filename,
1278 &functionname, &lineno))
1279 {
1280 /* We only print the first one we find. */
1281 printf ("\t%s:%u", filename, lineno);
1282 i = seccount;
1283 break;
1284 }
1285 }
1286 }
1287 }
1288 else if (bfd_get_section (sym)->owner == abfd)
1289 {
1290 if (bfd_find_nearest_line (abfd, bfd_get_section (sym), syms,
1291 sym->value, &filename, &functionname,
1292 &lineno)
1293 && filename != NULL
1294 && lineno != 0)
1295 {
1296 printf ("\t%s:%u", filename, lineno);
1297 }
1298 }
1299 }
1300
1301 putchar ('\n');
1302 }
1303 \f
1304 /* The following 3 groups of functions are called unconditionally,
1305 once at the start of processing each file of the appropriate type.
1306 They should check `filename_per_file' and `filename_per_symbol',
1307 as appropriate for their output format, to determine whether to
1308 print anything. */
1309 \f
1310 /* Print the name of an object file given on the command line. */
1311
1312 static void
1313 print_object_filename_bsd (filename)
1314 char *filename;
1315 {
1316 if (filename_per_file && !filename_per_symbol)
1317 printf ("\n%s:\n", filename);
1318 }
1319
1320 static void
1321 print_object_filename_sysv (filename)
1322 char *filename;
1323 {
1324 if (undefined_only)
1325 printf (_("\n\nUndefined symbols from %s:\n\n"), filename);
1326 else
1327 printf (_("\n\nSymbols from %s:\n\n"), filename);
1328 printf (_("\
1329 Name Value Class Type Size Line Section\n\n"));
1330 }
1331
1332 static void
1333 print_object_filename_posix (filename)
1334 char *filename;
1335 {
1336 if (filename_per_file && !filename_per_symbol)
1337 printf ("%s:\n", filename);
1338 }
1339 \f
1340 /* Print the name of an archive file given on the command line. */
1341
1342 static void
1343 print_archive_filename_bsd (filename)
1344 char *filename;
1345 {
1346 if (filename_per_file)
1347 printf ("\n%s:\n", filename);
1348 }
1349
1350 static void
1351 print_archive_filename_sysv (filename)
1352 char *filename ATTRIBUTE_UNUSED;
1353 {
1354 }
1355
1356 static void
1357 print_archive_filename_posix (filename)
1358 char *filename ATTRIBUTE_UNUSED;
1359 {
1360 }
1361 \f
1362 /* Print the name of an archive member file. */
1363
1364 static void
1365 print_archive_member_bsd (archive, filename)
1366 char *archive ATTRIBUTE_UNUSED;
1367 CONST char *filename;
1368 {
1369 if (!filename_per_symbol)
1370 printf ("\n%s:\n", filename);
1371 }
1372
1373 static void
1374 print_archive_member_sysv (archive, filename)
1375 char *archive;
1376 CONST char *filename;
1377 {
1378 if (undefined_only)
1379 printf (_("\n\nUndefined symbols from %s[%s]:\n\n"), archive, filename);
1380 else
1381 printf (_("\n\nSymbols from %s[%s]:\n\n"), archive, filename);
1382 printf (_("\
1383 Name Value Class Type Size Line Section\n\n"));
1384 }
1385
1386 static void
1387 print_archive_member_posix (archive, filename)
1388 char *archive;
1389 CONST char *filename;
1390 {
1391 if (!filename_per_symbol)
1392 printf ("%s[%s]:\n", archive, filename);
1393 }
1394 \f
1395 /* Print the name of the file (and archive, if there is one)
1396 containing a symbol. */
1397
1398 static void
1399 print_symbol_filename_bsd (archive_bfd, abfd)
1400 bfd *archive_bfd, *abfd;
1401 {
1402 if (filename_per_symbol)
1403 {
1404 if (archive_bfd)
1405 printf ("%s:", bfd_get_filename (archive_bfd));
1406 printf ("%s:", bfd_get_filename (abfd));
1407 }
1408 }
1409
1410 static void
1411 print_symbol_filename_sysv (archive_bfd, abfd)
1412 bfd *archive_bfd, *abfd;
1413 {
1414 if (filename_per_symbol)
1415 {
1416 if (archive_bfd)
1417 printf ("%s:", bfd_get_filename (archive_bfd));
1418 printf ("%s:", bfd_get_filename (abfd));
1419 }
1420 }
1421
1422 static void
1423 print_symbol_filename_posix (archive_bfd, abfd)
1424 bfd *archive_bfd, *abfd;
1425 {
1426 if (filename_per_symbol)
1427 {
1428 if (archive_bfd)
1429 printf ("%s[%s]: ", bfd_get_filename (archive_bfd),
1430 bfd_get_filename (abfd));
1431 else
1432 printf ("%s: ", bfd_get_filename (abfd));
1433 }
1434 }
1435 \f
1436 /* Print a symbol value. */
1437
1438 static void
1439 print_value (val)
1440 bfd_vma val;
1441 {
1442 #if ! defined (BFD64) || BFD_HOST_64BIT_LONG
1443 printf (value_format, val);
1444 #else
1445 /* We have a 64 bit value to print, but the host is only 32 bit. */
1446 if (print_radix == 16)
1447 fprintf_vma (stdout, val);
1448 else
1449 {
1450 char buf[30];
1451 char *s;
1452
1453 s = buf + sizeof buf;
1454 *--s = '\0';
1455 while (val > 0)
1456 {
1457 *--s = (val % print_radix) + '0';
1458 val /= print_radix;
1459 }
1460 while ((buf + sizeof buf - 1) - s < 16)
1461 *--s = '0';
1462 printf ("%s", s);
1463 }
1464 #endif
1465 }
1466
1467 /* Print a line of information about a symbol. */
1468
1469 static void
1470 print_symbol_info_bsd (info, abfd)
1471 symbol_info *info;
1472 bfd *abfd;
1473 {
1474 if (bfd_is_undefined_symclass (info->type))
1475 {
1476 #ifdef BFD64
1477 printf ("%*s", 16, "");
1478 #else
1479 printf ("%*s", 8, "");
1480 #endif
1481 }
1482 else
1483 print_value (info->value);
1484 printf (" %c", info->type);
1485 if (info->type == '-')
1486 {
1487 /* A stab. */
1488 printf (" ");
1489 printf (other_format, info->stab_other);
1490 printf (" ");
1491 printf (desc_format, info->stab_desc);
1492 printf (" %5s", info->stab_name);
1493 }
1494 print_symname (" %s", info->name, abfd);
1495 }
1496
1497 static void
1498 print_symbol_info_sysv (info, abfd)
1499 symbol_info *info;
1500 bfd *abfd;
1501 {
1502 print_symname ("%-20s|", info->name, abfd); /* Name */
1503 if (bfd_is_undefined_symclass (info->type))
1504 printf (" "); /* Value */
1505 else
1506 print_value (info->value);
1507 printf ("| %c |", info->type); /* Class */
1508 if (info->type == '-')
1509 {
1510 /* A stab. */
1511 printf ("%18s| ", info->stab_name); /* (C) Type */
1512 printf (desc_format, info->stab_desc); /* Size */
1513 printf ("| |"); /* Line, Section */
1514 }
1515 else
1516 printf (" | | |"); /* Type, Size, Line, Section */
1517 }
1518
1519 static void
1520 print_symbol_info_posix (info, abfd)
1521 symbol_info *info;
1522 bfd *abfd;
1523 {
1524 print_symname ("%s ", info->name, abfd);
1525 printf ("%c ", info->type);
1526 if (bfd_is_undefined_symclass (info->type))
1527 printf (" ");
1528 else
1529 print_value (info->value);
1530 /* POSIX.2 wants the symbol size printed here, when applicable;
1531 BFD currently doesn't provide it, so we take the easy way out by
1532 considering it to never be applicable. */
1533 }
1534 \f
1535 static void
1536 print_symdef_entry (abfd)
1537 bfd *abfd;
1538 {
1539 symindex idx = BFD_NO_MORE_SYMBOLS;
1540 carsym *thesym;
1541 boolean everprinted = false;
1542
1543 for (idx = bfd_get_next_mapent (abfd, idx, &thesym);
1544 idx != BFD_NO_MORE_SYMBOLS;
1545 idx = bfd_get_next_mapent (abfd, idx, &thesym))
1546 {
1547 bfd *elt;
1548 if (!everprinted)
1549 {
1550 printf (_("\nArchive index:\n"));
1551 everprinted = true;
1552 }
1553 elt = bfd_get_elt_at_index (abfd, idx);
1554 if (elt == NULL)
1555 bfd_fatal ("bfd_get_elt_at_index");
1556 if (thesym->name != (char *) NULL)
1557 {
1558 print_symname ("%s", thesym->name, abfd);
1559 printf (" in %s\n", bfd_get_filename (elt));
1560 }
1561 }
1562 }
1563 \f
1564 /* This function is used to get the relocs for a particular section.
1565 It is called via bfd_map_over_sections. */
1566
1567 static void
1568 get_relocs (abfd, sec, dataarg)
1569 bfd *abfd;
1570 asection *sec;
1571 PTR dataarg;
1572 {
1573 struct get_relocs_info *data = (struct get_relocs_info *) dataarg;
1574
1575 *data->secs = sec;
1576
1577 if ((sec->flags & SEC_RELOC) == 0)
1578 {
1579 *data->relocs = NULL;
1580 *data->relcount = 0;
1581 }
1582 else
1583 {
1584 long relsize;
1585
1586 relsize = bfd_get_reloc_upper_bound (abfd, sec);
1587 if (relsize < 0)
1588 bfd_fatal (bfd_get_filename (abfd));
1589
1590 *data->relocs = (arelent **) xmalloc (relsize);
1591 *data->relcount = bfd_canonicalize_reloc (abfd, sec, *data->relocs,
1592 data->syms);
1593 if (*data->relcount < 0)
1594 bfd_fatal (bfd_get_filename (abfd));
1595 }
1596
1597 ++data->secs;
1598 ++data->relocs;
1599 ++data->relcount;
1600 }
This page took 0.086801 seconds and 5 git commands to generate.