{
Elf_Internal_Sym sym;
unsigned long dest_index;
- unsigned long destshndx_index;
};
struct bfd_link_needed_list
section. */
struct elf_strtab_hash *dynstr;
- /* The number of symbol strings found in the link which must be put
- into the .strtab section. */
- bfd_size_type strtabcount;
-
/* The array size of the symbol string table, which becomes the
.strtab section. */
bfd_size_type strtabsize;
bfd_byte *outbound_syms;
bfd_byte *outbound_shndx;
unsigned long outbound_syms_index;
- unsigned long outbound_shndx_index;
unsigned int idx;
unsigned int num_locals;
size_t amt;
outbound_syms_index = 0;
outbound_shndx = NULL;
- outbound_shndx_index = 0;
if (elf_symtab_shndx_list (abfd))
{
sym.st_target_internal = 0;
symstrtab[0].sym = sym;
symstrtab[0].dest_index = outbound_syms_index;
- symstrtab[0].destshndx_index = outbound_shndx_index;
outbound_syms_index++;
- if (outbound_shndx != NULL)
- outbound_shndx_index++;
}
name_local_sections
idx++;
symstrtab[idx].sym = sym;
symstrtab[idx].dest_index = outbound_syms_index;
- symstrtab[idx].destshndx_index = outbound_shndx_index;
outbound_syms_index++;
- if (outbound_shndx != NULL)
- outbound_shndx_index++;
}
/* Finalize the .strtab section. */
(outbound_syms
+ (elfsym->dest_index
* bed->s->sizeof_sym)),
- (outbound_shndx
- + (elfsym->destshndx_index
- * sizeof (Elf_External_Sym_Shndx))));
+ NPTR_ADD (outbound_shndx,
+ (elfsym->dest_index
+ * sizeof (Elf_External_Sym_Shndx))));
}
free (symstrtab);
hash_table = elf_hash_table (flinfo->info);
strtabsize = hash_table->strtabsize;
- if (strtabsize <= hash_table->strtabcount)
+ if (strtabsize <= flinfo->output_bfd->symcount)
{
strtabsize += strtabsize;
hash_table->strtabsize = strtabsize;
if (hash_table->strtab == NULL)
return 0;
}
- hash_table->strtab[hash_table->strtabcount].sym = *elfsym;
- hash_table->strtab[hash_table->strtabcount].dest_index
- = hash_table->strtabcount;
- hash_table->strtab[hash_table->strtabcount].destshndx_index
- = flinfo->symshndxbuf ? bfd_get_symcount (flinfo->output_bfd) : 0;
-
+ hash_table->strtab[flinfo->output_bfd->symcount].sym = *elfsym;
+ hash_table->strtab[flinfo->output_bfd->symcount].dest_index
+ = flinfo->output_bfd->symcount;
flinfo->output_bfd->symcount += 1;
- hash_table->strtabcount += 1;
return 1;
}
file_ptr pos;
bool ret;
- if (!hash_table->strtabcount)
+ if (flinfo->output_bfd->symcount == 0)
return true;
BFD_ASSERT (elf_onesymtab (flinfo->output_bfd));
bed = get_elf_backend_data (flinfo->output_bfd);
- amt = bed->s->sizeof_sym * hash_table->strtabcount;
+ amt = bed->s->sizeof_sym * flinfo->output_bfd->symcount;
symbuf = (bfd_byte *) bfd_malloc (amt);
if (symbuf == NULL)
return false;
}
/* Now swap out the symbols. */
- for (i = 0; i < hash_table->strtabcount; i++)
+ for (i = 0; i < flinfo->output_bfd->symcount; i++)
{
struct elf_sym_strtab *elfsym = &hash_table->strtab[i];
if (elfsym->sym.st_name == (unsigned long) -1)
((bfd_byte *) symbuf
+ (elfsym->dest_index
* bed->s->sizeof_sym)),
- (flinfo->symshndxbuf
- + elfsym->destshndx_index));
+ NPTR_ADD (flinfo->symshndxbuf,
+ elfsym->dest_index));
}
hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr;
pos = hdr->sh_offset + hdr->sh_size;
- amt = hash_table->strtabcount * bed->s->sizeof_sym;
+ amt = bed->s->sizeof_sym * flinfo->output_bfd->symcount;
if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0
&& bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt)
{