From 2ab0b7f3e3b513899b5f0c0ff9d396b261310bc8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 22 Feb 1994 00:01:34 +0000 Subject: [PATCH] * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca rather than an array of variable size. (som_bfd_fill_in_ar_symbols): Likewise. (som_bfd_ar_write_symbol_stuff): Likewise. --- bfd/ChangeLog | 5 +++++ bfd/som.c | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e50f1ae1268..96af5c50755 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,11 @@ Mon Feb 21 10:12:02 1994 Stan Shebs (shebs@andros.cygnus.com) Mon Feb 21 09:50:06 1994 Ian Lance Taylor (ian@lisa.cygnus.com) + * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca + rather than an array of variable size. + (som_bfd_fill_in_ar_symbols): Likewise. + (som_bfd_ar_write_symbol_stuff): Likewise. + * coff-alpha.c (alpha_relocate_section): Rewrite mask and shift operation to avoid OSF 1.3 cc bug. * ecoff.c (ecoff_write_object_contents): Make text_size, data_size diff --git a/bfd/som.c b/bfd/som.c index e82143a079d..baae80f0145 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -4250,7 +4250,8 @@ som_bfd_count_ar_symbols (abfd, lst_header, count) symindex *count; { unsigned int i; - unsigned int hash_table[lst_header->hash_size]; + unsigned int *hash_table = + (unsigned int *) alloca (lst_header->hash_size * sizeof (unsigned int)); file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); /* Don't forget to initialize the counter! */ @@ -4327,8 +4328,11 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms) { unsigned int i, len; carsym *set = syms[0]; - unsigned int hash_table[lst_header->hash_size]; - struct som_entry som_dict[lst_header->module_count]; + unsigned int *hash_table = + (unsigned int *) alloca (lst_header->hash_size * sizeof (unsigned int)); + struct som_entry *som_dict = + (struct som_entry *) alloca (lst_header->module_count + * sizeof (struct som_entry)); file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); /* Read in the hash table. The has table is an array of 32bit file offsets @@ -4685,9 +4689,14 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst) char *strings, *p; struct lst_symbol_record *lst_syms, *curr_lst_sym; bfd *curr_bfd = abfd->archive_head; - unsigned int hash_table[lst.hash_size]; - struct som_entry som_dict[lst.module_count]; - struct lst_symbol_record *last_hash_entry[lst.hash_size]; + unsigned int *hash_table = + (unsigned int *) alloca (lst.hash_size * sizeof (unsigned int)); + struct som_entry *som_dict = + (struct som_entry *) alloca (lst.module_count + * sizeof (struct som_entry)); + struct lst_symbol_record **last_hash_entry = + ((struct lst_symbol_record **) + alloca (lst.hash_size * sizeof (struct lst_symbol_record *))); unsigned int curr_som_offset, som_index; /* Lots of fields are file positions relative to the start -- 2.30.2