Changeset 1998
- Timestamp:
- Jun 5, 2005, 6:17:00 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/ld/ld.c
-
Property cvs2svn:cvs-rev
changed from
1.16
to1.17
r1997 r1998 63 63 64 64 /* 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" 71 66 #include "getopt.h" 72 67 … … 1957 1952 { 1958 1953 read_entry_symbols (desc, entry); 1959 entry->strings = (char *) alloca(entry->strs_size);1954 entry->strings = (char *) malloc (entry->strs_size); 1960 1955 read_entry_strings (desc, entry); 1961 1956 enter_file_symbols (entry); 1962 entry->strings = 0; 1957 free (entry->strings); 1958 entry->strings = NULL; 1963 1959 } 1964 1960 … … 2533 2529 { 2534 2530 read_entry_symbols (desc, subentry); 2535 subentry->strings = (char *) alloca(subentry->strs_size);2531 subentry->strings = (char *) malloc (subentry->strs_size); 2536 2532 read_entry_strings (desc, subentry); 2537 2533 … … 2550 2546 entry->subfiles = subentry; 2551 2547 *prev_addr = subentry; 2552 subentry->strings = 0; /* Since space will dissapear on return */ 2553 } 2548 } 2549 free (subentry->strings); 2550 subentry->strings = NULL; 2554 2551 } 2555 2552 … … 3062 3059 *end = entry->symbols + entry->syms_size / sizeof (struct nlist); 3063 3060 3064 entry->strings = (char *) alloca(entry->strs_size);3061 entry->strings = (char *) malloc (entry->strs_size); 3065 3062 read_entry_strings (file_open (entry), entry); 3066 3063 … … 3080 3077 ((symbol *)p->n_un.n_name)->name, p->n_value); 3081 3078 3082 entry->strings = 0; /* All done with them. */ 3079 free (entry->strings); 3080 entry->strings = NULL; /* All done with them. */ 3083 3081 } 3084 3082 … … 3451 3449 int number_of_syms = entry->syms_size / sizeof (struct nlist); 3452 3450 unsigned char *nlist_bitvector 3453 = (unsigned char *) alloca((number_of_syms >> 3) + 1);3451 = (unsigned char *) malloc ((number_of_syms >> 3) + 1); 3454 3452 struct line_debug_entry *text_scan, *data_scan; 3455 3453 int i; … … 3465 3463 int desc; 3466 3464 3467 entry->strings = (char *) alloca(entry->strs_size);3465 entry->strings = (char *) malloc (entry->strs_size); 3468 3466 desc = file_open (entry); 3469 3467 read_entry_strings (desc, entry); … … 3585 3583 free (text_scan); 3586 3584 free (data_scan); 3587 entry->strings = 0; /* Since it will dissapear anyway. */ 3585 free (entry->strings); 3586 entry->strings = NULL; 3587 free (nlist_bitvector); 3588 3588 } 3589 3589 … … 4186 4186 /* Allocate space for the file's text section */ 4187 4187 4188 bytes = (char *) alloca(entry->text_size);4188 bytes = (char *) malloc (entry->text_size); 4189 4189 4190 4190 /* Deal with relocation information however is appropriate */ … … 4218 4218 4219 4219 mywrite (bytes, 1, entry->text_size, outdesc); 4220 4221 free (bytes); 4220 4222 } 4221 4223 … … 4314 4316 desc = file_open (entry); 4315 4317 4316 bytes = (char *) alloca(entry->data_size);4318 bytes = (char *) malloc (entry->data_size); 4317 4319 4318 4320 if (entry->datarel) reloc = entry->datarel; … … 4339 4341 mywrite (bytes, 1, entry->data_size, outdesc); 4340 4342 padfile ((SECTION_ALIGN - entry->data_size) & SECTION_ALIGN_MASK, outdesc); 4343 4344 free (bytes); 4341 4345 } 4342 4346 … … 4823 4827 extra struct for each indirect symbol to hold the extra reference 4824 4828 following. */ 4825 struct nlist *buf = (struct nlist *) alloca((defined_global_sym_count4829 struct nlist *buf = (struct nlist *) malloc ((defined_global_sym_count 4826 4830 + undefined_global_sym_count 4827 4831 + global_indirect_count) … … 4850 4854 extra space for the references following indirect outputs. */ 4851 4855 4852 strtab_vector = (char **) alloca((num_hash_tab_syms4856 strtab_vector = (char **) malloc ((num_hash_tab_syms 4853 4857 + global_indirect_count) * sizeof (char *)); 4854 strtab_lens = (int *) alloca((num_hash_tab_syms4858 strtab_lens = (int *) malloc ((num_hash_tab_syms 4855 4859 + global_indirect_count) * sizeof (int)); 4856 4860 strtab_index = 0; … … 4964 4968 4965 4969 write_string_table (); 4970 free (strtab_vector); 4971 strtab_vector = NULL; 4972 free (strtab_lens); 4973 strtab_lens = NULL; 4974 free (buf); 4966 4975 } 4967 4976 … … 4984 4993 It has one extra slot for the local symbol we generate here. */ 4985 4994 struct nlist *buf 4986 = (struct nlist *) alloca(entry->syms_size + sizeof (struct nlist));4995 = (struct nlist *) malloc (entry->syms_size + sizeof (struct nlist)); 4987 4996 register struct nlist *bufp = buf; 4988 4997 … … 4993 5002 The elements are filled in by `assign_string_table_index'. */ 4994 5003 4995 strtab_vector = (char **) alloca(max_syms * sizeof (char *));4996 strtab_lens = (int *) alloca(max_syms * sizeof (int));5004 strtab_vector = (char **) malloc (max_syms * sizeof (char *)); 5005 strtab_lens = (int *) malloc (max_syms * sizeof (int)); 4997 5006 strtab_index = 0; 4998 5007 … … 5033 5042 /* Read the file's string table. */ 5034 5043 5035 entry->strings = (char *) alloca(entry->strs_size);5044 entry->strings = (char *) malloc (entry->strs_size); 5036 5045 read_entry_strings (file_open (entry), entry); 5037 5046 … … 5086 5095 5087 5096 write_string_table (); 5088 entry->strings = 0; /* Since it will dissapear anyway. */ 5097 free (entry->strings); 5098 entry->strings = NULL; 5099 free (strtab_vector); 5100 strtab_vector = NULL; 5101 free (strtab_lens); 5102 strtab_lens = NULL; 5103 free (buf); 5089 5104 } 5090 5105 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.