Changeset 1998 for trunk/src


Ignore:
Timestamp:
Jun 5, 2005, 6:17:00 PM (21 years ago)
Author:
bird
Message:

Avoid alloc() since we might easily run out of stack for string tables and such like.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/ld/ld.c

    • Property cvs2svn:cvs-rev changed from 1.16 to 1.17
    r1997 r1998  
    6363
    6464/* If compiled with GNU C, use the built-in alloca */
    65 #ifdef __GNUC__
    66 # define alloca __builtin_alloca
    67 #else
    68 # include "alloca.h"
    69 #endif
    70 
     65#include "alloca.h"
    7166#include "getopt.h"
    7267
     
    19571952    {
    19581953      read_entry_symbols (desc, entry);
    1959       entry->strings = (char *) alloca (entry->strs_size);
     1954      entry->strings = (char *) (entry->strs_size);
    19601955      read_entry_strings (desc, entry);
    19611956      enter_file_symbols (entry);
    1962       entry->strings = 0;
     1957      free (entry->strings);
     1958      entry->strings = NULL;
    19631959    }
    19641960
     
    25332529{
    25342530  read_entry_symbols (desc, subentry);
    2535   subentry->strings = (char *) alloca (subentry->strs_size);
     2531  subentry->strings = (char *) (subentry->strs_size);
    25362532  read_entry_strings (desc, subentry);
    25372533
     
    25502546        entry->subfiles = subentry;
    25512547      *prev_addr = subentry;
    2552       subentry->strings = 0; /* Since space will dissapear on return */
    2553     }
     2548    }
     2549  free (subentry->strings);
     2550  subentry->strings = NULL;
    25542551}
    25552552
     
    30623059    *end = entry->symbols + entry->syms_size / sizeof (struct nlist);
    30633060
    3064   entry->strings = (char *) alloca (entry->strs_size);
     3061  entry->strings = (char *) (entry->strs_size);
    30653062  read_entry_strings (file_open (entry), entry);
    30663063
     
    30803077               ((symbol *)p->n_un.n_name)->name, p->n_value);
    30813078
    3082   entry->strings = 0;           /* All done with them.  */
     3079  free (entry->strings);
     3080  entry->strings = NULL;                /* All done with them.  */
    30833081}
    30843082
     
    34513449  int number_of_syms = entry->syms_size / sizeof (struct nlist);
    34523450  unsigned char *nlist_bitvector
    3453     = (unsigned char *) alloca ((number_of_syms >> 3) + 1);
     3451    = (unsigned char *)