- if ((bfd_check_format (current, bfd_object) == true)
- && ((bfd_get_file_flags (current) & HAS_SYMS))) {
- asymbol **syms;
- unsigned int storage;
- unsigned int symcount;
- unsigned int src_count;
-
- storage = get_symtab_upper_bound (current);
- if (storage == 0) {
- nosymz:
- fprintf (stderr, "%s: Symflags set but there are none?\n",
- bfd_get_filename (current));
- exit (1);
- }
- syms = (asymbol **) zalloc (storage);
- if (syms == NULL) {
- bfd_error = no_memory; /* FIXME -- memory leak */
- return false;
- }
- symcount = bfd_canonicalize_symtab (current, syms);
- if (symcount == 0) goto nosymz;
-
- /* Now map over all the symbols, picking out the ones we want */
- for (src_count = 0; src_count <symcount; src_count++) {
- flagword flags = (syms[src_count])->flags;
- if ((flags & BSF_GLOBAL) ||
- (flags & BSF_FORT_COMM)) {
-
- /* This symbol will go into the archive header */
- if (orl_count == orl_max)
- {
- orl_max *= 2;
- map = (struct orl *) realloc ((char *) map,
- orl_max * sizeof (struct orl));
+ if ((bfd_check_format (current, bfd_object) == true)
+ && ((bfd_get_file_flags (current) & HAS_SYMS))) {
+ asymbol **syms;
+ unsigned int storage;
+ unsigned int symcount;
+ unsigned int src_count;
+
+ storage = get_symtab_upper_bound (current);
+ if (storage != 0) {
+
+ syms = (asymbol **) zalloc (storage);
+ if (syms == NULL) {
+ bfd_error = no_memory; /* FIXME -- memory leak */
+ return false;
+ }
+ symcount = bfd_canonicalize_symtab (current, syms);
+
+
+ /* Now map over all the symbols, picking out the ones we want */
+ for (src_count = 0; src_count <symcount; src_count++) {
+ flagword flags = (syms[src_count])->flags;
+ if ((flags & BSF_GLOBAL) ||
+ (flags & BSF_FORT_COMM)) {
+
+ /* This symbol will go into the archive header */
+ if (orl_count == orl_max)
+ {
+ orl_max *= 2;
+ map = (struct orl *) realloc ((char *) map,
+ orl_max * sizeof (struct orl));
+ }
+
+ (map[orl_count]).name = &((syms[src_count])->name);
+ (map[orl_count]).pos = elt_no;
+ (map[orl_count]).namidx = stridx;
+
+ stridx += strlen ((syms[src_count])->name) + 1;
+ ++orl_count;
+ }
+ }