home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-28 | 71.7 KB | 2,891 lines |
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/Changelog,v
- retrieving revision 1.36
- diff -c -r1.36 Changelog
- *** 1.36 1992/11/08 00:29:27
- --- Changelog 1993/03/29 03:40:52
- ***************
- *** 391,393 ****
- --- 391,460 ----
- add -fshare flag for sharex text (mint 0.96 and up).
-
- ----------------------------- Patchlevel 33 --------------------------------
- +
- + REMOVE the following files from this (utils) directory
- + they have been moved to the include directory
- +
- + rm gnu-ar.h
- + rm gnu-out.h
- + rm stab.def
- + rm stab.h
- +
- +
- +
- + cnm.c: andreas
- + New flag -u, print symbols unsorted
- + Cleanups
- +
- + cplusdem.c:: andreas
- + Cleanups to sync up with Gnu
- +
- + stab.def, stab.h:: andreas
- + Cleanups to sync up with Gnu *********** NOTE moved to <include>
- +
- + printstk.c fixstk.c: andreas
- + Allow more than one file name argument
- +
- + strip.c:: andreas
- + Preserve the file mode and long symbols,
- + keep __stksize by default, new flag -a to strip
- + really all symbols
- +
- + ****************************
- + * NOTE: new flag -a *
- + ****************************
- +
- + ld.c sym-ld.c:
- +
- + - Many cleanups
- + - All large stack requirements removed
- + [ allocas turned into xmalloc/frees should be much more
- + MiNT freindlier!]
- + - defaults changed! ************** NOTE *****************
- + default prgflags == 7 now /* fastload and TT ram */
- + default symbol table type == gst_format symbols
- +
- + - new options ******************* NEW OPTIONS**************
- + -f load_flags
- + -h heap size
- +
- + nm.c:: andreas
- + - turn alloca()s into xmalloc()s
- +
- + printstk.c:: andreas
- + cleanup
- + make it handle long symbols properly
- +
- + size68.c:: andreas
- + cleanup
- +
- + fixstk.c:: ++jrb
- + was missing *argv in usage message
- +
- +
- + stab.def, stab.h:: ++jrb
- + removed from util subdir. use the one in the include
- + directory. the one in include has been brought upto date with
- + all the cygnus changes.
- +
- + ----------------------------- Patchlevel 35 --------------------------------
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/PatchLev.h,v
- retrieving revision 1.31
- diff -c -r1.31 PatchLev.h
- *** 1.31 1992/11/08 00:29:27
- --- PatchLev.h 1993/03/29 03:40:54
- ***************
- *** 1,4 ****
- ! #define PatchLevel "33"
-
- /*
- * the Patch Level above is to identify the version
- --- 1,4 ----
- ! #define PatchLevel "35"
-
- /*
- * the Patch Level above is to identify the version
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/cnm.c,v
- retrieving revision 1.8
- diff -c -r1.8 cnm.c
- *** 1.8 1992/10/11 02:39:24
- --- cnm.c 1993/03/29 03:40:56
- ***************
- *** 35,40 ****
- --- 35,41 ----
- #include <compiler.h>
- #include <stdio.h>
- #include <st-out.h>
- + #include <stdlib.h>
-
- #if __STDC__
- #include <stdlib.h>
- ***************
- *** 94,99 ****
- --- 95,101 ----
-
-
- int gflag;
- + int uflag;
-
- int main(argc, argv)
- int argc;
- ***************
- *** 102,113 ****
- int c, status = 0;
- extern char *optarg;
- extern int optind;
- ! while ((c = getopt(argc, argv, "g")) != -1)
- switch (c)
- {
- case 'g':
- gflag = 1;
- break;
- case '?':
- usage();
- }
- --- 104,118 ----
- int c, status = 0;
- extern char *optarg;
- extern int optind;
- ! while ((c = getopt(argc, argv, "gu")) != -1)
- switch (c)
- {
- case 'g':
- gflag = 1;
- break;
- + case 'u':
- + uflag = 1;
- + break;
- case '?':
- usage();
- }
- ***************
- *** 123,129 ****
- int cmp(s1, s2)
- struct xsym *s1, *s2;
- {
- ! return(s1->value - s2->value);
- }
-
- int doname(s, many)
- --- 128,135 ----
- int cmp(s1, s2)
- struct xsym *s1, *s2;
- {
- ! long diff = s1->value - s2->value;
- ! return (diff > 0) - (diff < 0);
- }
-
- int doname(s, many)
- ***************
- *** 183,189 ****
- }
- fclose(fd);
- printf("%ld %s symbol(s)\n", i, (gflag ? "global ": ""));
- ! qsort(syms, i, sizeof(struct xsym), cmp);
- while (i--)
- {
- dosym(syms);
- --- 189,196 ----
- }
- fclose(fd);
- printf("%ld %s symbol(s)\n", i, (gflag ? "global ": ""));
- ! if (!uflag)
- ! qsort(syms, i, sizeof(struct xsym), cmp);
- while (i--)
- {
- dosym(syms);
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/cplusdem.c,v
- retrieving revision 1.4
- diff -c -r1.4 cplusdem.c
- *** 1.4 1992/06/11 17:45:54
- --- cplusdem.c 1993/03/29 03:40:58
- ***************
- *** 148,154 ****
- "co", "~", /* ansi */
- "call", "()", /* old */
- "cl", "()", /* ansi */
- - "cond", "?:", /* old */
- "alshift", "<<", /* old */
- "ls", "<<", /* ansi */
- "als", "<<=", /* ansi */
- --- 148,153 ----
- ***************
- *** 235,240 ****
- --- 234,241 ----
- {
- int n = 0, success = 1;;
-
- + if (!isdigit (**type))
- + return 0;
- do
- {
- n *= 10;
- ***************
- *** 288,301 ****
- /* virtual table "_vt$" */
- else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
- {
- ! int n = strlen (type + 4) + 14 + 1;
- ! char *tem = (char *) xmalloc (n);
- ! strcpy (tem, type + 4);
- ! strcat (tem, " virtual table");
- ! return tem;
- }
- /* static data member */
- ! else if (type[0] == '_' && type[1] != '_' && (strchr (type, CPLUS_MARKER) != NULL))
- {
- static_type = 1;
- p = type + 1;
- --- 289,327 ----
- /* virtual table "_vt$" */
- else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
- {
- ! if (isdigit (type[4]))
- ! {
- ! int n;
- ! string_init (&decl);
- ! type += 4;
- ! while (get_simple_count (&type, &n))
- ! {
- ! string_appendn (&decl, type, n);
- ! type += n;
- ! if (*type == '\0')
- ! {
- ! string_appendn (&decl, " virtual table", 15);
- ! return decl.b;
- ! }
- ! if (*type++ != CPLUS_MARKER)
- ! break;
- ! string_append (&decl, "::");
- ! }
- ! string_delete (&decl);
- ! return NULL;
- ! }
- ! else
- ! {
- ! int n = strlen (type + 4) + 14 + 1;
- ! char *tem = (char *) xmalloc (n);
- ! strcpy (tem, type + 4);
- ! strcat (tem, " virtual table");
- ! return tem;
- ! }
- }
- /* static data member */
- ! else if (type[0] == '_' && strchr ("0123456789Qt", type[1]) != NULL
- ! && strchr (type, CPLUS_MARKER) != NULL)
- {
- static_type = 1;
- p = type + 1;
- ***************
- *** 345,351 ****
- else
- {
- string_appendn (&decl, type, p - type);
- ! decl.p[0] = '0';
- munge_function_name (&decl);
- p += 2;
- }
- --- 371,377 ----
- else
- {
- string_appendn (&decl, type, p - type);
- ! decl.p[0] = '\0';
- munge_function_name (&decl);
- p += 2;
- }
- ***************
- *** 451,456 ****
- --- 477,484 ----
- string_delete (&trawname);
- break;
- }
- + if (tname.p[-1] == '>')
- + string_append (&tname, " ");
- string_append (&tname, ">::");
- if (destructor)
- string_append(&tname, "~");
- ***************
- *** 556,573 ****
- int member;
- switch (**type)
- {
- - case 'Q':
- - n = (*type)[1] - '0';
- - if (n < 0 || n > 9)
- - {
- - success = 0;
- - break;
- - }
- - *type += 2;
- - while (n-- > 0)
- - do_type (type, result);
- - break;
- -
- case 'P':
- *type += 1;
- string_prepend (&decl, "*");
- --- 584,589 ----
- ***************
- *** 610,630 ****
-
- member = **type == 'M';
- *type += 1;
- ! if (!isdigit (**type))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! n = 0;
- ! do
- {
- - n *= 10;
- - n += **type - '0';
- - *type += 1;
- - }
- - while (isdigit (**type));
- - if (strlen (*type) < n)
- - {
- success = 0;
- break;
- }
- --- 626,633 ----
-
- member = **type == 'M';
- *type += 1;
- ! if (!get_simple_count (type, &n))
- {
- success = 0;
- break;
- }
- ***************
- *** 747,752 ****
- --- 750,763 ----
- *non_empty = 1;
- string_append (result, "unsigned");
- break;
- + case 'S':
- + *type += 1;
- + if (*non_empty)
- + string_append (result, " ");
- + else
- + *non_empty = 1;
- + string_append (result, "signed");
- + break;
- case 'V':
- *type += 1;
- if (*non_empty)
- ***************
- *** 813,818 ****
- --- 824,835 ----
- string_append (result, " ");
- string_append (result, "char");
- break;
- + case 'w':
- + *type += 1;
- + if (*non_empty)
- + string_append (result, " ");
- + string_append (result, "wchar_t");
- + break;
- case 'r':
- *type += 1;
- if (*non_empty)
- ***************
- *** 883,890 ****
- if (!do_template_args (type, result))
- success = 0;
- else
- ! string_append (result, ">");
- break;
- default:
- success = 0;
- break;
- --- 900,945 ----
- if (!do_template_args (type, result))
- success = 0;
- else
- ! {
- ! if (result->p[-1] == '>')
- ! string_append (result, " ");
- ! string_append (result, ">");
- ! }
- ! break;
- ! case 'Q':
- ! n = (*type)[1] - '0';
- ! if (n < 0 || n > 9)
- ! {
- ! success = 0;
- ! break;
- ! }
- ! *type += 2;
- ! if (n > 0)
- ! {
- ! string temp;
- ! if (!do_type (type, &temp))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! if (*non_empty)
- ! string_append (result, " ");
- ! string_appends (result, &temp);
- ! string_delete (&temp);
- ! while (--n > 0)
- ! {
- ! if (!do_type (type, &temp))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! string_append (result, "::");
- ! string_appends (result, &temp);
- ! string_delete (&temp);
- ! }
- ! }
- break;
- +
- default:
- success = 0;
- break;
- ***************
- *** 916,922 ****
- {
- *type += 1;
-
- ! success = do_type (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- --- 971,977 ----
- {
- *type += 1;
-
- ! success = do_arg (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- ***************
- *** 932,938 ****
- int is_integral = 0;
- int done = 0;
-
- ! success = do_type (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- --- 987,993 ----
- int is_integral = 0;
- int done = 0;
-
- ! success = do_arg (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- ***************
- *** 967,972 ****
- --- 1022,1028 ----
- case 'i': /* int */
- case 's': /* short */
- case 'c': /* char */
- + case 'w': /* wchar_t */
- done = is_integral = 1;
- break;
- case 'r': /* long double */
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/fixstk.c,v
- retrieving revision 1.6
- diff -c -r1.6 fixstk.c
- *** 1.6 1992/07/21 14:52:06
- --- fixstk.c 1993/03/29 03:40:59
- ***************
- *** 38,43 ****
- --- 38,45 ----
- # define SYM_OFFSET (sizeof(short) + (3*sizeof(long)))
- #endif
-
- + int error = 0;
- + long newstksize;
-
- static char *sym_names[] = { "__stksize", "__initial_stack" };
-
- ***************
- *** 48,56 ****
- {
- struct aexec head;
- struct asym sym;
- - int found;
- int all = 0;
- int index = 1;
-
- #ifndef WORD_ALIGNED
- if(read(fd, &head, sizeof(head)) != sizeof(head))
- --- 50,62 ----
- {
- struct aexec head;
- struct asym sym;
- int all = 0;
- int index = 1;
- + #ifndef WORD_ALIGNED
- + char extension[sizeof (struct asym)];
- + #else
- + char extension[SIZEOF_ASYM];
- + #endif
-
- #ifndef WORD_ALIGNED
- if(read(fd, &head, sizeof(head)) != sizeof(head))
- ***************
- *** 59,75 ****
- #endif
- {
- perror(fn);
- ! exit(2);
- }
- if(head.a_magic != CMAGIC)
- {
- ! fprintf(stderr,"Invalid magic number %x\n", head.a_magic);
- ! exit(3);
- }
- if(head.a_syms == 0)
- {
- fprintf(stderr,"%s: no symbol table\n", fn);
- ! exit(4);
- }
- if(lseek(fd, head.a_text+head.a_data, 1) !=
- #ifndef WORD_ALIGNED
- --- 65,81 ----
- #endif
- {
- perror(fn);
- ! return -1;
- }
- if(head.a_magic != CMAGIC)
- {
- ! fprintf(stderr,"%s: invalid magic number %x\n", fn, head.a_magic);
- ! return -1;
- }
- if(head.a_syms == 0)
- {
- fprintf(stderr,"%s: no symbol table\n", fn);
- ! return -1;
- }
- if(lseek(fd, head.a_text+head.a_data, 1) !=
- #ifndef WORD_ALIGNED
- ***************
- *** 79,85 ****
- #endif
- {
- perror(fn);
- ! exit(5);
- }
- for(;;)
- {
- --- 85,91 ----
- #endif
- {
- perror(fn);
- ! return -1;
- }
- for(;;)
- {
- ***************
- *** 89,111 ****
- if(index && read_sym(fd, &sym))
- #endif
- {
- ! fprintf(stderr, "symbol _stksize not found\n");
- ! exit(6);
- }
- /* after symbol read check first for _stksize */
- index ^= 1;
- if (strncmp(sym_names[index], sym.a_name, 8) == 0)
- {
- ! if ((found = (sym.a_type & A_DATA)) || all++)
- ! break;
- }
- }
-
- - if(!found)
- - {
- - fprintf(stderr, "symbol _stksize is undefined\n");
- - exit(9);
- - }
- *what = index;
- #ifndef WORD_ALIGNED
- return sym.a_value + sizeof(head);
- --- 95,126 ----
- if(index && read_sym(fd, &sym))
- #endif
- {
- ! fprintf(stderr, "%s: symbol _stksize not found\n", fn);
- ! return -1;
- }
- + if (index && (sym.a_type & A_LNAM) == A_LNAM)
- + if (read (fd, extension, sizeof (extension)) != sizeof (extension))
- + {
- + fprintf (stderr, "%s: symbol _stksize not found\n", fn);
- + return -1;
- + }
- /* after symbol read check first for _stksize */
- index ^= 1;
- if (strncmp(sym_names[index], sym.a_name, 8) == 0)
- {
- ! if ((sym.a_type & A_LNAM) == A_LNAM
- ! && strncmp (sym_names[index] + 8, extension, sizeof (extension)))
- ! continue;
- ! if (sym.a_type & A_DATA)
- ! break;
- ! if (all++)
- ! {
- ! fprintf (stderr, "%s: symbol _stksize is undefined\n", fn);
- ! return -1;
- ! }
- }
- }
-
- *what = index;
- #ifndef WORD_ALIGNED
- return sym.a_value + sizeof(head);
- ***************
- *** 141,177 ****
- int argc;
- char **argv;
- {
- ! int fd;
- ! int what;
- ! long newstksize, stksize, offset;
- ! char sizestr[16], fn[FILENAME_MAX];
- !
- ! if(argc < 2)
- {
- ! fprintf(stderr, "usage: fixstk size [<filename>]\n");
- ! exit(1);
- }
- !
- ! strcpy(sizestr, *++argv);
-
- ! if(argc > 2)
- ! (void) strcpy(fn, *++argv);
- ! else
- ! (void) strcpy(fn, "gcc-cc1.ttp");
-
- if((fd = open(fn, 2)) < 0)
- {
- perror(fn);
- ! exit(1);
- }
-
- - newstksize = calc_newsize(sizestr);
- offset = find_offset(fd, fn, &what);
- if(lseek(fd, offset, 0) != offset)
- {
- perror(fn);
- close(fd);
- ! exit(7);
- }
- read(fd, &stksize, sizeof(long));
- printf("%s: %s was %ld (%dK)\n",
- --- 156,199 ----
- int argc;
- char **argv;
- {
- ! if (argc < 3)
- {
- ! fprintf (stderr, "Usage: %s size file...\n", *argv);
- ! exit (1);
- }
- ! newstksize = calc_newsize (*++argv);
- ! --argc;
- ! while (--argc)
- ! error |= fix_stack (*++argv);
- ! exit (error);
- ! }
-
- ! int
- ! fix_stack (fn)
- ! char *fn;
- ! {
- ! int fd;
- ! int what;
- ! long stksize, offset;
-
- if((fd = open(fn, 2)) < 0)
- {
- perror(fn);
- ! return 1;
- }
-
- offset = find_offset(fd, fn, &what);
- + if (offset < 0)
- + {
- + close (fd);
- + return 1;
- + }
- +
- if(lseek(fd, offset, 0) != offset)
- {
- perror(fn);
- close(fd);
- ! return 1;
- }
- read(fd, &stksize, sizeof(long));
- printf("%s: %s was %ld (%dK)\n",
- ***************
- *** 183,189 ****
- {
- perror(fn);
- close(fd);
- ! exit(8);
- }
-
- lseek(fd, -((long)sizeof(long)), 1);
- --- 205,211 ----
- {
- perror(fn);
- close(fd);
- ! return 1;
- }
-
- lseek(fd, -((long)sizeof(long)), 1);
- ***************
- *** 191,197 ****
- read(fd, &stksize, sizeof(long));
- printf("%s: %s now is %ld (%dK)\n",
- fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
- ! return close(fd);
- }
-
- #ifdef WORD_ALIGNED
- --- 213,219 ----
- read(fd, &stksize, sizeof(long));
- printf("%s: %s now is %ld (%dK)\n",
- fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
- ! return close(fd) != 0;
- }
-
- #ifdef WORD_ALIGNED
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/ld.c,v
- retrieving revision 1.41
- diff -c -r1.41 ld.c
- *** 1.41 1992/11/08 00:29:27
- --- ld.c 1993/03/29 03:41:02
- ***************
- *** 132,142 ****
- /* Determine whether we should attempt to handle (minimally)
- N_BINCL and N_EINCL. */
-
- - #if (!(defined(atarist) || defined(atariminix) || defined(CROSSATARI)))
- #if defined (__GNU_STAB__) || defined (N_BINCL)
- #define HAVE_SUN_STABS
- #endif
- - #endif
-
- #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- /* stuff used when emitting reloc info here */
- --- 132,140 ----
- ***************
- *** 151,160 ****
- --- 149,160 ----
- int rbuf_size = 0; /* how many bytes are in there now */
- long rbuf_last_pc = -1; /* last rel pc; -1 means none yet */
-
- + #if 0 /* all big alloca's changed to xmalloc */
- #ifdef atarist /* and a stack */
- long _stksize = -1L;
- #endif
- #endif
- + #endif
-
- #ifdef min
- #undef min
- ***************
- *** 259,265 ****
- #ifdef i386
- #define INITIALIZE_HEADER outheader.a_machtype = M_386
- #endif
- ! #endif /* CROSSATARAI */
-
- #ifdef is68k
- /* This enables code to take care of an ugly hack in the ISI OS.
- --- 259,265 ----
- #ifdef i386
- #define INITIALIZE_HEADER outheader.a_machtype = M_386
- #endif
- ! #endif /* CROSSATARI */
-
- #ifdef is68k
- /* This enables code to take care of an ugly hack in the ISI OS.
- ***************
- *** 447,453 ****
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- ! This symbol acts like a N_DATA global symbol
- in that it can satisfy undefined external references.
-
- For the purposes of determining whether or not to load in a library
- --- 447,453 ----
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- ! This symbol acts like a N_TEXT global symbol
- in that it can satisfy undefined external references.
-
- For the purposes of determining whether or not to load in a library
- ***************
- *** 890,895 ****
- --- 890,901 ----
- void do_write_minix_out();
- #endif
-
- + #if defined (atarist) || defined (CROSSATARI)
- + /* atari special, specify load flags and head size */
- + int atari_load_flags;
- + int atari_heap_size;
- + #endif
- +
- /* Standard directories to search for files specified by -l. */
- #ifdef atarist
- char *standard_search_dirs[] = {"\\gnu\\lib", "\\gnu"};
- ***************
- *** 1096,1106 ****
- /* Initialize the data about options. */
-
- #if defined(atarist) || defined(CROSSATARI)
- ! gst_symboltable = 0;
- gst_symbols = 0;
- #endif
- specified_data_size = 0;
- strip_symbols = STRIP_NONE;
- trace_files = 0;
- discard_locals = DISCARD_NONE;
- entry_symbol = 0;
- --- 1102,1118 ----
- /* Initialize the data about options. */
-
- #if defined(atarist) || defined(CROSSATARI)
- ! gst_symboltable = 1;
- gst_symbols = 0;
- + atari_load_flags = 7; /* fastload / tt ram is the default */
- + atari_heap_size = 0;
- #endif
- specified_data_size = 0;
- + #ifdef atarist
- + strip_symbols = STRIP_DEBUGGER;
- + #else
- strip_symbols = STRIP_NONE;
- + #endif
- trace_files = 0;
- discard_locals = DISCARD_NONE;
- entry_symbol = 0;
- ***************
- *** 1164,1174 ****
- outheader.a_magic = magic;
- #endif
-
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- #ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
- #endif
- - #endif
-
- #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- text_size = sizeof (struct aexec);
- --- 1176,1184 ----
- ***************
- *** 1255,1260 ****
- --- 1265,1274 ----
- case 'o':
- case 'u':
- case 'y':
- + #if defined (atarist) || defined (CROSSATARI)
- + case 'f':
- + case 'h':
- + #endif
- if (arg[2])
- return 1;
- return 2;
- ***************
- *** 1618,1623 ****
- --- 1632,1653 ----
- case 'G':
- gst_symboltable = 1;
- return;
- +
- + case 'f':
- + atari_load_flags = parse (arg, "%i", "invalid argument to -f");
- + return;
- +
- + case 'h':
- + {
- + int heapsize_specified = parse (arg, "%i", "invalid argument to -h");
- + if (heapsize_specified >= 0 && heapsize_specified < 16)
- + atari_heap_size = heapsize_specified;
- + else if (heapsize_specified >= 128 && heapsize_specified <= 16 * 128)
- + atari_heap_size = (heapsize_specified - 128) / 128;
- + else
- + fatal ("invalid heap size", 0);
- + }
- + return;
- #endif
-
- case 'l':
- ***************
- *** 2113,2121 ****
- if (!N_BADMAG (*((struct exec *)&magicnum)))
- {
- read_entry_symbols (desc, entry);
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (desc, entry);
- enter_file_symbols (entry);
- entry->strings = 0;
- }
- else
- --- 2143,2152 ----
- if (!N_BADMAG (*((struct exec *)&magicnum)))
- {
- read_entry_symbols (desc, entry);
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (desc, entry);
- enter_file_symbols (entry);
- + free (entry->strings);
- entry->strings = 0;
- }
- else
- ***************
- *** 2697,2703 ****
- + symdef_base[i].symbol_name_string_index,
- entry->filename);
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) malloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- /* Now scan the symbol table and decide whether to load. */
- --- 2728,2734 ----
- + symdef_base[i].symbol_name_string_index,
- entry->filename);
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) xmalloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- /* Now scan the symbol table and decide whether to load. */
- ***************
- *** 2764,2775 ****
- if (!subentry) return;
-
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) alloca (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- free (subentry);
- }
- else
- --- 2795,2807 ----
- if (!subentry) return;
-
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) xmalloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- + free (subentry->strings);
- free (subentry);
- }
- else
- ***************
- *** 2781,2787 ****
- else
- entry->subfiles = subentry;
- prev = subentry;
- ! subentry->strings = 0; /* Since space will dissapear on return */
- }
-
- this_subfile_offset += member_length + sizeof (struct ar_hdr);
- --- 2813,2820 ----
- else
- entry->subfiles = subentry;
- prev = subentry;
- ! free (subentry->strings);
- ! subentry->strings = 0;
- }
-
- this_subfile_offset += member_length + sizeof (struct ar_hdr);
- ***************
- *** 3073,3079 ****
- --- 3106,3116 ----
- {
- if (!relocatable_output || force_common_definition)
- {
- + #ifdef atarist
- + com = (com + sizeof (short) - 1) & (- sizeof (short));
- + #else
- com = (com + sizeof (int) - 1) & (- sizeof (int));
- + #endif
-
- sp->value = data_start + data_size + bss_size;
- sp->defined = N_BSS | N_EXT;
- ***************
- *** 3133,3138 ****
- --- 3170,3176 ----
-
- /* Figure the data_pad now, so that it overlaps with the bss addresses. */
-
- + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- if (specified_data_size && specified_data_size > data_size)
- data_pad = specified_data_size - data_size;
-
- ***************
- *** 3144,3149 ****
- --- 3182,3188 ----
- if (bss_size < 0) bss_size = 0;
-
- data_size += data_pad;
- + #endif
- }
-
- /* Accumulate the section sizes of input file ENTRY
- ***************
- *** 3212,3222 ****
- switch (type)
- {
- case N_TEXT:
- case N_SETT:
- p->n_value += entry->text_start_address;
- break;
- case N_DATA:
- - case N_SETV:
- case N_SETD:
- /* A symbol whose value is in the data section
- is present in the input file as if the data section
- --- 3251,3261 ----
- switch (type)
- {
- case N_TEXT:
- + case N_SETV:
- case N_SETT:
- p->n_value += entry->text_start_address;
- break;
- case N_DATA:
- case N_SETD:
- /* A symbol whose value is in the data section
- is present in the input file as if the data section
- ***************
- *** 3297,3303 ****
- {
- register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- fprintf (outfile, "\nLocal symbols of ");
- --- 3336,3342 ----
- {
- register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- fprintf (outfile, "\nLocal symbols of ");
- ***************
- *** 3319,3324 ****
- --- 3358,3364 ----
- free(nm);
- }
-
- + free (entry->strings);
- entry->strings = 0; /* All done with them. */
- }
-
- ***************
- *** 3361,3367 ****
- {
- FILE *desc;
-
- ! entry->strings = (char *) alloca (entry->string_size);
- desc = file_open (entry);
- read_entry_strings (desc, entry);
- }
- --- 3401,3407 ----
- {
- FILE *desc;
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- desc = file_open (entry);
- read_entry_strings (desc, entry);
- }
- ***************
- *** 3573,3578 ****
- --- 3613,3619 ----
- }
- }
-
- + free (entry->strings);
- entry->strings = 0;
- }
- /*
- ***************
- *** 3969,3977 ****
- #else
- /* TOS */
- outheader.a_AZero1 = 0; /* good a place as any to do this */
- ! outheader.a_ldflgs = 0; /* fastload is NOT the default */
- if (magic == NMAGIC)
- ! outheader.a_ldflgs = F_SHTEXT; /* sharable text */
- outheader.a_isreloc = ISRELOCINFO; /* means reloc present (!) */
- #endif
- #endif
- --- 4010,4018 ----
- #else
- /* TOS */
- outheader.a_AZero1 = 0; /* good a place as any to do this */
- ! outheader.a_ldflgs = atari_load_flags | (atari_heap_size << 28);
- if (magic == NMAGIC)
- ! outheader.a_ldflgs |= F_SHTEXT; /* sharable text */
- outheader.a_isreloc = ISRELOCINFO; /* means reloc present (!) */
- #endif
- #endif
- ***************
- *** 4036,4046 ****
- }
- #endif
-
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- #ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
- #endif
- - #endif
-
- if (strip_symbols == STRIP_ALL)
- nsyms = 0;
- --- 4077,4085 ----
- ***************
- *** 4176,4182 ****
- --- 4215,4223 ----
- if (trace_files)
- fprintf (stderr, "\n");
-
- + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- padfile (text_pad, outdesc);
- + #endif
- }
-
- int
- ***************
- *** 4253,4259 ****
-
- /* Allocate space for the file's text section */
-
- ! bytes = (char *) alloca (entry->header.a_text);
-
- /* Deal with relocation information however is appropriate */
-
- --- 4294,4300 ----
-
- /* Allocate space for the file's text section */
-
- ! bytes = (char *) xmalloc (entry->header.a_text);
-
- /* Deal with relocation information however is appropriate */
-
- ***************
- *** 4290,4295 ****
- --- 4331,4339 ----
- /* Write the relocated text to the output file. */
-
- mywrite (bytes, 1, entry->header.a_text, outdesc);
- +
- + /* Free the space for the text segment. */
- + free (bytes);
- }
-
- /* Relocate the data segment of each input file
- ***************
- *** 4307,4313 ****
- --- 4351,4359 ----
- if (trace_files)
- fprintf (stderr, "\n");
-
- + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- padfile (data_pad, outdesc);
- + #endif
- }
-
- /* Read the data segment contents of ENTRY, relocate them,
- ***************
- *** 4328,4334 ****
-
- desc = file_open (entry);
-
- ! bytes = (char *) alloca (entry->header.a_data);
-
- if (entry->datarel) reloc = entry->datarel;
- #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- --- 4374,4380 ----
-
- desc = file_open (entry);
-
- ! bytes = (char *) xmalloc (entry->header.a_data);
-
- if (entry->datarel) reloc = entry->datarel;
- #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- ***************
- *** 4359,4364 ****
- --- 4405,4412 ----
- entry, 0);
-
- mywrite (bytes, 1, entry->header.a_data, outdesc);
- +
- + free (bytes);
- }
-
- static symbol *
- ***************
- *** 4431,4436 ****
- --- 4479,4485 ----
- int data_relocation = entry->data_start_address - entry->header.a_text;
- int bss_relocation
- = entry->bss_start_address - entry->header.a_text - entry->header.a_data;
- + int text_overflow = entry->header.a_text & ~65535;
-
- for (; p < end; p++)
- {
- ***************
- *** 4535,4541 ****
- if (RELOC_PCREL_P(p)||RELOC_EXTERN_P(p))
- word = *(short *) (data + addr);
- else
- ! word = *(unsigned short *) (data + addr);
- #ifdef BYTE_SWAP
- word = SWAP2(word);
- #endif
- --- 4584,4590 ----
- if (RELOC_PCREL_P(p)||RELOC_EXTERN_P(p))
- word = *(short *) (data + addr);
- else
- ! word = *(unsigned short *) (data + addr) + text_overflow;
- #ifdef BYTE_SWAP
- word = SWAP2(word);
- #endif
- ***************
- *** 4544,4550 ****
- if (relocation > 32767 || relocation < -32768) {
- if (!RELOC_EXTERN_P(p))
- if (!entry->strings) {
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
- }
- error ("fatal error: relocation out of range for %s in %s",
- --- 4593,4599 ----
- if (relocation > 32767 || relocation < -32768) {
- if (!RELOC_EXTERN_P(p))
- if (!entry->strings) {
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
- }
- error ("fatal error: relocation out of range for %s in %s",
- ***************
- *** 4586,4592 ****
- if (pure_text && relocation > text_size+text_start) {
- if (!RELOC_EXTERN_P(p))
- if (!entry->strings) {
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
- }
- error ("absolute reference to %s from pure-text in %s",
- --- 4635,4641 ----
- if (pure_text && relocation > text_size+text_start) {
- if (!RELOC_EXTERN_P(p))
- if (!entry->strings) {
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
- }
- error ("absolute reference to %s from pure-text in %s",
- ***************
- *** 4629,4634 ****
- --- 4678,4685 ----
- }
- #endif /* BYTE_SWAP */
- }
- + if (entry->strings)
- + free (entry->strings);
- entry->strings = 0;
- }
-
- ***************
- *** 4777,4782 ****
- --- 4828,4834 ----
- reloc_less_p);
- for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
- if ((entry->textrel[reloc_num].r_length == 2) &&
- + !entry->textrel[reloc_num].r_pcrel &&
- !emit_atari_reloc(entry->textrel[reloc_num].r_address + text_base))
- fprintf(stderr, " while processing text rel %d/%d of entry %s\n",
- reloc_num, n_relocs, entry->filename);
- ***************
- *** 4792,4797 ****
- --- 4844,4851 ----
- qsort(entry->datarel, n_relocs, sizeof (struct relocation_info),
- reloc_less_p);
- for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
- + if (entry->datarel[reloc_num].r_length == 2
- + && !entry->datarel[reloc_num].r_pcrel)
- if (!emit_atari_reloc(entry->datarel[reloc_num].r_address + data_base))
- fprintf(stderr, " while processing data rel %d/%d of entry %s\n",
- reloc_num, n_relocs, entry->filename);
- ***************
- *** 4942,4960 ****
- case N_UNDF: sym.a_type = A_UNDF; break;
- case N_ABS: sym.a_type = A_EQU; break; /* ??? */
- case N_SETT:
- - case N_TEXT: sym.a_type = A_TEXT; break;
- case N_SETV:
- case N_SETD:
- case N_DATA: sym.a_type = A_DATA; break;
- case N_SETB:
- case N_BSS: sym.a_type = A_BSS; break;
- case N_ATARI_FILENAME: sym.a_type = A_TFILE; break;
- ! default: /* fake it */
- ! sym.a_type = A_UNDF;
- ! bzero(sym.a_name, sizeof(sym.a_name));
- ! strncpy(sym.a_name, str, sizeof(sym.a_name));
- ! i = 0;
- ! goto fake_out;
-
- /* figure out rest of this later */
- }
- --- 4996,5009 ----
- case N_UNDF: sym.a_type = A_UNDF; break;
- case N_ABS: sym.a_type = A_EQU; break; /* ??? */
- case N_SETT:
- case N_SETV:
- + case N_TEXT: sym.a_type = A_TEXT; break;
- case N_SETD:
- case N_DATA: sym.a_type = A_DATA; break;
- case N_SETB:
- case N_BSS: sym.a_type = A_BSS; break;
- case N_ATARI_FILENAME: sym.a_type = A_TFILE; break;
- ! default: sym.a_type = A_UNDF; break;
-
- /* figure out rest of this later */
- }
- ***************
- *** 5010,5016 ****
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- --- 5059,5065 ----
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- ***************
- *** 5035,5045 ****
- {
- register int type = p->n_type;
- register int write = 0;
- - int is_a_set_ele;
-
- /* WRITE gets 1 for a non-global symbol that should be written. */
-
- ! if ((is_a_set_ele = SET_ELEMENT_P (type))) /* This occurs even if global. These */
- /* types of symbols are never written */
- /* globally, though they are stored */
- /* globally. */
- --- 5084,5093 ----
- {
- register int type = p->n_type;
- register int write = 0;
-
- /* WRITE gets 1 for a non-global symbol that should be written. */
-
- ! if (SET_ELEMENT_P (type)) /* This occurs even if global. These */
- /* types of symbols are never written */
- /* globally, though they are stored */
- /* globally. */
- ***************
- *** 5058,5073 ****
- /* If this symbol has a name, write it */
-
- if (p->n_un.n_strx)
- ! {
- ! write_atari_sym(p, ((is_a_set_ele)?
- ! ((symbol *) p->n_un.n_name)->name : p->n_un.n_strx + entry->strings));
- ! #if 0
- ! "SET_ELEMENT" : p->n_un.n_strx + entry->strings));
- ! #endif
- ! (*syms_written_addr)++;
- ! }
- }
- }
- entry->strings = NULL;
- }
-
- --- 5106,5120 ----
- /* If this symbol has a name, write it */
-
- if (p->n_un.n_strx)
- ! write_atari_sym(p, (SET_ELEMENT_P (type)
- ! ? ((symbol *) p->n_un.n_name)->name
- ! : p->n_un.n_strx + entry->strings));
- ! else
- ! write_atari_sym (p, "DBXSYM");
- ! (*syms_written_addr)++;
- }
- }
- + free (entry->strings);
- entry->strings = NULL;
- }
-
- ***************
- *** 5081,5086 ****
- --- 5128,5134 ----
- return;
-
- each_file(write_atari_syms, &n_syms_written);
- + file_close ();
-
- /* Now write out the global symbols. */
-
- ***************
- *** 5145,5171 ****
- n_syms_written++;
- }
- }
- - /* this is really stretching it, but we have to fake it */
- - if(n_syms_written < nsyms)
- - {
- - struct nlist nl;
-
- - nl.n_value = 0;
- - nl.n_type = (0x7ffff & N_TYPE); /* make sure it falls into the default */
- - /* case in write_atari_sym() */
- -
- - while(n_syms_written < nsyms)
- - {
- - #ifdef BYTE_SWAP
- - nl.n_un.n_strx = SWAP4(nl.n_un.n_strx);
- - nl.n_desc = SWAP2(nl.n_desc);
- - nl.n_value = SWAP4(nl.n_value);
- - #endif
- - write_atari_sym(&nl, "FAKEEAKF");
- - n_syms_written++;
- - }
- -
- - }
- if (n_syms_written != nsyms)
- fprintf(stderr, "Bogon alert! wrote %d syms, expected to write %d\n",
- n_syms_written, nsyms);
- --- 5193,5199 ----
- ***************
- *** 5225,5231 ****
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- --- 5253,5259 ----
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- ***************
- *** 5274,5279 ****
- --- 5302,5308 ----
- }
- }
- }
- + free (entry->strings);
- entry->strings = NULL;
- }
-
- ***************
- *** 5441,5450 ****
- extra struct for each indirect symbol to hold the extra reference
- following. */
- struct nlist *buf
- ! = (struct nlist *) alloca ((defined_global_sym_count
- ! + undefined_global_sym_count
- ! + global_indirect_count)
- ! * sizeof (struct nlist));
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- --- 5470,5479 ----
- extra struct for each indirect symbol to hold the extra reference
- following. */
- struct nlist *buf
- ! = (struct nlist *) xmalloc ((defined_global_sym_count
- ! + undefined_global_sym_count
- ! + global_indirect_count)
- ! * sizeof (struct nlist));
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- ***************
- *** 5457,5463 ****
- string_table_len = strtab_size;
-
- if (strip_symbols == STRIP_ALL)
- ! return;
-
- /* Write the local symbols defined by the various files. */
-
- --- 5486,5495 ----
- string_table_len = strtab_size;
-
- if (strip_symbols == STRIP_ALL)
- ! {
- ! free (buf);
- ! return;
- ! }
-
- /* Write the local symbols defined by the various files. */
-
- ***************
- *** 5470,5479 ****
- table from the global symbols written so far. This must include
- extra space for the references following indirect outputs. */
-
- ! strtab_vector = (char **) alloca ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (char *));
- ! strtab_lens = (int *) alloca ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (int));
- strtab_index = 0;
-
- /* Scan the symbol hash table, bucket by bucket. */
- --- 5502,5511 ----
- table from the global symbols written so far. This must include
- extra space for the references following indirect outputs. */
-
- ! strtab_vector = (char **) xmalloc ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (char *));
- ! strtab_lens = (int *) xmalloc ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (int));
- strtab_index = 0;
-
- /* Scan the symbol hash table, bucket by bucket. */
- ***************
- *** 5573,5578 ****
- --- 5605,5616 ----
- /* Write the strings for the global symbols. */
-
- write_string_table ();
- +
- + /* Free the buffers. */
- +
- + free (strtab_lens);
- + free (strtab_vector);
- + free (buf);
- }
-
- /* Write the local and debugger symbols of file ENTRY.
- ***************
- *** 5592,5598 ****
- /* Buffer to accumulate all the syms before writing them.
- It has one extra slot for the local symbol we generate here. */
- struct nlist *buf
- ! = (struct nlist *) alloca (entry->header.a_syms + sizeof (struct nlist));
- register struct nlist *bufp = buf;
-
- /* Upper bound on number of syms to be written here. */
- --- 5630,5636 ----
- /* Buffer to accumulate all the syms before writing them.
- It has one extra slot for the local symbol we generate here. */
- struct nlist *buf
- ! = (struct nlist *) xmalloc (entry->header.a_syms + sizeof (struct nlist));
- register struct nlist *bufp = buf;
-
- /* Upper bound on number of syms to be written here. */
- ***************
- *** 5601,5608 ****
- /* Make tables that record, for each symbol, its name and its name's length.
- The elements are filled in by `assign_string_table_index'. */
-
- ! strtab_vector = (char **) alloca (max_syms * sizeof (char *));
- ! strtab_lens = (int *) alloca (max_syms * sizeof (int));
- strtab_index = 0;
-
- /* Generate a local symbol for the start of this file's text. */
- --- 5639,5646 ----
- /* Make tables that record, for each symbol, its name and its name's length.
- The elements are filled in by `assign_string_table_index'. */
-
- ! strtab_vector = (char **) xmalloc (max_syms * sizeof (char *));
- ! strtab_lens = (int *) xmalloc (max_syms * sizeof (int));
- strtab_index = 0;
-
- /* Generate a local symbol for the start of this file's text. */
- ***************
- *** 5623,5629 ****
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- for (; p < end; p++)
- --- 5661,5667 ----
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- for (; p < end; p++)
- ***************
- *** 5685,5695 ****
- using the data in vectors `strtab_vector' and `strtab_lens'. */
-
- write_string_table ();
- ! entry->strings = 0; /* Since it will dissapear anyway. */
- }
- #endif /* not atari st */
-
-
- /* Copy any GDB symbol segments from the input files to the output file.
- The contents of the symbol segment is copied without change
- except that we store some information into the beginning of it. */
- --- 5723,5740 ----
- using the data in vectors `strtab_vector' and `strtab_lens'. */
-
- write_string_table ();
- !
- ! /* Free all buffers. */
- ! free (entry->strings);
- ! entry->strings = 0;
- ! free (strtab_lens);
- ! free (strtab_vector);
- ! free (buf);
- }
- #endif /* not atari st */
-
-
- + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- /* Copy any GDB symbol segments from the input files to the output file.
- The contents of the symbol segment is copied without change
- except that we store some information into the beginning of it. */
- ***************
- *** 5706,5713 ****
- write_file_symseg (entry)
- struct file_entry *entry;
- {
- - /* this appears to be completely wrong for ST */
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- char buffer[4096];
- struct symbol_root root;
- FILE *indesc;
- --- 5751,5756 ----
- ***************
- *** 5769,5776 ****
- }
-
- file_close ();
- - #endif
- }
-
- /* Create the symbol table entries for `etext', `edata' and `end'. */
-
- --- 5812,5819 ----
- }
-
- file_close ();
- }
- + #endif /* not atari */
-
- /* Create the symbol table entries for `etext', `edata' and `end'. */
-
- ***************
- *** 5996,6001 ****
- --- 6039,6045 ----
- }
- }
-
- + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- /* Output PADDING zero-bytes to descriptor OUTDESC.
- PADDING may be negative; in that case, do nothing. */
-
- ***************
- *** 6004,6011 ****
- int padding;
- FILE *outdesc;
- {
- - /* not round here, you don't... */
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- register char *buf;
- if (padding <= 0)
- return;
- --- 6048,6053 ----
- ***************
- *** 6013,6020 ****
- buf = (char *) alloca (padding);
- bzero (buf, padding);
- mywrite (buf, padding, 1, outdesc);
- - #endif
- }
-
- /* Return a newly-allocated string
- whose contents concatenate the strings S1, S2, S3. */
- --- 6055,6062 ----
- buf = (char *) alloca (padding);
- bzero (buf, padding);
- mywrite (buf, padding, 1, outdesc);
- }
- + #endif /* not atari */
-
- /* Return a newly-allocated string
- whose contents concatenate the strings S1, S2, S3. */
- ***************
- *** 6176,6182 ****
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- --- 6218,6224 ----
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- /* Generate a local symbol for the start of this file's text. */
- ***************
- *** 6221,6226 ****
- --- 6263,6269 ----
- }
- }
- }
- + free (entry->strings);
- entry->strings = NULL;
- }
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/nm.c,v
- retrieving revision 1.10
- diff -c -r1.10 nm.c
- *** 1.10 1992/03/22 21:44:03
- --- nm.c 1993/03/29 03:41:06
- ***************
- *** 146,154 ****
- --- 146,156 ----
-
- /* If compiled with GNU C, use the built-in alloca */
- #ifdef __GNUC__
- + #ifndef alloca
- # define alloca __builtin_alloca
- #endif
-
- + #else
- /*
- * Alloca include.
- */
- ***************
- *** 158,163 ****
- --- 160,166 ----
- #endif
- #include "alloca.h"
- #endif
- + #endif /* __GNUC__ */
-
- /* Name of this program. */
-
- ***************
- *** 792,797 ****
- --- 795,806 ----
- case N_LENG:
- s = "LENG";
- break;
- + case N_BINCL:
- + s = "BINCL";
- + break;
- + case N_EINCL:
- + s = "EINCL";
- + break;
- default:
- s = "";
- }
- ***************
- *** 849,883 ****
- }
-
- nsymdefs = symdef_size / sizeof (struct symdef);
- ! symdefs = (struct symdef *) alloca (symdef_size);
- if (symdef_size != read (desc, symdefs, symdef_size))
- {
- error_with_file ("premature eof in ");
- return;
- }
-
- ! if (stringsize < 0)
- {
- ! error_with_file ("invalid size value in ");
- return;
- }
-
- ! if (sizeof stringsize != read (desc, &stringsize, sizeof stringsize))
- {
- ! error_with_file ("premature eof in ");
- return;
- }
-
- ! strings = (char *) alloca (stringsize);
- if (stringsize != read (desc, strings, stringsize))
- {
- error_with_file ("premature eof in ");
- return;
- }
-
- if (stringsize + symdef_size + sizeof stringsize + sizeof symdef_size != member_length)
- {
- error_with_file ("size of data isn't what the data calls for in ");
- return;
- }
-
- --- 858,899 ----
- }
-
- nsymdefs = symdef_size / sizeof (struct symdef);
- ! symdefs = (struct symdef *) xmalloc (symdef_size);
- if (symdef_size != read (desc, symdefs, symdef_size))
- {
- error_with_file ("premature eof in ");
- + free (symdefs);
- return;
- }
-
- ! if (sizeof stringsize != read (desc, &stringsize, sizeof stringsize))
- {
- ! error_with_file ("premature eof in ");
- ! free (symdefs);
- return;
- }
-
- ! if (stringsize < 0)
- {
- ! error_with_file ("invalid size value in ");
- ! free (symdefs);
- return;
- }
-
- ! strings = (char *) xmalloc (stringsize);
- if (stringsize != read (desc, strings, stringsize))
- {
- error_with_file ("premature eof in ");
- + free (symdefs);
- + free (strings);
- return;
- }
-
- if (stringsize + symdef_size + sizeof stringsize + sizeof symdef_size != member_length)
- {
- error_with_file ("size of data isn't what the data calls for in ");
- + free (symdefs);
- + free (strings);
- return;
- }
-
- ***************
- *** 890,895 ****
- --- 906,913 ----
- if (symdefs[i].stringoffset < 0 || symdefs[i].stringoffset >= stringsize)
- {
- error_with_file ("invalid entry in ");
- + free (symdefs);
- + free (strings);
- return;
- }
- if (member_offset != symdefs[i].offset)
- ***************
- *** 904,909 ****
- --- 922,929 ----
- }
- printf ("%s in %s\n", symdefs[i].stringoffset + strings, member_name);
- }
- + free (symdefs);
- + free (strings);
- }
-
- /* Report a fatal error.
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/printstk.c,v
- retrieving revision 1.6
- diff -c -r1.6 printstk.c
- *** 1.6 1992/07/21 14:52:06
- --- printstk.c 1993/03/29 03:41:07
- ***************
- *** 33,38 ****
- --- 33,40 ----
- # define SYM_OFFSET (sizeof(short) + (3*sizeof(long)))
- #endif
-
- + int error = 0;
- +
- static char *sym_names[] = { "__stksize", "__initial_stack" };
-
- long find_offset (fd, fn, what)
- ***************
- *** 42,50 ****
- {
- struct aexec head;
- struct asym sym;
- - int found;
- int all = 0;
- int index = 1;
-
- #ifndef WORD_ALIGNED
- if(read(fd, &head, sizeof(head)) != sizeof(head))
- --- 44,56 ----
- {
- struct aexec head;
- struct asym sym;
- int all = 0;
- int index = 1;
- + #ifndef WORD_ALIGNED
- + char extension[sizeof (struct asym)];
- + #else
- + char extension[SIZEOF_ASYM];
- + #endif
-
- #ifndef WORD_ALIGNED
- if(read(fd, &head, sizeof(head)) != sizeof(head))
- ***************
- *** 53,69 ****
- #endif
- {
- perror(fn);
- ! exit(2);
- }
- if(head.a_magic != CMAGIC)
- {
- ! fprintf(stderr,"Invalid magic number %x\n", head.a_magic);
- ! exit(3);
- }
- if(head.a_syms == 0)
- {
- fprintf(stderr,"%s: no symbol table\n", fn);
- ! exit(4);
- }
- if(lseek(fd, head.a_text+head.a_data, 1) !=
- #ifndef WORD_ALIGNED
- --- 59,75 ----
- #endif
- {
- perror(fn);
- ! return -1;
- }
- if(head.a_magic != CMAGIC)
- {
- ! fprintf(stderr,"%s: invalid magic number %x\n", fn, head.a_magic);
- ! return -1;
- }
- if(head.a_syms == 0)
- {
- fprintf(stderr,"%s: no symbol table\n", fn);
- ! return -1;
- }
- if(lseek(fd, head.a_text+head.a_data, 1) !=
- #ifndef WORD_ALIGNED
- ***************
- *** 73,79 ****
- #endif
- {
- perror(fn);
- ! exit(5);
- }
- for(;;)
- {
- --- 79,85 ----
- #endif
- {
- perror(fn);
- ! return -1;
- }
- for(;;)
- {
- ***************
- *** 83,105 ****
- if(index && read_sym(fd, &sym))
- #endif
- {
- ! fprintf(stderr, "symbol _stksize not found\n");
- ! exit(6);
- }
- /* after symbol read check first for _stksize */
- index ^= 1;
- if (strncmp(sym_names[index], sym.a_name, 8) == 0)
- {
- ! if ((found = (sym.a_type & A_DATA)) || all++)
- ! break;
- }
- }
-
- - if(!found)
- - {
- - fprintf(stderr, "symbol _stksize is undefined\n");
- - exit(9);
- - }
- *what = index;
- #ifndef WORD_ALIGNED
- return sym.a_value + sizeof(head);
- --- 89,120 ----
- if(index && read_sym(fd, &sym))
- #endif
- {
- ! fprintf(stderr, "%s: symbol _stksize not found\n", fn);
- ! return -1;
- }
- + if (index && (sym.a_type & A_LNAM) == A_LNAM)
- + if (read (fd, extension, sizeof (extension)) != sizeof (extension))
- + {
- + fprintf (stderr, "%s: symbol _stksize not found\n", fn);
- + return -1;
- + }
- /* after symbol read check first for _stksize */
- index ^= 1;
- if (strncmp(sym_names[index], sym.a_name, 8) == 0)
- {
- ! if ((sym.a_type & A_LNAM) == A_LNAM
- ! && strncmp (sym_names[index] + 8, extension, sizeof (extension)))
- ! continue;
- ! if (sym.a_type & A_DATA)
- ! break;
- ! if (all++)
- ! {
- ! fprintf (stderr, "%s: symbol _stksize is undefined\n", fn);
- ! return -1;
- ! }
- }
- }
-
- *what = index;
- #ifndef WORD_ALIGNED
- return sym.a_value + sizeof(head);
- ***************
- *** 112,145 ****
- int argc;
- char **argv;
- {
- int fd;
- int what;
- long stksize, offset;
- - char fn[FILENAME_MAX];
-
- - if(argc > 1)
- - (void) strcpy(fn, *++argv);
- - else
- - (void) strcpy(fn, "gcc-cc1.ttp");
- -
- if((fd = open(fn, 0)) < 0)
- {
- perror(fn);
- ! exit(1);
- }
-
- offset = find_offset(fd, fn, &what);
- !
- if(lseek(fd, offset, 0) != offset)
- {
- perror(fn);
- ! exit(7);
- }
- read(fd, &stksize, sizeof(long));
- printf("%s: %s is %ld (%dK)\n",
- fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
-
- ! return close(fd);
- }
-
- #ifdef WORD_ALIGNED
- --- 127,169 ----
- int argc;
- char **argv;
- {
- + while (--argc)
- + error |= print_stack (*++argv);
- + exit (error);
- + }
- +
- + int
- + print_stack (fn)
- + char *fn;
- + {
- int fd;
- int what;
- long stksize, offset;
-
- if((fd = open(fn, 0)) < 0)
- {
- perror(fn);
- ! return 1;
- }
-
- offset = find_offset(fd, fn, &what);
- ! if (offset < 0)
- ! {
- ! close (fd);
- ! return 1;
- ! }
- !
- if(lseek(fd, offset, 0) != offset)
- {
- perror(fn);
- ! close (fd);
- ! return 1;
- }
- read(fd, &stksize, sizeof(long));
- printf("%s: %s is %ld (%dK)\n",
- fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
-
- ! return close(fd) != 0;
- }
-
- #ifdef WORD_ALIGNED
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/size68.c,v
- retrieving revision 1.6
- diff -c -r1.6 size68.c
- *** 1.6 1992/01/14 19:45:23
- --- size68.c 1993/03/29 03:41:09
- ***************
- *** 23,31 ****
- int argc;
- char **argv;
- {
- - #ifdef atarist
- - _binmode(1);
- - #endif
- while(--argc > 0)
- showfile(*++argv);
- return 0;
- --- 23,28 ----
- ***************
- *** 37,43 ****
- register FILE *fp;
- struct aexec h;
-
- ! if((fp = fopen(name, "r")) == (FILE *)NULL)
- {
- perror(name);
- exit(1);
- --- 34,40 ----
- register FILE *fp;
- struct aexec h;
-
- ! if((fp = fopen(name, "rb")) == (FILE *)NULL)
- {
- perror(name);
- exit(1);
- ***************
- *** 60,70 ****
- }
- printf("%s:\n\ttext size\t%ld\n\tdata size\t%ld\n\tbss size\t%ld\
- \n\tsymbol size\t%ld\n\tFile %s relocatable\n\
- ! \n\t%s\n", name, h.a_text,
- h.a_data, h.a_bss, h.a_syms,
- (h.a_isreloc == ISRELOCINFO)? "is":"is not",
- ! (h.a_AZero2 & 1)? "Only BSS cleared on startup" :
- ! "BSS and high mem cleared on startup");
- }
-
- # ifdef WORD_ALIGNED
- --- 57,66 ----
- }
- printf("%s:\n\ttext size\t%ld\n\tdata size\t%ld\n\tbss size\t%ld\
- \n\tsymbol size\t%ld\n\tFile %s relocatable\n\
- ! \t%s cleared on startup\n\n", name, h.a_text,
- h.a_data, h.a_bss, h.a_syms,
- (h.a_isreloc == ISRELOCINFO)? "is":"is not",
- ! (h.a_AZero2 & 1)? "Only BSS" : "BSS and high mem");
- }
-
- # ifdef WORD_ALIGNED
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/strip.c,v
- retrieving revision 1.7
- diff -c -r1.7 strip.c
- *** 1.7 1992/08/14 17:24:38
- --- strip.c 1993/03/29 03:41:10
- ***************
- *** 31,41 ****
- */
-
- #include <stdio.h>
- #ifdef atarist
- #ifdef __GNUC__
- # include <stddef.h>
- # include <memory.h>
- ! # include <unixlib.h>
- #else
- #include <malloc.h>
- extern long lread();
- --- 31,42 ----
- */
-
- #include <stdio.h>
- + #include <stat.h>
- #ifdef atarist
- #ifdef __GNUC__
- # include <stddef.h>
- # include <memory.h>
- ! # include <unistd.h>
- #else
- #include <malloc.h>
- extern long lread();
- ***************
- *** 51,56 ****
- --- 52,59 ----
- extern char *malloc(), *realloc();
- #else
- # include <string.h>
- + # define lwrite _write
- + # define lread _read
- #endif
-
- #include <fcntl.h>
- ***************
- *** 66,75 ****
- typedef char symstr_t[GST_SYMLEN];
- symstr_t stklist[] = {"__stksize", "__initial_stack"};
-
- - #ifdef atarist
- - long _stksize = 1L;
- - #endif
- -
- #ifndef __PROTO
- # if __STDC__ || __cplusplus
- # define __PROTO(s) s
- --- 69,74 ----
- ***************
- *** 100,107 ****
- int status = 0;
- int flag = -1;
- int cuttrail = 0;
- ! symstr_t *nmlist = (symstr_t *) 0;
- ! select_fp select=(select_fp)NULL;
- #ifdef atarist
- char *tmpdir;
- register int l;
- --- 99,106 ----
- int status = 0;
- int flag = -1;
- int cuttrail = 0;
- ! symstr_t *nmlist = stklist;
- ! select_fp select = sel_listed;
- #ifdef atarist
- char *tmpdir;
- register int l;
- ***************
- *** 126,131 ****
- --- 125,133 ----
- nmlist = stklist;
- select = sel_listed;
- break;
- + case 'a':
- + select = 0;
- + break;
- case 'l':
- (*argv)++;
- if ('\0' == **argv) {
- ***************
- *** 151,167 ****
-
- #ifdef __GNUC__
- #ifdef atarist
- - tmpname[0] = '\0';
- if ((tmpdir = getenv ("TEMP")) != NULL) {
- strcpy (tmpname, tmpdir);
- l = (int) strlen (tmpname) - 1;
- ! if (tmpname[l] == '\\')
- tmpname[l] = '\0';
- }
- ! strcat (tmpname, "\\STXXXXXX");
- ! #else
- ! strcpy (tmpname, "/tmp/STXXXXXX");
- #endif
-
- mktemp (tmpname);
- #else /* not __GNUC__ */
- --- 153,168 ----
-
- #ifdef __GNUC__
- #ifdef atarist
- if ((tmpdir = getenv ("TEMP")) != NULL) {
- strcpy (tmpname, tmpdir);
- l = (int) strlen (tmpname) - 1;
- ! if (tmpname[l] == '\\' || tmpname[l] == '/')
- tmpname[l] = '\0';
- + strcat (tmpname, "/STXXXXXX");
- }
- ! else
- #endif
- + strcpy (tmpname, "/tmp/STXXXXXX");
-
- mktemp (tmpname);
- #else /* not __GNUC__ */
- ***************
- *** 197,203 ****
- char *s;
- {
- report (s);
- ! report ("Usage: strip {-k | -l names | -g} [-t] files ...\n");
- exit (1);
- }
-
- --- 198,204 ----
- char *s;
- {
- report (s);
- ! report ("Usage: strip {-k | -l names | -g | -a} [-t] files ...\n");
- exit (1);
- }
-
- ***************
- *** 275,280 ****
- --- 276,282 ----
- register long count, rbytes, sbytes;
- long lbytes, swap_lbytes;
- struct aexec ahead;
- + struct stat statb;
-
- if ((fd = open (name, O_RDONLY, 0666)) < 0) {
- perror (name);
- ***************
- *** 372,379 ****
- }
- close (tfd);
- close (fd);
- if (rename(tmpname, name) == 0) return 0; /* try to rename it */
- ! if ((fd = open (name, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) {
- perror (name);
- return 0x1000;
- }
- --- 374,383 ----
- }
- close (tfd);
- close (fd);
- + if (stat (name, &statb) < 0)
- + statb.st_mode = 0666;
- if (rename(tmpname, name) == 0) return 0; /* try to rename it */
- ! if ((fd = open (name, O_WRONLY | O_TRUNC | O_CREAT, statb.st_mode)) < 0) {
- perror (name);
- return 0x1000;
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/sym-ld.c,v
- retrieving revision 1.22
- diff -c -r1.22 sym-ld.c
- *** 1.22 1992/10/11 02:39:24
- --- sym-ld.c 1993/03/29 03:41:12
- ***************
- *** 129,137 ****
- --- 129,139 ----
- #endif
- #endif
-
- + #if 0 /* all big alloca's eliminated */
- #ifdef atarist /* and a stack */
- long _stksize = -1L;
- #endif
- + #endif
-
- #ifdef min
- #undef min
- ***************
- *** 419,425 ****
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- ! This symbol acts like a N_DATA global symbol
- in that it can satisfy undefined external references.
-
- For the purposes of determining whether or not to load in a library
- --- 421,427 ----
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- ! This symbol acts like a N_TEXT global symbol
- in that it can satisfy undefined external references.
-
- For the purposes of determining whether or not to load in a library
- ***************
- *** 996,1006 ****
-
- outheader.a_info = magic;
-
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- #ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
- #endif
- - #endif
-
- text_size = sizeof (struct exec);
- #ifdef COFF_ENCAPSULATE
- --- 998,1006 ----
- ***************
- *** 1870,1878 ****
- if (!N_BADMAG (*((struct exec *)&magicnum)))
- {
- read_entry_symbols (desc, entry);
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (desc, entry);
- enter_file_symbols (entry);
- entry->strings = 0;
- }
- else
- --- 1870,1879 ----
- if (!N_BADMAG (*((struct exec *)&magicnum)))
- {
- read_entry_symbols (desc, entry);
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (desc, entry);
- enter_file_symbols (entry);
- + free (entry->strings);
- entry->strings = 0;
- }
- else
- ***************
- *** 2405,2411 ****
- + symdef_base[i].symbol_name_string_index,
- entry->filename);
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) malloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- /* Now scan the symbol table and decide whether to load. */
- --- 2406,2412 ----
- + symdef_base[i].symbol_name_string_index,
- entry->filename);
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) xmalloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- /* Now scan the symbol table and decide whether to load. */
- ***************
- *** 2472,2483 ****
- if (!subentry) return;
-
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) alloca (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- free (subentry);
- }
- else
- --- 2473,2485 ----
- if (!subentry) return;
-
- read_entry_symbols (desc, subentry);
- ! subentry->strings = (char *) xmalloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- + free (subentry->strings);
- free (subentry);
- }
- else
- ***************
- *** 2743,2749 ****
- --- 2745,2755 ----
- {
- if (!relocatable_output || force_common_definition)
- {
- + #ifdef atarist
- + com = (com + sizeof (short) - 1) & (- sizeof (short));
- + #else
- com = (com + sizeof (int) - 1) & (- sizeof (int));
- + #endif
-
- sp->value = data_start + data_size + bss_size;
- sp->defined = N_BSS | N_EXT;
- ***************
- *** 2867,2877 ****
- switch (type)
- {
- case N_TEXT:
- case N_SETT:
- p->n_value += entry->text_start_address;
- break;
- case N_DATA:
- - case N_SETV:
- case N_SETD:
- /* A symbol whose value is in the data section
- is present in the input file as if the data section
- --- 2873,2883 ----
- switch (type)
- {
- case N_TEXT:
- + case N_SETV:
- case N_SETT:
- p->n_value += entry->text_start_address;
- break;
- case N_DATA:
- case N_SETD:
- /* A symbol whose value is in the data section
- is present in the input file as if the data section
- ***************
- *** 2952,2958 ****
- {
- register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- fprintf (outfile, "\nLocal symbols of ");
- --- 2958,2964 ----
- {
- register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- fprintf (outfile, "\nLocal symbols of ");
- ***************
- *** 2974,2979 ****
- --- 2980,2986 ----
- free(nm);
- }
-
- + free (entry->strings);
- entry->strings = 0; /* All done with them. */
- }
-
- ***************
- *** 3027,3033 ****
- {
- int desc;
-
- ! entry->strings = (char *) alloca (entry->string_size);
- desc = file_open (entry);
- read_entry_strings (desc, entry);
- }
- --- 3034,3040 ----
- {
- int desc;
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- desc = file_open (entry);
- read_entry_strings (desc, entry);
- }
- ***************
- *** 3240,3245 ****
- --- 3247,3253 ----
- }
- }
-
- + free (entry->strings);
- entry->strings = 0;
- }
- /*
- ***************
- *** 3540,3546 ****
-
- filemode = statbuf.st_mode;
-
- ! #ifndef atarist
- chmod (output_filename, filemode & ~0111);
- #endif
-
- --- 3548,3554 ----
-
- filemode = statbuf.st_mode;
-
- ! #if !(defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- chmod (output_filename, filemode & ~0111);
- #endif
-
- ***************
- *** 3566,3572 ****
-
- close (outdesc);
-
- ! #ifndef atarist
- chmod (output_filename, filemode | 0111);
- #endif
- }
- --- 3574,3580 ----
-
- close (outdesc);
-
- ! #if !(defined(CROSSATARI) || defined(atarist) || defined(atariminix))
- chmod (output_filename, filemode | 0111);
- #endif
- }
- ***************
- *** 3648,3658 ****
- }
- #endif
-
- - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
- #ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
- #endif
- - #endif
-
- if (strip_symbols == STRIP_ALL)
- nsyms = 0;
- --- 3656,3664 ----
- ***************
- *** 3810,3816 ****
-
- /* Allocate space for the file's text section */
-
- ! bytes = (char *) alloca (entry->header.a_text);
-
- /* Deal with relocation information however is appropriate */
-
- --- 3816,3822 ----
-
- /* Allocate space for the file's text section */
-
- ! bytes = (char *) xmalloc (entry->header.a_text);
-
- /* Deal with relocation information however is appropriate */
-
- ***************
- *** 3822,3828 ****
- }
- else
- {
- ! reloc = (struct relocation_info *) alloca (entry->header.a_trsize);
- lseek (desc, text_offset (entry) + entry->header.a_text + entry->header.a_data, 0);
- if (entry->header.a_trsize != read (desc, reloc, entry->header.a_trsize))
- fatal_with_file ("premature eof in text relocation of ", entry);
- --- 3828,3834 ----
- }
- else
- {
- ! reloc = (struct relocation_info *) xmalloc (entry->header.a_trsize);
- lseek (desc, text_offset (entry) + entry->header.a_text + entry->header.a_data, 0);
- if (entry->header.a_trsize != read (desc, reloc, entry->header.a_trsize))
- fatal_with_file ("premature eof in text relocation of ", entry);
- ***************
- *** 3843,3848 ****
- --- 3849,3858 ----
- /* Write the relocated text to the output file. */
-
- mywrite (bytes, 1, entry->header.a_text, outdesc);
- +
- + if (!entry->textrel)
- + free (reloc);
- + free (bytes);
- }
-
- /* Relocate the data segment of each input file
- ***************
- *** 3881,3887 ****
-
- desc = file_open (entry);
-
- ! bytes = (char *) alloca (entry->header.a_data);
-
- if (entry->datarel) reloc = entry->datarel;
- else if (relocatable_output) /* Will need this again */
- --- 3891,3897 ----
-
- desc = file_open (entry);
-
- ! bytes = (char *) xmalloc (entry->header.a_data);
-
- if (entry->datarel) reloc = entry->datarel;
- else if (relocatable_output) /* Will need this again */
- ***************
- *** 3891,3897 ****
- }
- else
- {
- ! reloc = (struct relocation_info *) alloca (entry->header.a_drsize);
- lseek (desc, text_offset (entry) + entry->header.a_text
- + entry->header.a_data + entry->header.a_trsize,
- 0);
- --- 3901,3907 ----
- }
- else
- {
- ! reloc = (struct relocation_info *) xmalloc (entry->header.a_drsize);
- lseek (desc, text_offset (entry) + entry->header.a_text
- + entry->header.a_data + entry->header.a_trsize,
- 0);
- ***************
- *** 3907,3912 ****
- --- 3917,3926 ----
- entry->header.a_data, reloc, entry->header.a_drsize, entry);
-
- mywrite (bytes, 1, entry->header.a_data, outdesc);
- +
- + if (!entry->datarel)
- + free (reloc);
- + free (bytes);
- }
-
- /* Relocate ENTRY's text or data section contents.
- ***************
- *** 4290,4299 ****
- extra struct for each indirect symbol to hold the extra reference
- following. */
- struct nlist *buf
- ! = (struct nlist *) alloca ((defined_global_sym_count
- ! + undefined_global_sym_count
- ! + global_indirect_count)
- ! * sizeof (struct nlist));
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- --- 4304,4313 ----
- extra struct for each indirect symbol to hold the extra reference
- following. */
- struct nlist *buf
- ! = (struct nlist *) xmalloc ((defined_global_sym_count
- ! + undefined_global_sym_count
- ! + global_indirect_count)
- ! * sizeof (struct nlist));
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- ***************
- *** 4306,4312 ****
- string_table_len = strtab_size;
-
- if (strip_symbols == STRIP_ALL)
- ! return;
-
- /* Write the local symbols defined by the various files. */
-
- --- 4320,4329 ----
- string_table_len = strtab_size;
-
- if (strip_symbols == STRIP_ALL)
- ! {
- ! free (buf);
- ! return;
- ! }
-
- /* Write the local symbols defined by the various files. */
-
- ***************
- *** 4319,4328 ****
- table from the global symbols written so far. This must include
- extra space for the references following indirect outputs. */
-
- ! strtab_vector = (char **) alloca ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (char *));
- ! strtab_lens = (int *) alloca ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (int));
- strtab_index = 0;
-
- /* Scan the symbol hash table, bucket by bucket. */
- --- 4336,4345 ----
- table from the global symbols written so far. This must include
- extra space for the references following indirect outputs. */
-
- ! strtab_vector = (char **) xmalloc ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (char *));
- ! strtab_lens = (int *) xmalloc ((num_hash_tab_syms
- ! + global_indirect_count) * sizeof (int));
- strtab_index = 0;
-
- /* Scan the symbol hash table, bucket by bucket. */
- ***************
- *** 4436,4441 ****
- --- 4453,4462 ----
- /* Write the strings for the global symbols. */
-
- write_string_table ();
- +
- + free (strtab_lens);
- + free (strtab_vector);
- + free (buf);
- }
-
- /* Write the local and debugger symbols of file ENTRY.
- ***************
- *** 4455,4461 ****
- /* Buffer to accumulate all the syms before writing them.
- It has one extra slot for the local symbol we generate here. */
- struct nlist *buf
- ! = (struct nlist *) alloca (entry->header.a_syms + sizeof (struct nlist));
- register struct nlist *bufp = buf;
-
- /* Upper bound on number of syms to be written here. */
- --- 4476,4482 ----
- /* Buffer to accumulate all the syms before writing them.
- It has one extra slot for the local symbol we generate here. */
- struct nlist *buf
- ! = (struct nlist *) xmalloc (entry->header.a_syms + sizeof (struct nlist));
- register struct nlist *bufp = buf;
-
- /* Upper bound on number of syms to be written here. */
- ***************
- *** 4464,4471 ****
- /* Make tables that record, for each symbol, its name and its name's length.
- The elements are filled in by `assign_string_table_index'. */
-
- ! strtab_vector = (char **) alloca (max_syms * sizeof (char *));
- ! strtab_lens = (int *) alloca (max_syms * sizeof (int));
- strtab_index = 0;
-
- /* Generate a local symbol for the start of this file's text. */
- --- 4485,4492 ----
- /* Make tables that record, for each symbol, its name and its name's length.
- The elements are filled in by `assign_string_table_index'. */
-
- ! strtab_vector = (char **) xmalloc (max_syms * sizeof (char *));
- ! strtab_lens = (int *) xmalloc (max_syms * sizeof (int));
- strtab_index = 0;
-
- /* Generate a local symbol for the start of this file's text. */
- ***************
- *** 4486,4492 ****
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- for (; p < end; p++)
- --- 4507,4513 ----
-
- /* Read the file's string table. */
-
- ! entry->strings = (char *) xmalloc (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- for (; p < end; p++)
- ***************
- *** 4563,4569 ****
- using the data in vectors `strtab_vector' and `strtab_lens'. */
-
- write_string_table ();
- ! entry->strings = 0; /* Since it will dissapear anyway. */
- }
-
- /* Copy any GDB symbol segments from the input files to the output file.
- --- 4584,4595 ----
- using the data in vectors `strtab_vector' and `strtab_lens'. */
-
- write_string_table ();
- !
- ! free (entry->strings);
- ! entry->strings = 0;
- ! free (strtab_lens);
- ! free (strtab_vector);
- ! free (buf);
- }
-
- /* Copy any GDB symbol segments from the input files to the output file.
-