home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update29.zoo / util / diffs
Encoding:
Text File  |  1993-03-28  |  71.7 KB  |  2,891 lines

  1. ===================================================================
  2. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/Changelog,v
  3. retrieving revision 1.36
  4. diff -c -r1.36 Changelog
  5. *** 1.36    1992/11/08 00:29:27
  6. --- Changelog    1993/03/29 03:40:52
  7. ***************
  8. *** 391,393 ****
  9. --- 391,460 ----
  10.       add -fshare flag for sharex text (mint 0.96 and up).
  11.   
  12.   ----------------------------- Patchlevel 33 --------------------------------
  13. +     REMOVE the following files from this (utils) directory
  14. +     they have been moved to the include directory
  15. +     rm gnu-ar.h
  16. +     rm gnu-out.h
  17. +     rm stab.def
  18. +     rm stab.h
  19. + cnm.c: andreas
  20. +     New flag -u, print symbols unsorted
  21. +     Cleanups
  22. + cplusdem.c:: andreas
  23. +     Cleanups to sync up with Gnu
  24. + stab.def, stab.h:: andreas
  25. +     Cleanups to sync up with Gnu *********** NOTE moved to <include>
  26. + printstk.c  fixstk.c: andreas
  27. +     Allow more than one file name argument
  28. +     
  29. + strip.c:: andreas
  30. +     Preserve the file mode and long symbols,
  31. +      keep __stksize by default, new flag -a to strip
  32. +      really all symbols
  33. +     ****************************
  34. +     * NOTE: new flag -a        *
  35. +     ****************************
  36. + ld.c sym-ld.c:
  37. +     - Many cleanups
  38. +     - All large stack requirements removed
  39. +     [ allocas turned into xmalloc/frees should be much more
  40. +       MiNT freindlier!]
  41. +     - defaults changed! ************** NOTE *****************
  42. +     default prgflags == 7 now    /* fastload and TT ram */
  43. +     default symbol table type == gst_format symbols
  44. +     - new options    ******************* NEW OPTIONS**************
  45. +      -f load_flags
  46. +      -h heap size
  47. + nm.c:: andreas
  48. +     - turn alloca()s into xmalloc()s
  49. + printstk.c:: andreas
  50. +     cleanup
  51. +     make it handle long symbols properly
  52. + size68.c:: andreas
  53. +     cleanup
  54. + fixstk.c:: ++jrb
  55. +     was missing *argv in usage message
  56. + stab.def, stab.h:: ++jrb
  57. +     removed from util subdir. use the one in the include
  58. +     directory. the one in include has been brought upto date with
  59. +     all the cygnus changes.
  60. + ----------------------------- Patchlevel 35 --------------------------------
  61. ===================================================================
  62. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/PatchLev.h,v
  63. retrieving revision 1.31
  64. diff -c -r1.31 PatchLev.h
  65. *** 1.31    1992/11/08 00:29:27
  66. --- PatchLev.h    1993/03/29 03:40:54
  67. ***************
  68. *** 1,4 ****
  69. ! #define PatchLevel "33"
  70.   
  71.   /*
  72.    *    the Patch Level above is to identify the version
  73. --- 1,4 ----
  74. ! #define PatchLevel "35"
  75.   
  76.   /*
  77.    *    the Patch Level above is to identify the version
  78. ===================================================================
  79. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/cnm.c,v
  80. retrieving revision 1.8
  81. diff -c -r1.8 cnm.c
  82. *** 1.8    1992/10/11 02:39:24
  83. --- cnm.c    1993/03/29 03:40:56
  84. ***************
  85. *** 35,40 ****
  86. --- 35,41 ----
  87.   #include <compiler.h>
  88.   #include <stdio.h>
  89.   #include <st-out.h>
  90. + #include <stdlib.h>
  91.   
  92.   #if __STDC__
  93.   #include <stdlib.h>
  94. ***************
  95. *** 94,99 ****
  96. --- 95,101 ----
  97.   
  98.   
  99.   int gflag;
  100. + int uflag;
  101.   
  102.   int main(argc, argv)
  103.   int argc;
  104. ***************
  105. *** 102,113 ****
  106.       int c, status = 0;
  107.       extern char *optarg;
  108.       extern int optind;
  109. !     while ((c = getopt(argc, argv, "g")) != -1)
  110.       switch (c)
  111.       {
  112.         case 'g':
  113.           gflag = 1;
  114.           break;
  115.         case '?':
  116.           usage();
  117.       }
  118. --- 104,118 ----
  119.       int c, status = 0;
  120.       extern char *optarg;
  121.       extern int optind;
  122. !     while ((c = getopt(argc, argv, "gu")) != -1)
  123.       switch (c)
  124.       {
  125.         case 'g':
  126.           gflag = 1;
  127.           break;
  128. +       case 'u':
  129. +         uflag = 1;
  130. +         break;
  131.         case '?':
  132.           usage();
  133.       }
  134. ***************
  135. *** 123,129 ****
  136.   int  cmp(s1, s2)
  137.   struct xsym *s1, *s2;
  138.   {
  139. !     return(s1->value - s2->value);
  140.   }
  141.   
  142.   int doname(s, many)
  143. --- 128,135 ----
  144.   int  cmp(s1, s2)
  145.   struct xsym *s1, *s2;
  146.   {
  147. !   long diff = s1->value - s2->value;
  148. !   return (diff > 0) - (diff < 0);
  149.   }
  150.   
  151.   int doname(s, many)
  152. ***************
  153. *** 183,189 ****
  154.       }
  155.       fclose(fd);
  156.       printf("%ld %s symbol(s)\n", i, (gflag ? "global ": ""));
  157. !     qsort(syms, i, sizeof(struct xsym), cmp);
  158.       while (i--)
  159.       {
  160.           dosym(syms);
  161. --- 189,196 ----
  162.       }
  163.       fclose(fd);
  164.       printf("%ld %s symbol(s)\n", i, (gflag ? "global ": ""));
  165. !     if (!uflag)
  166. !       qsort(syms, i, sizeof(struct xsym), cmp);
  167.       while (i--)
  168.       {
  169.           dosym(syms);
  170. ===================================================================
  171. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/cplusdem.c,v
  172. retrieving revision 1.4
  173. diff -c -r1.4 cplusdem.c
  174. *** 1.4    1992/06/11 17:45:54
  175. --- cplusdem.c    1993/03/29 03:40:58
  176. ***************
  177. *** 148,154 ****
  178.     "co", "~",            /* ansi */
  179.     "call", "()",            /* old */
  180.     "cl", "()",            /* ansi */
  181. -   "cond", "?:",            /* old */
  182.     "alshift", "<<",        /* old */
  183.     "ls", "<<",            /* ansi */
  184.     "als", "<<=",            /* ansi */
  185. --- 148,153 ----
  186. ***************
  187. *** 235,240 ****
  188. --- 234,241 ----
  189.   {
  190.     int n = 0, success = 1;;
  191.     
  192. +   if (!isdigit (**type))
  193. +     return 0;
  194.     do
  195.       {
  196.         n *= 10;
  197. ***************
  198. *** 288,301 ****
  199.         /* virtual table "_vt$"  */
  200.         else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
  201.       {
  202. !       int n = strlen (type + 4) + 14 + 1;
  203. !       char *tem = (char *) xmalloc (n);
  204. !       strcpy (tem, type + 4);
  205. !       strcat (tem, " virtual table");
  206. !       return tem;
  207.       }
  208.         /* static data member */
  209. !       else if (type[0] == '_' && type[1] != '_' && (strchr (type, CPLUS_MARKER) != NULL))
  210.       {
  211.         static_type = 1;
  212.         p = type + 1;
  213. --- 289,327 ----
  214.         /* virtual table "_vt$"  */
  215.         else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
  216.       {
  217. !       if (isdigit (type[4]))
  218. !         {
  219. !           int n;
  220. !           string_init (&decl);
  221. !           type += 4;
  222. !           while (get_simple_count (&type, &n))
  223. !         {
  224. !           string_appendn (&decl, type, n);
  225. !           type += n;
  226. !           if (*type == '\0')
  227. !             {
  228. !               string_appendn (&decl, " virtual table", 15);
  229. !               return decl.b;
  230. !             }
  231. !           if (*type++ != CPLUS_MARKER)
  232. !             break;
  233. !           string_append (&decl, "::");
  234. !         }
  235. !           string_delete (&decl);
  236. !           return NULL;
  237. !         }
  238. !       else
  239. !         {
  240. !           int n = strlen (type + 4) + 14 + 1;
  241. !           char *tem = (char *) xmalloc (n);
  242. !           strcpy (tem, type + 4);
  243. !           strcat (tem, " virtual table");
  244. !           return tem;
  245. !         }
  246.       }
  247.         /* static data member */
  248. !       else if (type[0] == '_' && strchr ("0123456789Qt", type[1]) != NULL
  249. !            && strchr (type, CPLUS_MARKER) != NULL)
  250.       {
  251.         static_type = 1;
  252.         p = type + 1;
  253. ***************
  254. *** 345,351 ****
  255.     else
  256.       {
  257.         string_appendn (&decl, type, p - type);
  258. !       decl.p[0] = '0';
  259.         munge_function_name (&decl);
  260.         p += 2;
  261.       }
  262. --- 371,377 ----
  263.     else
  264.       {
  265.         string_appendn (&decl, type, p - type);
  266. !       decl.p[0] = '\0';
  267.         munge_function_name (&decl);
  268.         p += 2;
  269.       }
  270. ***************
  271. *** 451,456 ****
  272. --- 477,484 ----
  273.           string_delete (&trawname);
  274.           break;
  275.         }
  276. +     if (tname.p[-1] == '>')
  277. +       string_append (&tname, " ");
  278.       string_append (&tname, ">::");
  279.       if (destructor)
  280.         string_append(&tname, "~");
  281. ***************
  282. *** 556,573 ****
  283.         int member;
  284.         switch (**type)
  285.       {
  286. -     case 'Q':
  287. -       n = (*type)[1] - '0';
  288. -       if (n < 0 || n > 9)
  289. -         {
  290. -           success = 0;
  291. -           break;
  292. -         }
  293. -       *type += 2;
  294. -       while (n-- > 0)
  295. -         do_type (type, result);
  296. -       break;
  297.       case 'P':
  298.         *type += 1;
  299.         string_prepend (&decl, "*");
  300. --- 584,589 ----
  301. ***************
  302. *** 610,630 ****
  303.   
  304.           member = **type == 'M';
  305.           *type += 1;
  306. !         if (!isdigit (**type))
  307. !           {
  308. !         success = 0;
  309. !         break;
  310. !           }
  311. !         n = 0;
  312. !         do
  313.             {
  314. -         n *= 10;
  315. -         n += **type - '0';
  316. -         *type += 1;
  317. -           } 
  318. -         while (isdigit (**type));
  319. -         if (strlen (*type) < n)
  320. -           {
  321.           success = 0;
  322.           break;
  323.             }
  324. --- 626,633 ----
  325.   
  326.           member = **type == 'M';
  327.           *type += 1;
  328. !         if (!get_simple_count (type, &n))
  329.             {
  330.           success = 0;
  331.           break;
  332.             }
  333. ***************
  334. *** 747,752 ****
  335. --- 750,763 ----
  336.           *non_empty = 1;
  337.         string_append (result, "unsigned");
  338.         break;
  339. +     case 'S':
  340. +       *type += 1;
  341. +       if (*non_empty)
  342. +         string_append (result, " ");
  343. +       else
  344. +         *non_empty = 1;
  345. +       string_append (result, "signed");
  346. +       break;
  347.       case 'V':
  348.         *type += 1;
  349.         if (*non_empty)
  350. ***************
  351. *** 813,818 ****
  352. --- 824,835 ----
  353.       string_append (result, " ");
  354.         string_append (result, "char");
  355.         break;
  356. +     case 'w':
  357. +       *type += 1;
  358. +       if (*non_empty)
  359. +     string_append (result, " ");
  360. +       string_append (result, "wchar_t");
  361. +       break;
  362.       case 'r':
  363.         *type += 1;
  364.         if (*non_empty)
  365. ***************
  366. *** 883,890 ****
  367.         if (!do_template_args (type, result))
  368.       success = 0;
  369.         else
  370. !     string_append (result, ">");
  371.         break;
  372.       default:
  373.         success = 0;
  374.         break;
  375. --- 900,945 ----
  376.         if (!do_template_args (type, result))
  377.       success = 0;
  378.         else
  379. !     {
  380. !       if (result->p[-1] == '>')
  381. !         string_append (result, " ");
  382. !       string_append (result, ">");
  383. !     }
  384. !       break;
  385. !     case 'Q':
  386. !       n = (*type)[1] - '0';
  387. !       if (n < 0 || n > 9)
  388. !     {
  389. !       success = 0;
  390. !       break;
  391. !     }
  392. !       *type += 2;
  393. !       if (n > 0)
  394. !     {
  395. !       string temp;
  396. !       if (!do_type (type, &temp))
  397. !         {
  398. !           success = 0;
  399. !           break;
  400. !         }
  401. !       if (*non_empty)
  402. !         string_append (result, " ");
  403. !       string_appends (result, &temp);
  404. !       string_delete (&temp);
  405. !       while (--n > 0)
  406. !         {
  407. !           if (!do_type (type, &temp))
  408. !         {
  409. !           success = 0;
  410. !           break;
  411. !         }
  412. !           string_append (result, "::");
  413. !           string_appends (result, &temp);
  414. !           string_delete (&temp);
  415. !         }
  416. !     }
  417.         break;
  418. +       
  419.       default:
  420.         success = 0;
  421.         break;
  422. ***************
  423. *** 916,922 ****
  424.       {
  425.         *type += 1;
  426.   
  427. !       success = do_type (type, &temp);
  428.         if (success)
  429.           string_appends (result, &temp);
  430.         string_delete(&temp);
  431. --- 971,977 ----
  432.       {
  433.         *type += 1;
  434.   
  435. !       success = do_arg (type, &temp);
  436.         if (success)
  437.           string_appends (result, &temp);
  438.         string_delete(&temp);
  439. ***************
  440. *** 932,938 ****
  441.         int is_integral = 0;
  442.         int done = 0;
  443.   
  444. !       success = do_type (type, &temp);
  445.         if (success)
  446.           string_appends (result, &temp);
  447.         string_delete(&temp);
  448. --- 987,993 ----
  449.         int is_integral = 0;
  450.         int done = 0;
  451.   
  452. !       success = do_arg (type, &temp);
  453.         if (success)
  454.           string_appends (result, &temp);
  455.         string_delete(&temp);
  456. ***************
  457. *** 967,972 ****
  458. --- 1022,1028 ----
  459.           case 'i':    /* int */
  460.           case 's':    /* short */
  461.           case 'c':    /* char */
  462. +         case 'w': /* wchar_t */
  463.             done = is_integral = 1;
  464.             break;
  465.           case 'r':    /* long double */
  466. ===================================================================
  467. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/fixstk.c,v
  468. retrieving revision 1.6
  469. diff -c -r1.6 fixstk.c
  470. *** 1.6    1992/07/21 14:52:06
  471. --- fixstk.c    1993/03/29 03:40:59
  472. ***************
  473. *** 38,43 ****
  474. --- 38,45 ----
  475.   # define SYM_OFFSET   (sizeof(short) + (3*sizeof(long)))
  476.   #endif
  477.   
  478. + int error = 0;
  479. + long newstksize;
  480.   
  481.   static char *sym_names[] = { "__stksize", "__initial_stack" };
  482.   
  483. ***************
  484. *** 48,56 ****
  485.   {
  486.       struct aexec head;
  487.       struct asym  sym;
  488. -     int found;
  489.       int    all = 0;
  490.       int index = 1;
  491.       
  492.   #ifndef WORD_ALIGNED
  493.       if(read(fd, &head, sizeof(head)) != sizeof(head))
  494. --- 50,62 ----
  495.   {
  496.       struct aexec head;
  497.       struct asym  sym;
  498.       int    all = 0;
  499.       int index = 1;
  500. + #ifndef WORD_ALIGNED
  501. +     char extension[sizeof (struct asym)];
  502. + #else
  503. +     char extension[SIZEOF_ASYM];
  504. + #endif
  505.       
  506.   #ifndef WORD_ALIGNED
  507.       if(read(fd, &head, sizeof(head)) != sizeof(head))
  508. ***************
  509. *** 59,75 ****
  510.   #endif
  511.       {
  512.       perror(fn);
  513. !     exit(2);
  514.       }
  515.       if(head.a_magic != CMAGIC)
  516.       {
  517. !     fprintf(stderr,"Invalid magic number %x\n", head.a_magic);
  518. !     exit(3);
  519.       }
  520.       if(head.a_syms == 0)
  521.       {
  522.       fprintf(stderr,"%s: no symbol table\n", fn);
  523. !     exit(4);
  524.       }
  525.       if(lseek(fd, head.a_text+head.a_data, 1) != 
  526.   #ifndef WORD_ALIGNED
  527. --- 65,81 ----
  528.   #endif
  529.       {
  530.       perror(fn);
  531. !     return -1;
  532.       }
  533.       if(head.a_magic != CMAGIC)
  534.       {
  535. !     fprintf(stderr,"%s: invalid magic number %x\n", fn, head.a_magic);
  536. !     return -1;
  537.       }
  538.       if(head.a_syms == 0)
  539.       {
  540.       fprintf(stderr,"%s: no symbol table\n", fn);
  541. !     return -1;
  542.       }
  543.       if(lseek(fd, head.a_text+head.a_data, 1) != 
  544.   #ifndef WORD_ALIGNED
  545. ***************
  546. *** 79,85 ****
  547.   #endif
  548.       {
  549.       perror(fn);
  550. !     exit(5);
  551.       }
  552.       for(;;)
  553.       {
  554. --- 85,91 ----
  555.   #endif
  556.       {
  557.       perror(fn);
  558. !     return -1;
  559.       }
  560.       for(;;)
  561.       {
  562. ***************
  563. *** 89,111 ****
  564.       if(index && read_sym(fd, &sym))
  565.   #endif
  566.       {
  567. !         fprintf(stderr, "symbol _stksize not found\n");
  568. !         exit(6);
  569.       }
  570.       /* after symbol read check first for _stksize */
  571.       index ^= 1;
  572.       if (strncmp(sym_names[index], sym.a_name, 8) == 0)
  573.       {
  574. !         if ((found = (sym.a_type & A_DATA)) || all++)
  575. !         break;
  576.       }
  577.       }
  578.       
  579. -     if(!found)
  580. -     {
  581. -     fprintf(stderr, "symbol _stksize is undefined\n");
  582. -     exit(9);
  583. -     }
  584.       *what = index;
  585.   #ifndef WORD_ALIGNED
  586.       return sym.a_value + sizeof(head);
  587. --- 95,126 ----
  588.       if(index && read_sym(fd, &sym))
  589.   #endif
  590.       {
  591. !         fprintf(stderr, "%s: symbol _stksize not found\n", fn);
  592. !         return -1;
  593.       }
  594. +     if (index && (sym.a_type & A_LNAM) == A_LNAM)
  595. +       if (read (fd, extension, sizeof (extension)) != sizeof (extension))
  596. +         {
  597. +           fprintf (stderr, "%s: symbol _stksize not found\n", fn);
  598. +           return -1;
  599. +         }
  600.       /* after symbol read check first for _stksize */
  601.       index ^= 1;
  602.       if (strncmp(sym_names[index], sym.a_name, 8) == 0)
  603.       {
  604. !       if ((sym.a_type & A_LNAM) == A_LNAM
  605. !           && strncmp (sym_names[index] + 8, extension, sizeof (extension)))
  606. !         continue;
  607. !       if (sym.a_type & A_DATA)
  608. !         break;
  609. !       if (all++)
  610. !         {
  611. !           fprintf (stderr, "%s: symbol _stksize is undefined\n", fn);
  612. !           return -1;
  613. !         }
  614.       }
  615.       }
  616.       
  617.       *what = index;
  618.   #ifndef WORD_ALIGNED
  619.       return sym.a_value + sizeof(head);
  620. ***************
  621. *** 141,177 ****
  622.   int argc;
  623.   char **argv;
  624.   {
  625. !     int fd;
  626. !     int what;
  627. !     long newstksize, stksize, offset;
  628. !     char sizestr[16], fn[FILENAME_MAX];
  629. !     
  630. !     if(argc < 2)
  631.       {
  632. !     fprintf(stderr, "usage: fixstk size [<filename>]\n");
  633. !     exit(1);
  634.       }
  635. !     strcpy(sizestr, *++argv);
  636.   
  637. !     if(argc > 2)
  638. !     (void) strcpy(fn, *++argv);
  639. !     else
  640. !     (void) strcpy(fn, "gcc-cc1.ttp");
  641.   
  642.       if((fd = open(fn, 2)) < 0)
  643.       {
  644.       perror(fn);
  645. !     exit(1);
  646.       }
  647.       
  648. -     newstksize = calc_newsize(sizestr);
  649.       offset = find_offset(fd, fn, &what);
  650.       if(lseek(fd, offset, 0) != offset)
  651.       {
  652.       perror(fn);
  653.       close(fd);
  654. !     exit(7);
  655.       }
  656.       read(fd, &stksize, sizeof(long));
  657.       printf("%s: %s was %ld (%dK)\n",
  658. --- 156,199 ----
  659.   int argc;
  660.   char **argv;
  661.   {
  662. !   if (argc < 3)
  663.       {
  664. !       fprintf (stderr, "Usage: %s size file...\n", *argv);
  665. !       exit (1);
  666.       }
  667. !   newstksize = calc_newsize (*++argv);
  668. !   --argc;
  669. !   while (--argc)
  670. !     error |= fix_stack (*++argv);
  671. !   exit (error);
  672. ! }
  673.   
  674. ! int
  675. ! fix_stack (fn)
  676. !      char *fn;
  677. ! {
  678. !     int fd;
  679. !     int what;
  680. !     long stksize, offset;
  681.   
  682.       if((fd = open(fn, 2)) < 0)
  683.       {
  684.       perror(fn);
  685. !     return 1;
  686.       }
  687.       
  688.       offset = find_offset(fd, fn, &what);
  689. +     if (offset < 0)
  690. +       {
  691. +     close (fd);
  692. +     return 1;
  693. +       }
  694.       if(lseek(fd, offset, 0) != offset)
  695.       {
  696.       perror(fn);
  697.       close(fd);
  698. !     return 1;
  699.       }
  700.       read(fd, &stksize, sizeof(long));
  701.       printf("%s: %s was %ld (%dK)\n",
  702. ***************
  703. *** 183,189 ****
  704.       {
  705.       perror(fn);
  706.       close(fd);
  707. !     exit(8);
  708.       }
  709.       
  710.       lseek(fd, -((long)sizeof(long)), 1);
  711. --- 205,211 ----
  712.       {
  713.       perror(fn);
  714.       close(fd);
  715. !     return 1;
  716.       }
  717.       
  718.       lseek(fd, -((long)sizeof(long)), 1);
  719. ***************
  720. *** 191,197 ****
  721.       read(fd, &stksize, sizeof(long));
  722.       printf("%s: %s now is %ld (%dK)\n",
  723.            fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
  724. !     return close(fd);
  725.   }
  726.   
  727.   #ifdef WORD_ALIGNED
  728. --- 213,219 ----
  729.       read(fd, &stksize, sizeof(long));
  730.       printf("%s: %s now is %ld (%dK)\n",
  731.            fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
  732. !     return close(fd) != 0;
  733.   }
  734.   
  735.   #ifdef WORD_ALIGNED
  736. ===================================================================
  737. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/ld.c,v
  738. retrieving revision 1.41
  739. diff -c -r1.41 ld.c
  740. *** 1.41    1992/11/08 00:29:27
  741. --- ld.c    1993/03/29 03:41:02
  742. ***************
  743. *** 132,142 ****
  744.   /* Determine whether we should attempt to handle (minimally)
  745.      N_BINCL and N_EINCL.  */
  746.   
  747. - #if (!(defined(atarist) || defined(atariminix) || defined(CROSSATARI)))
  748.   #if defined (__GNU_STAB__) || defined (N_BINCL)
  749.   #define HAVE_SUN_STABS
  750.   #endif
  751. - #endif
  752.   
  753.   #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  754.   /* stuff used when emitting reloc info here */
  755. --- 132,140 ----
  756. ***************
  757. *** 151,160 ****
  758. --- 149,160 ----
  759.   int rbuf_size = 0;        /* how many bytes are in there now */
  760.   long rbuf_last_pc = -1;        /* last rel pc; -1 means none yet */
  761.   
  762. + #if 0                /* all big alloca's changed to xmalloc */
  763.   #ifdef atarist        /* and a stack */
  764.   long _stksize = -1L;
  765.   #endif
  766.   #endif
  767. + #endif
  768.   
  769.   #ifdef min
  770.   #undef min
  771. ***************
  772. *** 259,265 ****
  773.   #ifdef i386
  774.   #define INITIALIZE_HEADER outheader.a_machtype = M_386
  775.   #endif
  776. ! #endif /* CROSSATARAI */
  777.   
  778.   #ifdef is68k
  779.   /* This enables code to take care of an ugly hack in the ISI OS.
  780. --- 259,265 ----
  781.   #ifdef i386
  782.   #define INITIALIZE_HEADER outheader.a_machtype = M_386
  783.   #endif
  784. ! #endif /* CROSSATARI */
  785.   
  786.   #ifdef is68k
  787.   /* This enables code to take care of an ugly hack in the ISI OS.
  788. ***************
  789. *** 447,453 ****
  790.   
  791.      The address of the set is made into an N_SETV symbol
  792.      whose name is the same as the name of the set.
  793. !    This symbol acts like a N_DATA global symbol
  794.      in that it can satisfy undefined external references.
  795.   
  796.      For the purposes of determining whether or not to load in a library
  797. --- 447,453 ----
  798.   
  799.      The address of the set is made into an N_SETV symbol
  800.      whose name is the same as the name of the set.
  801. !    This symbol acts like a N_TEXT global symbol
  802.      in that it can satisfy undefined external references.
  803.   
  804.      For the purposes of determining whether or not to load in a library
  805. ***************
  806. *** 890,895 ****
  807. --- 890,901 ----
  808.   void do_write_minix_out();
  809.   #endif
  810.   
  811. + #if defined (atarist) || defined (CROSSATARI)
  812. + /* atari special, specify load flags and head size */
  813. + int atari_load_flags;
  814. + int atari_heap_size;
  815. + #endif
  816.   /* Standard directories to search for files specified by -l.  */
  817.   #ifdef atarist
  818.   char *standard_search_dirs[] = {"\\gnu\\lib", "\\gnu"};
  819. ***************
  820. *** 1096,1106 ****
  821.     /* Initialize the data about options.  */
  822.   
  823.   #if defined(atarist) || defined(CROSSATARI)
  824. !   gst_symboltable = 0;
  825.     gst_symbols = 0;
  826.   #endif
  827.     specified_data_size = 0;
  828.     strip_symbols = STRIP_NONE;
  829.     trace_files = 0;
  830.     discard_locals = DISCARD_NONE;
  831.     entry_symbol = 0;
  832. --- 1102,1118 ----
  833.     /* Initialize the data about options.  */
  834.   
  835.   #if defined(atarist) || defined(CROSSATARI)
  836. !   gst_symboltable = 1;
  837.     gst_symbols = 0;
  838. +   atari_load_flags = 7;        /* fastload / tt ram is the default */
  839. +   atari_heap_size = 0;
  840.   #endif
  841.     specified_data_size = 0;
  842. + #ifdef atarist
  843. +   strip_symbols = STRIP_DEBUGGER;
  844. + #else
  845.     strip_symbols = STRIP_NONE;
  846. + #endif
  847.     trace_files = 0;
  848.     discard_locals = DISCARD_NONE;
  849.     entry_symbol = 0;
  850. ***************
  851. *** 1164,1174 ****
  852.     outheader.a_magic = magic;
  853.   #endif
  854.   
  855. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  856.   #ifdef INITIALIZE_HEADER
  857.     INITIALIZE_HEADER;
  858.   #endif
  859. - #endif
  860.   
  861.   #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  862.     text_size = sizeof (struct aexec);
  863. --- 1176,1184 ----
  864. ***************
  865. *** 1255,1260 ****
  866. --- 1265,1274 ----
  867.       case 'o':
  868.       case 'u':
  869.       case 'y':
  870. + #if defined (atarist) || defined (CROSSATARI)
  871. +     case 'f':
  872. +     case 'h':
  873. + #endif
  874.         if (arg[2])
  875.       return 1;
  876.         return 2;
  877. ***************
  878. *** 1618,1623 ****
  879. --- 1632,1653 ----
  880.       case 'G':
  881.         gst_symboltable = 1;
  882.         return;
  883. +     case 'f':
  884. +       atari_load_flags = parse (arg, "%i", "invalid argument to -f");
  885. +       return;
  886. +     case 'h':
  887. +       {
  888. +     int heapsize_specified = parse (arg, "%i", "invalid argument to -h");
  889. +     if (heapsize_specified >= 0 && heapsize_specified < 16)
  890. +       atari_heap_size = heapsize_specified;
  891. +     else if (heapsize_specified >= 128 && heapsize_specified <= 16 * 128)
  892. +       atari_heap_size = (heapsize_specified - 128) / 128;
  893. +     else
  894. +       fatal ("invalid heap size", 0);
  895. +       }
  896. +       return;
  897.   #endif
  898.   
  899.       case 'l':
  900. ***************
  901. *** 2113,2121 ****
  902.     if (!N_BADMAG (*((struct exec *)&magicnum)))
  903.       {
  904.         read_entry_symbols (desc, entry);
  905. !       entry->strings = (char *) alloca (entry->string_size);
  906.         read_entry_strings (desc, entry);
  907.         enter_file_symbols (entry);
  908.         entry->strings = 0;
  909.       }
  910.     else
  911. --- 2143,2152 ----
  912.     if (!N_BADMAG (*((struct exec *)&magicnum)))
  913.       {
  914.         read_entry_symbols (desc, entry);
  915. !       entry->strings = (char *) xmalloc (entry->string_size);
  916.         read_entry_strings (desc, entry);
  917.         enter_file_symbols (entry);
  918. +       free (entry->strings);
  919.         entry->strings = 0;
  920.       }
  921.     else
  922. ***************
  923. *** 2697,2703 ****
  924.                + symdef_base[i].symbol_name_string_index,
  925.                entry->filename);
  926.           read_entry_symbols (desc, subentry);
  927. !         subentry->strings = (char *) malloc (subentry->string_size);
  928.           read_entry_strings (desc, subentry);
  929.   
  930.           /* Now scan the symbol table and decide whether to load.  */
  931. --- 2728,2734 ----
  932.                + symdef_base[i].symbol_name_string_index,
  933.                entry->filename);
  934.           read_entry_symbols (desc, subentry);
  935. !         subentry->strings = (char *) xmalloc (subentry->string_size);
  936.           read_entry_strings (desc, subentry);
  937.   
  938.           /* Now scan the symbol table and decide whether to load.  */
  939. ***************
  940. *** 2764,2775 ****
  941.         if (!subentry) return;
  942.   
  943.         read_entry_symbols (desc, subentry);
  944. !       subentry->strings = (char *) alloca (subentry->string_size);
  945.         read_entry_strings (desc, subentry);
  946.   
  947.         if (!subfile_wanted_p (subentry))
  948.       {
  949.         free (subentry->symbols);
  950.         free (subentry);
  951.       }
  952.         else
  953. --- 2795,2807 ----
  954.         if (!subentry) return;
  955.   
  956.         read_entry_symbols (desc, subentry);
  957. !       subentry->strings = (char *) xmalloc (subentry->string_size);
  958.         read_entry_strings (desc, subentry);
  959.   
  960.         if (!subfile_wanted_p (subentry))
  961.       {
  962.         free (subentry->symbols);
  963. +       free (subentry->strings);
  964.         free (subentry);
  965.       }
  966.         else
  967. ***************
  968. *** 2781,2787 ****
  969.         else
  970.               entry->subfiles = subentry;
  971.         prev = subentry;
  972. !           subentry->strings = 0; /* Since space will dissapear on return */
  973.       }
  974.   
  975.         this_subfile_offset += member_length + sizeof (struct ar_hdr);
  976. --- 2813,2820 ----
  977.         else
  978.               entry->subfiles = subentry;
  979.         prev = subentry;
  980. !       free (subentry->strings);
  981. !           subentry->strings = 0;
  982.       }
  983.   
  984.         this_subfile_offset += member_length + sizeof (struct ar_hdr);
  985. ***************
  986. *** 3073,3079 ****
  987. --- 3106,3116 ----
  988.           {
  989.             if (!relocatable_output || force_common_definition)
  990.           {
  991. + #ifdef atarist
  992. +           com = (com + sizeof (short) - 1) & (- sizeof (short));
  993. + #else
  994.             com = (com + sizeof (int) - 1) & (- sizeof (int));
  995. + #endif
  996.   
  997.             sp->value = data_start + data_size + bss_size;
  998.             sp->defined = N_BSS | N_EXT;
  999. ***************
  1000. *** 3133,3138 ****
  1001. --- 3170,3176 ----
  1002.   
  1003.     /* Figure the data_pad now, so that it overlaps with the bss addresses.  */
  1004.   
  1005. + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1006.     if (specified_data_size && specified_data_size > data_size)
  1007.       data_pad = specified_data_size - data_size;
  1008.   
  1009. ***************
  1010. *** 3144,3149 ****
  1011. --- 3182,3188 ----
  1012.     if (bss_size < 0) bss_size = 0;
  1013.   
  1014.     data_size += data_pad;
  1015. + #endif
  1016.   }
  1017.   
  1018.   /* Accumulate the section sizes of input file ENTRY
  1019. ***************
  1020. *** 3212,3222 ****
  1021.       switch (type)
  1022.         {
  1023.         case N_TEXT:
  1024.         case N_SETT:
  1025.           p->n_value += entry->text_start_address;
  1026.           break;
  1027.         case N_DATA:
  1028. -       case N_SETV:
  1029.         case N_SETD:
  1030.           /* A symbol whose value is in the data section
  1031.              is present in the input file as if the data section
  1032. --- 3251,3261 ----
  1033.       switch (type)
  1034.         {
  1035.         case N_TEXT:
  1036. +       case N_SETV:
  1037.         case N_SETT:
  1038.           p->n_value += entry->text_start_address;
  1039.           break;
  1040.         case N_DATA:
  1041.         case N_SETD:
  1042.           /* A symbol whose value is in the data section
  1043.              is present in the input file as if the data section
  1044. ***************
  1045. *** 3297,3303 ****
  1046.   {
  1047.     register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
  1048.   
  1049. !   entry->strings = (char *) alloca (entry->string_size);
  1050.     read_entry_strings (file_open (entry), entry);
  1051.   
  1052.     fprintf (outfile, "\nLocal symbols of ");
  1053. --- 3336,3342 ----
  1054.   {
  1055.     register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
  1056.   
  1057. !   entry->strings = (char *) xmalloc (entry->string_size);
  1058.     read_entry_strings (file_open (entry), entry);
  1059.   
  1060.     fprintf (outfile, "\nLocal symbols of ");
  1061. ***************
  1062. *** 3319,3324 ****
  1063. --- 3358,3364 ----
  1064.       free(nm);
  1065.         }
  1066.   
  1067. +   free (entry->strings);
  1068.     entry->strings = 0;        /* All done with them.  */
  1069.   }
  1070.   
  1071. ***************
  1072. *** 3361,3367 ****
  1073.       {
  1074.         FILE *desc;
  1075.   
  1076. !       entry->strings = (char *) alloca (entry->string_size);
  1077.         desc = file_open (entry);
  1078.         read_entry_strings (desc, entry);
  1079.       }
  1080. --- 3401,3407 ----
  1081.       {
  1082.         FILE *desc;
  1083.   
  1084. !       entry->strings = (char *) xmalloc (entry->string_size);
  1085.         desc = file_open (entry);
  1086.         read_entry_strings (desc, entry);
  1087.       }
  1088. ***************
  1089. *** 3573,3578 ****
  1090. --- 3613,3619 ----
  1091.         }
  1092.     }
  1093.   
  1094. +   free (entry->strings);
  1095.     entry->strings = 0;
  1096.   }
  1097.   /*
  1098. ***************
  1099. *** 3969,3977 ****
  1100.   #else 
  1101.     /* TOS */
  1102.     outheader.a_AZero1 = 0;        /* good a place as any to do this */
  1103. !   outheader.a_ldflgs = 0;        /* fastload is NOT the default */
  1104.     if (magic == NMAGIC)
  1105. !     outheader.a_ldflgs = F_SHTEXT;    /* sharable text */
  1106.     outheader.a_isreloc = ISRELOCINFO;    /* means reloc present (!) */
  1107.   #endif
  1108.   #endif
  1109. --- 4010,4018 ----
  1110.   #else 
  1111.     /* TOS */
  1112.     outheader.a_AZero1 = 0;        /* good a place as any to do this */
  1113. !   outheader.a_ldflgs = atari_load_flags | (atari_heap_size << 28);
  1114.     if (magic == NMAGIC)
  1115. !     outheader.a_ldflgs |= F_SHTEXT;    /* sharable text */
  1116.     outheader.a_isreloc = ISRELOCINFO;    /* means reloc present (!) */
  1117.   #endif
  1118.   #endif
  1119. ***************
  1120. *** 4036,4046 ****
  1121.       }
  1122.   #endif
  1123.   
  1124. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1125.   #ifdef INITIALIZE_HEADER
  1126.     INITIALIZE_HEADER;
  1127.   #endif
  1128. - #endif
  1129.   
  1130.     if (strip_symbols == STRIP_ALL)
  1131.       nsyms = 0;
  1132. --- 4077,4085 ----
  1133. ***************
  1134. *** 4176,4182 ****
  1135. --- 4215,4223 ----
  1136.     if (trace_files)
  1137.       fprintf (stderr, "\n");
  1138.   
  1139. + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1140.     padfile (text_pad, outdesc);
  1141. + #endif
  1142.   }
  1143.   
  1144.   int
  1145. ***************
  1146. *** 4253,4259 ****
  1147.   
  1148.     /* Allocate space for the file's text section */
  1149.   
  1150. !   bytes = (char *) alloca (entry->header.a_text);
  1151.   
  1152.     /* Deal with relocation information however is appropriate */
  1153.   
  1154. --- 4294,4300 ----
  1155.   
  1156.     /* Allocate space for the file's text section */
  1157.   
  1158. !   bytes = (char *) xmalloc (entry->header.a_text);
  1159.   
  1160.     /* Deal with relocation information however is appropriate */
  1161.   
  1162. ***************
  1163. *** 4290,4295 ****
  1164. --- 4331,4339 ----
  1165.     /* Write the relocated text to the output file.  */
  1166.   
  1167.     mywrite (bytes, 1, entry->header.a_text, outdesc);
  1168. +   /* Free the space for the text segment.  */
  1169. +   free (bytes);
  1170.   }
  1171.   
  1172.   /* Relocate the data segment of each input file
  1173. ***************
  1174. *** 4307,4313 ****
  1175. --- 4351,4359 ----
  1176.     if (trace_files)
  1177.       fprintf (stderr, "\n");
  1178.   
  1179. + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1180.     padfile (data_pad, outdesc);
  1181. + #endif
  1182.   }
  1183.   
  1184.   /* Read the data segment contents of ENTRY, relocate them,
  1185. ***************
  1186. *** 4328,4334 ****
  1187.   
  1188.     desc = file_open (entry);
  1189.   
  1190. !   bytes = (char *) alloca (entry->header.a_data);
  1191.   
  1192.     if (entry->datarel) reloc = entry->datarel;
  1193.   #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  1194. --- 4374,4380 ----
  1195.   
  1196.     desc = file_open (entry);
  1197.   
  1198. !   bytes = (char *) xmalloc (entry->header.a_data);
  1199.   
  1200.     if (entry->datarel) reloc = entry->datarel;
  1201.   #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  1202. ***************
  1203. *** 4359,4364 ****
  1204. --- 4405,4412 ----
  1205.                 entry, 0);
  1206.   
  1207.     mywrite (bytes, 1, entry->header.a_data, outdesc);
  1208. +   free (bytes);
  1209.   }
  1210.   
  1211.   static symbol *
  1212. ***************
  1213. *** 4431,4436 ****
  1214. --- 4479,4485 ----
  1215.     int data_relocation = entry->data_start_address - entry->header.a_text;
  1216.     int bss_relocation
  1217.       = entry->bss_start_address - entry->header.a_text - entry->header.a_data;
  1218. +   int text_overflow = entry->header.a_text & ~65535;
  1219.   
  1220.     for (; p < end; p++)
  1221.       {
  1222. ***************
  1223. *** 4535,4541 ****
  1224.           if (RELOC_PCREL_P(p)||RELOC_EXTERN_P(p))
  1225.             word = *(short *) (data + addr);
  1226.           else
  1227. !           word = *(unsigned short *) (data + addr);
  1228.   #ifdef BYTE_SWAP
  1229.           word = SWAP2(word);
  1230.   #endif
  1231. --- 4584,4590 ----
  1232.           if (RELOC_PCREL_P(p)||RELOC_EXTERN_P(p))
  1233.             word = *(short *) (data + addr);
  1234.           else
  1235. !           word = *(unsigned short *) (data + addr) + text_overflow;
  1236.   #ifdef BYTE_SWAP
  1237.           word = SWAP2(word);
  1238.   #endif
  1239. ***************
  1240. *** 4544,4550 ****
  1241.         if (relocation > 32767 || relocation < -32768) {
  1242.           if (!RELOC_EXTERN_P(p))
  1243.             if (!entry->strings) {
  1244. !         entry->strings = (char *) alloca (entry->string_size);
  1245.           read_entry_strings (file_open (entry), entry);
  1246.             }
  1247.           error ("fatal error: relocation out of range for %s in %s",
  1248. --- 4593,4599 ----
  1249.         if (relocation > 32767 || relocation < -32768) {
  1250.           if (!RELOC_EXTERN_P(p))
  1251.             if (!entry->strings) {
  1252. !         entry->strings = (char *) xmalloc (entry->string_size);
  1253.           read_entry_strings (file_open (entry), entry);
  1254.             }
  1255.           error ("fatal error: relocation out of range for %s in %s",
  1256. ***************
  1257. *** 4586,4592 ****
  1258.         if (pure_text && relocation > text_size+text_start) {
  1259.           if (!RELOC_EXTERN_P(p))
  1260.             if (!entry->strings) {
  1261. !         entry->strings = (char *) alloca (entry->string_size);
  1262.           read_entry_strings (file_open (entry), entry);
  1263.             }
  1264.           error ("absolute reference to %s from pure-text in %s",
  1265. --- 4635,4641 ----
  1266.         if (pure_text && relocation > text_size+text_start) {
  1267.           if (!RELOC_EXTERN_P(p))
  1268.             if (!entry->strings) {
  1269. !         entry->strings = (char *) xmalloc (entry->string_size);
  1270.           read_entry_strings (file_open (entry), entry);
  1271.             }
  1272.           error ("absolute reference to %s from pure-text in %s",
  1273. ***************
  1274. *** 4629,4634 ****
  1275. --- 4678,4685 ----
  1276.   }
  1277.   #endif /* BYTE_SWAP */
  1278.       }
  1279. +     if (entry->strings)
  1280. +       free (entry->strings);
  1281.       entry->strings = 0;
  1282.   }
  1283.   
  1284. ***************
  1285. *** 4777,4782 ****
  1286. --- 4828,4834 ----
  1287.       reloc_less_p);
  1288.     for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
  1289.       if ((entry->textrel[reloc_num].r_length == 2) &&
  1290. +         !entry->textrel[reloc_num].r_pcrel &&
  1291.         !emit_atari_reloc(entry->textrel[reloc_num].r_address + text_base))
  1292.           fprintf(stderr, "  while processing text rel %d/%d of entry %s\n",
  1293.           reloc_num, n_relocs, entry->filename);
  1294. ***************
  1295. *** 4792,4797 ****
  1296. --- 4844,4851 ----
  1297.     qsort(entry->datarel, n_relocs, sizeof (struct relocation_info), 
  1298.       reloc_less_p);
  1299.     for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
  1300. +     if (entry->datarel[reloc_num].r_length == 2
  1301. +     && !entry->datarel[reloc_num].r_pcrel)
  1302.       if (!emit_atari_reloc(entry->datarel[reloc_num].r_address + data_base))
  1303.           fprintf(stderr, "  while processing data rel %d/%d of entry %s\n",
  1304.           reloc_num, n_relocs, entry->filename);
  1305. ***************
  1306. *** 4942,4960 ****
  1307.       case N_UNDF: sym.a_type = A_UNDF; break;
  1308.       case N_ABS:  sym.a_type = A_EQU; break; /* ??? */
  1309.           case N_SETT:
  1310. -     case N_TEXT: sym.a_type = A_TEXT; break;
  1311.           case N_SETV:
  1312.           case N_SETD:
  1313.       case N_DATA: sym.a_type = A_DATA; break;
  1314.           case N_SETB:
  1315.       case N_BSS:  sym.a_type = A_BSS; break;
  1316.           case N_ATARI_FILENAME: sym.a_type = A_TFILE; break;
  1317. !     default: /* fake it */
  1318. !           sym.a_type = A_UNDF;
  1319. !       bzero(sym.a_name, sizeof(sym.a_name));
  1320. !       strncpy(sym.a_name, str, sizeof(sym.a_name));
  1321. !       i = 0;
  1322. !       goto fake_out;
  1323.   
  1324.   /* figure out rest of this later */
  1325.       }
  1326. --- 4996,5009 ----
  1327.       case N_UNDF: sym.a_type = A_UNDF; break;
  1328.       case N_ABS:  sym.a_type = A_EQU; break; /* ??? */
  1329.           case N_SETT:
  1330.           case N_SETV:
  1331. +     case N_TEXT: sym.a_type = A_TEXT; break;
  1332.           case N_SETD:
  1333.       case N_DATA: sym.a_type = A_DATA; break;
  1334.           case N_SETB:
  1335.       case N_BSS:  sym.a_type = A_BSS; break;
  1336.           case N_ATARI_FILENAME: sym.a_type = A_TFILE; break;
  1337. !     default:     sym.a_type = A_UNDF; break;
  1338.   
  1339.   /* figure out rest of this later */
  1340.       }
  1341. ***************
  1342. *** 5010,5016 ****
  1343.   
  1344.     /* Read the file's string table.  */
  1345.   
  1346. !   entry->strings = (char *) alloca (entry->string_size);
  1347.     read_entry_strings (file_open (entry), entry);
  1348.   
  1349.     /* Generate a local symbol for the start of this file's text.  */
  1350. --- 5059,5065 ----
  1351.   
  1352.     /* Read the file's string table.  */
  1353.   
  1354. !   entry->strings = (char *) xmalloc (entry->string_size);
  1355.     read_entry_strings (file_open (entry), entry);
  1356.   
  1357.     /* Generate a local symbol for the start of this file's text.  */
  1358. ***************
  1359. *** 5035,5045 ****
  1360.       {
  1361.         register int type = p->n_type;
  1362.         register int write = 0;
  1363. -       int is_a_set_ele;
  1364.   
  1365.         /* WRITE gets 1 for a non-global symbol that should be written.  */
  1366.   
  1367. !       if ((is_a_set_ele = SET_ELEMENT_P (type))) /* This occurs even if global.  These */
  1368.                   /* types of symbols are never written */
  1369.                   /* globally, though they are stored */
  1370.                   /* globally.  */
  1371. --- 5084,5093 ----
  1372.       {
  1373.         register int type = p->n_type;
  1374.         register int write = 0;
  1375.   
  1376.         /* WRITE gets 1 for a non-global symbol that should be written.  */
  1377.   
  1378. !       if (SET_ELEMENT_P (type)) /* This occurs even if global.  These */
  1379.                   /* types of symbols are never written */
  1380.                   /* globally, though they are stored */
  1381.                   /* globally.  */
  1382. ***************
  1383. *** 5058,5073 ****
  1384.         /* If this symbol has a name, write it */
  1385.   
  1386.         if (p->n_un.n_strx)
  1387. !         {
  1388. !         write_atari_sym(p, ((is_a_set_ele)?
  1389. !         ((symbol *) p->n_un.n_name)->name : p->n_un.n_strx + entry->strings));
  1390. ! #if 0
  1391. !              "SET_ELEMENT" : p->n_un.n_strx + entry->strings));
  1392. ! #endif
  1393. !         (*syms_written_addr)++;
  1394. !         }
  1395.       }
  1396.       }
  1397.     entry->strings = NULL;  
  1398.   }
  1399.   
  1400. --- 5106,5120 ----
  1401.         /* If this symbol has a name, write it */
  1402.   
  1403.         if (p->n_un.n_strx)
  1404. !         write_atari_sym(p, (SET_ELEMENT_P (type)
  1405. !                 ? ((symbol *) p->n_un.n_name)->name
  1406. !                 : p->n_un.n_strx + entry->strings));
  1407. !       else
  1408. !         write_atari_sym (p, "DBXSYM");
  1409. !       (*syms_written_addr)++;
  1410.       }
  1411.       }
  1412. +   free (entry->strings);
  1413.     entry->strings = NULL;  
  1414.   }
  1415.   
  1416. ***************
  1417. *** 5081,5086 ****
  1418. --- 5128,5134 ----
  1419.       return;
  1420.   
  1421.     each_file(write_atari_syms, &n_syms_written);
  1422. +   file_close ();
  1423.   
  1424.     /* Now write out the global symbols.  */
  1425.   
  1426. ***************
  1427. *** 5145,5171 ****
  1428.           n_syms_written++;
  1429.         }
  1430.         }
  1431. -   /* this is really stretching it, but we have to fake it */
  1432. -   if(n_syms_written < nsyms)
  1433. -   {
  1434. -       struct nlist nl;
  1435.   
  1436. -       nl.n_value = 0;
  1437. -       nl.n_type = (0x7ffff & N_TYPE); /* make sure it falls into the default */
  1438. -                       /* case in write_atari_sym() */
  1439. -       
  1440. -       while(n_syms_written < nsyms)
  1441. -       {
  1442. - #ifdef BYTE_SWAP
  1443. - nl.n_un.n_strx    = SWAP4(nl.n_un.n_strx);
  1444. - nl.n_desc        = SWAP2(nl.n_desc);
  1445. - nl.n_value      = SWAP4(nl.n_value);
  1446. - #endif
  1447. -       write_atari_sym(&nl, "FAKEEAKF");
  1448. -       n_syms_written++;
  1449. -       }
  1450. -       
  1451. -   }
  1452.     if (n_syms_written != nsyms)
  1453.       fprintf(stderr, "Bogon alert!  wrote %d syms, expected to write %d\n",
  1454.                n_syms_written, nsyms);
  1455. --- 5193,5199 ----
  1456. ***************
  1457. *** 5225,5231 ****
  1458.   
  1459.     /* Read the file's string table.  */
  1460.   
  1461. !   entry->strings = (char *) alloca (entry->string_size);
  1462.     read_entry_strings (file_open (entry), entry);
  1463.   
  1464.     /* Generate a local symbol for the start of this file's text.  */
  1465. --- 5253,5259 ----
  1466.   
  1467.     /* Read the file's string table.  */
  1468.   
  1469. !   entry->strings = (char *) xmalloc (entry->string_size);
  1470.     read_entry_strings (file_open (entry), entry);
  1471.   
  1472.     /* Generate a local symbol for the start of this file's text.  */
  1473. ***************
  1474. *** 5274,5279 ****
  1475. --- 5302,5308 ----
  1476.           }
  1477.       }
  1478.       }
  1479. +   free (entry->strings);
  1480.     entry->strings = NULL;  
  1481.   }
  1482.   
  1483. ***************
  1484. *** 5441,5450 ****
  1485.        extra struct for each indirect symbol to hold the extra reference
  1486.        following. */
  1487.     struct nlist *buf
  1488. !     = (struct nlist *) alloca ((defined_global_sym_count
  1489. !                 + undefined_global_sym_count
  1490. !                 + global_indirect_count)
  1491. !                    * sizeof (struct nlist));
  1492.     /* Pointer for storing into BUF.  */
  1493.     register struct nlist *bufp = buf;
  1494.   
  1495. --- 5470,5479 ----
  1496.        extra struct for each indirect symbol to hold the extra reference
  1497.        following. */
  1498.     struct nlist *buf
  1499. !     = (struct nlist *) xmalloc ((defined_global_sym_count
  1500. !                  + undefined_global_sym_count
  1501. !                  + global_indirect_count)
  1502. !                 * sizeof (struct nlist));
  1503.     /* Pointer for storing into BUF.  */
  1504.     register struct nlist *bufp = buf;
  1505.   
  1506. ***************
  1507. *** 5457,5463 ****
  1508.     string_table_len = strtab_size;
  1509.   
  1510.     if (strip_symbols == STRIP_ALL)
  1511. !     return;
  1512.   
  1513.     /* Write the local symbols defined by the various files.  */
  1514.   
  1515. --- 5486,5495 ----
  1516.     string_table_len = strtab_size;
  1517.   
  1518.     if (strip_symbols == STRIP_ALL)
  1519. !     {
  1520. !       free (buf);
  1521. !       return;
  1522. !     }
  1523.   
  1524.     /* Write the local symbols defined by the various files.  */
  1525.   
  1526. ***************
  1527. *** 5470,5479 ****
  1528.        table from the global symbols written so far.  This must include
  1529.        extra space for the references following indirect outputs. */
  1530.   
  1531. !   strtab_vector = (char **) alloca ((num_hash_tab_syms
  1532. !                      + global_indirect_count) * sizeof (char *));
  1533. !   strtab_lens = (int *) alloca ((num_hash_tab_syms
  1534. !                  + global_indirect_count) * sizeof (int));
  1535.     strtab_index = 0;
  1536.   
  1537.     /* Scan the symbol hash table, bucket by bucket.  */
  1538. --- 5502,5511 ----
  1539.        table from the global symbols written so far.  This must include
  1540.        extra space for the references following indirect outputs. */
  1541.   
  1542. !   strtab_vector = (char **) xmalloc ((num_hash_tab_syms
  1543. !                       + global_indirect_count) * sizeof (char *));
  1544. !   strtab_lens = (int *) xmalloc ((num_hash_tab_syms
  1545. !                   + global_indirect_count) * sizeof (int));
  1546.     strtab_index = 0;
  1547.   
  1548.     /* Scan the symbol hash table, bucket by bucket.  */
  1549. ***************
  1550. *** 5573,5578 ****
  1551. --- 5605,5616 ----
  1552.     /* Write the strings for the global symbols.  */
  1553.   
  1554.     write_string_table ();
  1555. +   /* Free the buffers.  */
  1556. +   free (strtab_lens);
  1557. +   free (strtab_vector);
  1558. +   free (buf);
  1559.   }
  1560.   
  1561.   /* Write the local and debugger symbols of file ENTRY.
  1562. ***************
  1563. *** 5592,5598 ****
  1564.     /* Buffer to accumulate all the syms before writing them.
  1565.        It has one extra slot for the local symbol we generate here.  */
  1566.     struct nlist *buf
  1567. !     = (struct nlist *) alloca (entry->header.a_syms + sizeof (struct nlist));
  1568.     register struct nlist *bufp = buf;
  1569.   
  1570.     /* Upper bound on number of syms to be written here.  */
  1571. --- 5630,5636 ----
  1572.     /* Buffer to accumulate all the syms before writing them.
  1573.        It has one extra slot for the local symbol we generate here.  */
  1574.     struct nlist *buf
  1575. !     = (struct nlist *) xmalloc (entry->header.a_syms + sizeof (struct nlist));
  1576.     register struct nlist *bufp = buf;
  1577.   
  1578.     /* Upper bound on number of syms to be written here.  */
  1579. ***************
  1580. *** 5601,5608 ****
  1581.     /* Make tables that record, for each symbol, its name and its name's length.
  1582.        The elements are filled in by `assign_string_table_index'.  */
  1583.   
  1584. !   strtab_vector = (char **) alloca (max_syms * sizeof (char *));
  1585. !   strtab_lens = (int *) alloca (max_syms * sizeof (int));
  1586.     strtab_index = 0;
  1587.   
  1588.     /* Generate a local symbol for the start of this file's text.  */
  1589. --- 5639,5646 ----
  1590.     /* Make tables that record, for each symbol, its name and its name's length.
  1591.        The elements are filled in by `assign_string_table_index'.  */
  1592.   
  1593. !   strtab_vector = (char **) xmalloc (max_syms * sizeof (char *));
  1594. !   strtab_lens = (int *) xmalloc (max_syms * sizeof (int));
  1595.     strtab_index = 0;
  1596.   
  1597.     /* Generate a local symbol for the start of this file's text.  */
  1598. ***************
  1599. *** 5623,5629 ****
  1600.   
  1601.     /* Read the file's string table.  */
  1602.   
  1603. !   entry->strings = (char *) alloca (entry->string_size);
  1604.     read_entry_strings (file_open (entry), entry);
  1605.   
  1606.     for (; p < end; p++)
  1607. --- 5661,5667 ----
  1608.   
  1609.     /* Read the file's string table.  */
  1610.   
  1611. !   entry->strings = (char *) xmalloc (entry->string_size);
  1612.     read_entry_strings (file_open (entry), entry);
  1613.   
  1614.     for (; p < end; p++)
  1615. ***************
  1616. *** 5685,5695 ****
  1617.        using the data in vectors `strtab_vector' and `strtab_lens'.  */
  1618.   
  1619.     write_string_table ();
  1620. !   entry->strings = 0;        /* Since it will dissapear anyway.  */
  1621.   }
  1622.   #endif            /* not atari st */
  1623.   
  1624.   
  1625.   /* Copy any GDB symbol segments from the input files to the output file.
  1626.      The contents of the symbol segment is copied without change
  1627.      except that we store some information into the beginning of it.  */
  1628. --- 5723,5740 ----
  1629.        using the data in vectors `strtab_vector' and `strtab_lens'.  */
  1630.   
  1631.     write_string_table ();
  1632. !   /* Free all buffers.  */
  1633. !   free (entry->strings);
  1634. !   entry->strings = 0;
  1635. !   free (strtab_lens);
  1636. !   free (strtab_vector);
  1637. !   free (buf);
  1638.   }
  1639.   #endif            /* not atari st */
  1640.   
  1641.   
  1642. + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1643.   /* Copy any GDB symbol segments from the input files to the output file.
  1644.      The contents of the symbol segment is copied without change
  1645.      except that we store some information into the beginning of it.  */
  1646. ***************
  1647. *** 5706,5713 ****
  1648.   write_file_symseg (entry)
  1649.        struct file_entry *entry;
  1650.   {
  1651. -   /* this appears to be completely wrong for ST */
  1652. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1653.     char buffer[4096];
  1654.     struct symbol_root root;
  1655.     FILE *indesc;
  1656. --- 5751,5756 ----
  1657. ***************
  1658. *** 5769,5776 ****
  1659.       }
  1660.   
  1661.     file_close ();
  1662. - #endif
  1663.   }
  1664.   
  1665.   /* Create the symbol table entries for `etext', `edata' and `end'.  */
  1666.   
  1667. --- 5812,5819 ----
  1668.       }
  1669.   
  1670.     file_close ();
  1671.   }
  1672. + #endif /* not atari */
  1673.   
  1674.   /* Create the symbol table entries for `etext', `edata' and `end'.  */
  1675.   
  1676. ***************
  1677. *** 5996,6001 ****
  1678. --- 6039,6045 ----
  1679.     }
  1680.   }
  1681.   
  1682. + #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1683.   /* Output PADDING zero-bytes to descriptor OUTDESC.
  1684.      PADDING may be negative; in that case, do nothing.  */
  1685.   
  1686. ***************
  1687. *** 6004,6011 ****
  1688.        int padding;
  1689.        FILE *outdesc;
  1690.   {
  1691. -     /* not round here, you don't... */
  1692. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  1693.     register char *buf;
  1694.     if (padding <= 0)
  1695.       return;
  1696. --- 6048,6053 ----
  1697. ***************
  1698. *** 6013,6020 ****
  1699.     buf = (char *) alloca (padding);
  1700.     bzero (buf, padding);
  1701.     mywrite (buf, padding, 1, outdesc);
  1702. - #endif
  1703.   }
  1704.   
  1705.   /* Return a newly-allocated string
  1706.      whose contents concatenate the strings S1, S2, S3.  */
  1707. --- 6055,6062 ----
  1708.     buf = (char *) alloca (padding);
  1709.     bzero (buf, padding);
  1710.     mywrite (buf, padding, 1, outdesc);
  1711.   }
  1712. + #endif /* not atari */
  1713.   
  1714.   /* Return a newly-allocated string
  1715.      whose contents concatenate the strings S1, S2, S3.  */
  1716. ***************
  1717. *** 6176,6182 ****
  1718.   
  1719.     /* Read the file's string table.  */
  1720.   
  1721. !   entry->strings = (char *) alloca (entry->string_size);
  1722.     read_entry_strings (file_open (entry), entry);
  1723.   
  1724.     /* Generate a local symbol for the start of this file's text.  */
  1725. --- 6218,6224 ----
  1726.   
  1727.     /* Read the file's string table.  */
  1728.   
  1729. !   entry->strings = (char *) xmalloc (entry->string_size);
  1730.     read_entry_strings (file_open (entry), entry);
  1731.   
  1732.     /* Generate a local symbol for the start of this file's text.  */
  1733. ***************
  1734. *** 6221,6226 ****
  1735. --- 6263,6269 ----
  1736.           }
  1737.       }
  1738.       }
  1739. +   free (entry->strings);
  1740.     entry->strings = NULL;  
  1741.   }
  1742.   
  1743. ===================================================================
  1744. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/nm.c,v
  1745. retrieving revision 1.10
  1746. diff -c -r1.10 nm.c
  1747. *** 1.10    1992/03/22 21:44:03
  1748. --- nm.c    1993/03/29 03:41:06
  1749. ***************
  1750. *** 146,154 ****
  1751. --- 146,156 ----
  1752.   
  1753.   /* If compiled with GNU C, use the built-in alloca */
  1754.   #ifdef __GNUC__
  1755. + #ifndef alloca
  1756.   #    define alloca __builtin_alloca
  1757.   #endif
  1758.   
  1759. + #else
  1760.   /*
  1761.    * Alloca include.
  1762.    */
  1763. ***************
  1764. *** 158,163 ****
  1765. --- 160,166 ----
  1766.   #endif
  1767.   #include "alloca.h"
  1768.   #endif
  1769. + #endif /* __GNUC__ */
  1770.   
  1771.   /* Name of this program.  */
  1772.   
  1773. ***************
  1774. *** 792,797 ****
  1775. --- 795,806 ----
  1776.           case N_LENG:
  1777.             s = "LENG";
  1778.             break;
  1779. +         case N_BINCL:
  1780. +           s = "BINCL";
  1781. +           break;
  1782. +         case N_EINCL:
  1783. +           s = "EINCL";
  1784. +           break;
  1785.           default:
  1786.             s = "";
  1787.           }
  1788. ***************
  1789. *** 849,883 ****
  1790.       }
  1791.   
  1792.     nsymdefs = symdef_size / sizeof (struct symdef);
  1793. !   symdefs = (struct symdef *) alloca (symdef_size);
  1794.     if (symdef_size != read (desc, symdefs, symdef_size))
  1795.       {
  1796.         error_with_file ("premature eof in ");
  1797.         return;
  1798.       }
  1799.   
  1800. !   if (stringsize < 0)
  1801.       {
  1802. !       error_with_file ("invalid size value in ");
  1803.         return;
  1804.       }
  1805.   
  1806. !   if (sizeof stringsize != read (desc, &stringsize, sizeof stringsize))
  1807.       {
  1808. !       error_with_file ("premature eof in ");
  1809.         return;
  1810.       }
  1811.   
  1812. !   strings = (char *) alloca (stringsize);
  1813.     if (stringsize != read (desc, strings, stringsize))
  1814.       {
  1815.         error_with_file ("premature eof in ");
  1816.         return;
  1817.       }
  1818.   
  1819.     if (stringsize + symdef_size + sizeof stringsize + sizeof symdef_size != member_length)
  1820.       {
  1821.         error_with_file ("size of data isn't what the data calls for in ");
  1822.         return;
  1823.       }
  1824.   
  1825. --- 858,899 ----
  1826.       }
  1827.   
  1828.     nsymdefs = symdef_size / sizeof (struct symdef);
  1829. !   symdefs = (struct symdef *) xmalloc (symdef_size);
  1830.     if (symdef_size != read (desc, symdefs, symdef_size))
  1831.       {
  1832.         error_with_file ("premature eof in ");
  1833. +       free (symdefs);
  1834.         return;
  1835.       }
  1836.   
  1837. !   if (sizeof stringsize != read (desc, &stringsize, sizeof stringsize))
  1838.       {
  1839. !       error_with_file ("premature eof in ");
  1840. !       free (symdefs);
  1841.         return;
  1842.       }
  1843.   
  1844. !   if (stringsize < 0)
  1845.       {
  1846. !       error_with_file ("invalid size value in ");
  1847. !       free (symdefs);
  1848.         return;
  1849.       }
  1850.   
  1851. !   strings = (char *) xmalloc (stringsize);
  1852.     if (stringsize != read (desc, strings, stringsize))
  1853.       {
  1854.         error_with_file ("premature eof in ");
  1855. +       free (symdefs);
  1856. +       free (strings);
  1857.         return;
  1858.       }
  1859.   
  1860.     if (stringsize + symdef_size + sizeof stringsize + sizeof symdef_size != member_length)
  1861.       {
  1862.         error_with_file ("size of data isn't what the data calls for in ");
  1863. +       free (symdefs);
  1864. +       free (strings);
  1865.         return;
  1866.       }
  1867.   
  1868. ***************
  1869. *** 890,895 ****
  1870. --- 906,913 ----
  1871.         if (symdefs[i].stringoffset < 0 || symdefs[i].stringoffset >= stringsize)
  1872.       {
  1873.         error_with_file ("invalid entry in ");
  1874. +       free (symdefs);
  1875. +       free (strings);
  1876.         return;
  1877.       }
  1878.         if (member_offset != symdefs[i].offset)
  1879. ***************
  1880. *** 904,909 ****
  1881. --- 922,929 ----
  1882.       }
  1883.         printf ("%s in %s\n", symdefs[i].stringoffset + strings, member_name);
  1884.       }
  1885. +   free (symdefs);
  1886. +   free (strings);
  1887.   }
  1888.   
  1889.   /* Report a fatal error.
  1890. ===================================================================
  1891. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/printstk.c,v
  1892. retrieving revision 1.6
  1893. diff -c -r1.6 printstk.c
  1894. *** 1.6    1992/07/21 14:52:06
  1895. --- printstk.c    1993/03/29 03:41:07
  1896. ***************
  1897. *** 33,38 ****
  1898. --- 33,40 ----
  1899.   # define SYM_OFFSET   (sizeof(short) + (3*sizeof(long)))
  1900.   #endif
  1901.   
  1902. + int error = 0;
  1903.   static char *sym_names[] = { "__stksize", "__initial_stack" };
  1904.   
  1905.   long find_offset (fd, fn, what)
  1906. ***************
  1907. *** 42,50 ****
  1908.   {
  1909.       struct aexec head;
  1910.       struct asym  sym;
  1911. -     int found;
  1912.       int    all = 0;
  1913.       int index = 1;
  1914.       
  1915.   #ifndef WORD_ALIGNED
  1916.       if(read(fd, &head, sizeof(head)) != sizeof(head))
  1917. --- 44,56 ----
  1918.   {
  1919.       struct aexec head;
  1920.       struct asym  sym;
  1921.       int    all = 0;
  1922.       int index = 1;
  1923. + #ifndef WORD_ALIGNED
  1924. +     char extension[sizeof (struct asym)];
  1925. + #else
  1926. +     char extension[SIZEOF_ASYM];
  1927. + #endif
  1928.       
  1929.   #ifndef WORD_ALIGNED
  1930.       if(read(fd, &head, sizeof(head)) != sizeof(head))
  1931. ***************
  1932. *** 53,69 ****
  1933.   #endif
  1934.       {
  1935.       perror(fn);
  1936. !     exit(2);
  1937.       }
  1938.       if(head.a_magic != CMAGIC)
  1939.       {
  1940. !     fprintf(stderr,"Invalid magic number %x\n", head.a_magic);
  1941. !     exit(3);
  1942.       }
  1943.       if(head.a_syms == 0)
  1944.       {
  1945.       fprintf(stderr,"%s: no symbol table\n", fn);
  1946. !     exit(4);
  1947.       }
  1948.       if(lseek(fd, head.a_text+head.a_data, 1) != 
  1949.   #ifndef WORD_ALIGNED
  1950. --- 59,75 ----
  1951.   #endif
  1952.       {
  1953.       perror(fn);
  1954. !     return -1;
  1955.       }
  1956.       if(head.a_magic != CMAGIC)
  1957.       {
  1958. !     fprintf(stderr,"%s: invalid magic number %x\n", fn, head.a_magic);
  1959. !     return -1;
  1960.       }
  1961.       if(head.a_syms == 0)
  1962.       {
  1963.       fprintf(stderr,"%s: no symbol table\n", fn);
  1964. !     return -1;
  1965.       }
  1966.       if(lseek(fd, head.a_text+head.a_data, 1) != 
  1967.   #ifndef WORD_ALIGNED
  1968. ***************
  1969. *** 73,79 ****
  1970.   #endif
  1971.       {
  1972.       perror(fn);
  1973. !     exit(5);
  1974.       }
  1975.       for(;;)
  1976.       {
  1977. --- 79,85 ----
  1978.   #endif
  1979.       {
  1980.       perror(fn);
  1981. !     return -1;
  1982.       }
  1983.       for(;;)
  1984.       {
  1985. ***************
  1986. *** 83,105 ****
  1987.       if(index && read_sym(fd, &sym))
  1988.   #endif
  1989.       {
  1990. !         fprintf(stderr, "symbol _stksize not found\n");
  1991. !         exit(6);
  1992.       }
  1993.       /* after symbol read check first for _stksize */
  1994.       index ^= 1;
  1995.       if (strncmp(sym_names[index], sym.a_name, 8) == 0)
  1996.       {
  1997. !         if ((found = (sym.a_type & A_DATA)) || all++)
  1998. !         break;
  1999.       }
  2000.       }
  2001.       
  2002. -     if(!found)
  2003. -     {
  2004. -     fprintf(stderr, "symbol _stksize is undefined\n");
  2005. -     exit(9);
  2006. -     }
  2007.       *what = index;
  2008.   #ifndef WORD_ALIGNED
  2009.       return sym.a_value + sizeof(head);
  2010. --- 89,120 ----
  2011.       if(index && read_sym(fd, &sym))
  2012.   #endif
  2013.       {
  2014. !         fprintf(stderr, "%s: symbol _stksize not found\n", fn);
  2015. !         return -1;
  2016.       }
  2017. +     if (index && (sym.a_type & A_LNAM) == A_LNAM)
  2018. +       if (read (fd, extension, sizeof (extension)) != sizeof (extension))
  2019. +         {
  2020. +           fprintf (stderr, "%s: symbol _stksize not found\n", fn);
  2021. +           return -1;
  2022. +         }
  2023.       /* after symbol read check first for _stksize */
  2024.       index ^= 1;
  2025.       if (strncmp(sym_names[index], sym.a_name, 8) == 0)
  2026.       {
  2027. !       if ((sym.a_type & A_LNAM) == A_LNAM
  2028. !           && strncmp (sym_names[index] + 8, extension, sizeof (extension)))
  2029. !         continue;
  2030. !       if (sym.a_type & A_DATA)
  2031. !         break;
  2032. !       if (all++)
  2033. !         {
  2034. !           fprintf (stderr, "%s: symbol _stksize is undefined\n", fn);
  2035. !           return -1;
  2036. !         }
  2037.       }
  2038.       }
  2039.       
  2040.       *what = index;
  2041.   #ifndef WORD_ALIGNED
  2042.       return sym.a_value + sizeof(head);
  2043. ***************
  2044. *** 112,145 ****
  2045.   int argc;
  2046.   char **argv;
  2047.   {
  2048.       int fd;
  2049.       int what;
  2050.       long stksize, offset;
  2051. -     char fn[FILENAME_MAX];
  2052.       
  2053. -     if(argc > 1)
  2054. -     (void) strcpy(fn, *++argv);
  2055. -     else
  2056. -     (void) strcpy(fn, "gcc-cc1.ttp");
  2057. -     
  2058.       if((fd = open(fn, 0)) < 0)
  2059.       {
  2060.       perror(fn);
  2061. !     exit(1);
  2062.       }
  2063.       
  2064.       offset = find_offset(fd, fn, &what);
  2065. !     
  2066.       if(lseek(fd, offset, 0) != offset)
  2067.       {
  2068.       perror(fn);
  2069. !     exit(7);
  2070.       }
  2071.       read(fd, &stksize, sizeof(long));
  2072.       printf("%s: %s is %ld (%dK)\n",
  2073.            fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
  2074.       
  2075. !     return close(fd);
  2076.   }
  2077.   
  2078.   #ifdef WORD_ALIGNED
  2079. --- 127,169 ----
  2080.   int argc;
  2081.   char **argv;
  2082.   {
  2083. +   while (--argc)
  2084. +     error |= print_stack (*++argv);
  2085. +   exit (error);
  2086. + }
  2087. + int
  2088. + print_stack (fn)
  2089. +      char *fn;
  2090. + {
  2091.       int fd;
  2092.       int what;
  2093.       long stksize, offset;
  2094.       
  2095.       if((fd = open(fn, 0)) < 0)
  2096.       {
  2097.       perror(fn);
  2098. !     return 1;
  2099.       }
  2100.       
  2101.       offset = find_offset(fd, fn, &what);
  2102. !     if (offset < 0)
  2103. !       {
  2104. !     close (fd);
  2105. !     return 1;
  2106. !       }
  2107.       if(lseek(fd, offset, 0) != offset)
  2108.       {
  2109.       perror(fn);
  2110. !     close (fd);
  2111. !     return 1;
  2112.       }
  2113.       read(fd, &stksize, sizeof(long));
  2114.       printf("%s: %s is %ld (%dK)\n",
  2115.            fn, sym_names[what] + 1, stksize, (int)(stksize/1024));
  2116.       
  2117. !     return close(fd) != 0;
  2118.   }
  2119.   
  2120.   #ifdef WORD_ALIGNED
  2121. ===================================================================
  2122. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/size68.c,v
  2123. retrieving revision 1.6
  2124. diff -c -r1.6 size68.c
  2125. *** 1.6    1992/01/14 19:45:23
  2126. --- size68.c    1993/03/29 03:41:09
  2127. ***************
  2128. *** 23,31 ****
  2129.   int argc;
  2130.   char **argv;
  2131.   {
  2132. - #ifdef atarist
  2133. -     _binmode(1);
  2134. - #endif
  2135.       while(--argc > 0)
  2136.           showfile(*++argv);
  2137.       return 0;
  2138. --- 23,28 ----
  2139. ***************
  2140. *** 37,43 ****
  2141.       register FILE *fp;
  2142.       struct aexec h;
  2143.       
  2144. !     if((fp = fopen(name, "r")) == (FILE *)NULL)
  2145.       {
  2146.           perror(name);
  2147.           exit(1);
  2148. --- 34,40 ----
  2149.       register FILE *fp;
  2150.       struct aexec h;
  2151.       
  2152. !     if((fp = fopen(name, "rb")) == (FILE *)NULL)
  2153.       {
  2154.           perror(name);
  2155.           exit(1);
  2156. ***************
  2157. *** 60,70 ****
  2158.       }
  2159.       printf("%s:\n\ttext size\t%ld\n\tdata size\t%ld\n\tbss size\t%ld\
  2160.   \n\tsymbol size\t%ld\n\tFile %s relocatable\n\
  2161. ! \n\t%s\n", name, h.a_text,
  2162.        h.a_data, h.a_bss, h.a_syms,
  2163.       (h.a_isreloc == ISRELOCINFO)? "is":"is not",
  2164. !     (h.a_AZero2 & 1)? "Only BSS cleared on startup" :
  2165. !              "BSS and high mem cleared on startup");
  2166.   }
  2167.   
  2168.   # ifdef WORD_ALIGNED
  2169. --- 57,66 ----
  2170.       }
  2171.       printf("%s:\n\ttext size\t%ld\n\tdata size\t%ld\n\tbss size\t%ld\
  2172.   \n\tsymbol size\t%ld\n\tFile %s relocatable\n\
  2173. ! \t%s cleared on startup\n\n", name, h.a_text,
  2174.        h.a_data, h.a_bss, h.a_syms,
  2175.       (h.a_isreloc == ISRELOCINFO)? "is":"is not",
  2176. !     (h.a_AZero2 & 1)? "Only BSS" : "BSS and high mem");
  2177.   }
  2178.   
  2179.   # ifdef WORD_ALIGNED
  2180. ===================================================================
  2181. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/strip.c,v
  2182. retrieving revision 1.7
  2183. diff -c -r1.7 strip.c
  2184. *** 1.7    1992/08/14 17:24:38
  2185. --- strip.c    1993/03/29 03:41:10
  2186. ***************
  2187. *** 31,41 ****
  2188.    */
  2189.   
  2190.   #include <stdio.h>
  2191.   #ifdef atarist
  2192.   #ifdef __GNUC__
  2193.   #  include <stddef.h>
  2194.   #  include <memory.h>
  2195. ! #  include <unixlib.h>
  2196.   #else
  2197.   #include <malloc.h>
  2198.   extern long lread();
  2199. --- 31,42 ----
  2200.    */
  2201.   
  2202.   #include <stdio.h>
  2203. + #include <stat.h>
  2204.   #ifdef atarist
  2205.   #ifdef __GNUC__
  2206.   #  include <stddef.h>
  2207.   #  include <memory.h>
  2208. ! #  include <unistd.h>
  2209.   #else
  2210.   #include <malloc.h>
  2211.   extern long lread();
  2212. ***************
  2213. *** 51,56 ****
  2214. --- 52,59 ----
  2215.      extern char *malloc(), *realloc();
  2216.   #else
  2217.   #  include <string.h>
  2218. + #  define lwrite _write
  2219. + #  define lread _read
  2220.   #endif
  2221.   
  2222.   #include <fcntl.h>
  2223. ***************
  2224. *** 66,75 ****
  2225.   typedef char    symstr_t[GST_SYMLEN];
  2226.   symstr_t        stklist[] = {"__stksize", "__initial_stack"};
  2227.   
  2228. - #ifdef atarist
  2229. - long            _stksize = 1L;
  2230. - #endif
  2231.   #ifndef __PROTO
  2232.   #  if __STDC__ || __cplusplus
  2233.   #   define __PROTO(s) s
  2234. --- 69,74 ----
  2235. ***************
  2236. *** 100,107 ****
  2237.       int             status = 0;
  2238.       int             flag = -1;
  2239.       int             cuttrail = 0;
  2240. !     symstr_t       *nmlist = (symstr_t *) 0;
  2241. !     select_fp       select=(select_fp)NULL;
  2242.   #ifdef atarist
  2243.       char           *tmpdir;
  2244.       register int    l;
  2245. --- 99,106 ----
  2246.       int             status = 0;
  2247.       int             flag = -1;
  2248.       int             cuttrail = 0;
  2249. !     symstr_t       *nmlist = stklist;
  2250. !     select_fp       select = sel_listed;
  2251.   #ifdef atarist
  2252.       char           *tmpdir;
  2253.       register int    l;
  2254. ***************
  2255. *** 126,131 ****
  2256. --- 125,133 ----
  2257.               nmlist = stklist;
  2258.           select = sel_listed;
  2259.           break;
  2260. +         case 'a':
  2261. +         select = 0;
  2262. +         break;
  2263.           case 'l':
  2264.           (*argv)++;
  2265.           if ('\0' == **argv) {
  2266. ***************
  2267. *** 151,167 ****
  2268.   
  2269.   #ifdef __GNUC__
  2270.   #ifdef atarist
  2271. -     tmpname[0] = '\0';
  2272.       if ((tmpdir = getenv ("TEMP")) != NULL) {
  2273.       strcpy (tmpname, tmpdir);
  2274.       l = (int) strlen (tmpname) - 1;
  2275. !     if (tmpname[l] == '\\')
  2276.           tmpname[l] = '\0';
  2277.       }
  2278. !     strcat (tmpname, "\\STXXXXXX");
  2279. ! #else
  2280. !     strcpy (tmpname, "/tmp/STXXXXXX");
  2281.   #endif
  2282.   
  2283.       mktemp (tmpname);
  2284.   #else /* not __GNUC__ */
  2285. --- 153,168 ----
  2286.   
  2287.   #ifdef __GNUC__
  2288.   #ifdef atarist
  2289.       if ((tmpdir = getenv ("TEMP")) != NULL) {
  2290.       strcpy (tmpname, tmpdir);
  2291.       l = (int) strlen (tmpname) - 1;
  2292. !     if (tmpname[l] == '\\' || tmpname[l] == '/')
  2293.           tmpname[l] = '\0';
  2294. +     strcat (tmpname, "/STXXXXXX");
  2295.       }
  2296. !     else
  2297.   #endif
  2298. +     strcpy (tmpname, "/tmp/STXXXXXX");
  2299.   
  2300.       mktemp (tmpname);
  2301.   #else /* not __GNUC__ */
  2302. ***************
  2303. *** 197,203 ****
  2304.       char           *s;
  2305.   {
  2306.       report (s);
  2307. !     report ("Usage: strip {-k | -l names | -g} [-t] files ...\n");
  2308.       exit (1);
  2309.   }
  2310.   
  2311. --- 198,204 ----
  2312.       char           *s;
  2313.   {
  2314.       report (s);
  2315. !     report ("Usage: strip {-k | -l names | -g | -a} [-t] files ...\n");
  2316.       exit (1);
  2317.   }
  2318.   
  2319. ***************
  2320. *** 275,280 ****
  2321. --- 276,282 ----
  2322.       register long   count, rbytes, sbytes;
  2323.       long            lbytes, swap_lbytes;
  2324.       struct aexec    ahead;
  2325. +     struct stat        statb;
  2326.   
  2327.       if ((fd = open (name, O_RDONLY, 0666)) < 0) {
  2328.       perror (name);
  2329. ***************
  2330. *** 372,379 ****
  2331.       }
  2332.       close (tfd);
  2333.       close (fd);
  2334.       if (rename(tmpname, name) == 0) return 0; /* try to rename it */
  2335. !     if ((fd = open (name, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) {
  2336.       perror (name);
  2337.       return 0x1000;
  2338.       }
  2339. --- 374,383 ----
  2340.       }
  2341.       close (tfd);
  2342.       close (fd);
  2343. +     if (stat (name, &statb) < 0)
  2344. +       statb.st_mode = 0666;
  2345.       if (rename(tmpname, name) == 0) return 0; /* try to rename it */
  2346. !     if ((fd = open (name, O_WRONLY | O_TRUNC | O_CREAT, statb.st_mode)) < 0) {
  2347.       perror (name);
  2348.       return 0x1000;
  2349.       }
  2350. ===================================================================
  2351. RCS file: /net/acae127/home/bammi/etc/src/master/atari/cross-util/sym-ld.c,v
  2352. retrieving revision 1.22
  2353. diff -c -r1.22 sym-ld.c
  2354. *** 1.22    1992/10/11 02:39:24
  2355. --- sym-ld.c    1993/03/29 03:41:12
  2356. ***************
  2357. *** 129,137 ****
  2358. --- 129,139 ----
  2359.   #endif
  2360.   #endif
  2361.   
  2362. + #if 0                /* all big alloca's eliminated */
  2363.   #ifdef atarist        /* and a stack */
  2364.   long _stksize = -1L;
  2365.   #endif
  2366. + #endif
  2367.   
  2368.   #ifdef min
  2369.   #undef min
  2370. ***************
  2371. *** 419,425 ****
  2372.   
  2373.      The address of the set is made into an N_SETV symbol
  2374.      whose name is the same as the name of the set.
  2375. !    This symbol acts like a N_DATA global symbol
  2376.      in that it can satisfy undefined external references.
  2377.   
  2378.      For the purposes of determining whether or not to load in a library
  2379. --- 421,427 ----
  2380.   
  2381.      The address of the set is made into an N_SETV symbol
  2382.      whose name is the same as the name of the set.
  2383. !    This symbol acts like a N_TEXT global symbol
  2384.      in that it can satisfy undefined external references.
  2385.   
  2386.      For the purposes of determining whether or not to load in a library
  2387. ***************
  2388. *** 996,1006 ****
  2389.   
  2390.     outheader.a_info = magic;
  2391.   
  2392. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  2393.   #ifdef INITIALIZE_HEADER
  2394.     INITIALIZE_HEADER;
  2395.   #endif
  2396. - #endif
  2397.   
  2398.     text_size = sizeof (struct exec);
  2399.   #ifdef COFF_ENCAPSULATE
  2400. --- 998,1006 ----
  2401. ***************
  2402. *** 1870,1878 ****
  2403.     if (!N_BADMAG (*((struct exec *)&magicnum)))
  2404.       {
  2405.         read_entry_symbols (desc, entry);
  2406. !       entry->strings = (char *) alloca (entry->string_size);
  2407.         read_entry_strings (desc, entry);
  2408.         enter_file_symbols (entry);
  2409.         entry->strings = 0;
  2410.       }
  2411.     else
  2412. --- 1870,1879 ----
  2413.     if (!N_BADMAG (*((struct exec *)&magicnum)))
  2414.       {
  2415.         read_entry_symbols (desc, entry);
  2416. !       entry->strings = (char *) xmalloc (entry->string_size);
  2417.         read_entry_strings (desc, entry);
  2418.         enter_file_symbols (entry);
  2419. +       free (entry->strings);
  2420.         entry->strings = 0;
  2421.       }
  2422.     else
  2423. ***************
  2424. *** 2405,2411 ****
  2425.                + symdef_base[i].symbol_name_string_index,
  2426.                entry->filename);
  2427.           read_entry_symbols (desc, subentry);
  2428. !         subentry->strings = (char *) malloc (subentry->string_size);
  2429.           read_entry_strings (desc, subentry);
  2430.   
  2431.           /* Now scan the symbol table and decide whether to load.  */
  2432. --- 2406,2412 ----
  2433.                + symdef_base[i].symbol_name_string_index,
  2434.                entry->filename);
  2435.           read_entry_symbols (desc, subentry);
  2436. !         subentry->strings = (char *) xmalloc (subentry->string_size);
  2437.           read_entry_strings (desc, subentry);
  2438.   
  2439.           /* Now scan the symbol table and decide whether to load.  */
  2440. ***************
  2441. *** 2472,2483 ****
  2442.         if (!subentry) return;
  2443.   
  2444.         read_entry_symbols (desc, subentry);
  2445. !       subentry->strings = (char *) alloca (subentry->string_size);
  2446.         read_entry_strings (desc, subentry);
  2447.   
  2448.         if (!subfile_wanted_p (subentry))
  2449.       {
  2450.         free (subentry->symbols);
  2451.         free (subentry);
  2452.       }
  2453.         else
  2454. --- 2473,2485 ----
  2455.         if (!subentry) return;
  2456.   
  2457.         read_entry_symbols (desc, subentry);
  2458. !       subentry->strings = (char *) xmalloc (subentry->string_size);
  2459.         read_entry_strings (desc, subentry);
  2460.   
  2461.         if (!subfile_wanted_p (subentry))
  2462.       {
  2463.         free (subentry->symbols);
  2464. +       free (subentry->strings);
  2465.         free (subentry);
  2466.       }
  2467.         else
  2468. ***************
  2469. *** 2743,2749 ****
  2470. --- 2745,2755 ----
  2471.           {
  2472.             if (!relocatable_output || force_common_definition)
  2473.           {
  2474. + #ifdef atarist
  2475. +           com = (com + sizeof (short) - 1) & (- sizeof (short));
  2476. + #else
  2477.             com = (com + sizeof (int) - 1) & (- sizeof (int));
  2478. + #endif
  2479.   
  2480.             sp->value = data_start + data_size + bss_size;
  2481.             sp->defined = N_BSS | N_EXT;
  2482. ***************
  2483. *** 2867,2877 ****
  2484.       switch (type)
  2485.         {
  2486.         case N_TEXT:
  2487.         case N_SETT:
  2488.           p->n_value += entry->text_start_address;
  2489.           break;
  2490.         case N_DATA:
  2491. -       case N_SETV:
  2492.         case N_SETD:
  2493.           /* A symbol whose value is in the data section
  2494.              is present in the input file as if the data section
  2495. --- 2873,2883 ----
  2496.       switch (type)
  2497.         {
  2498.         case N_TEXT:
  2499. +       case N_SETV:
  2500.         case N_SETT:
  2501.           p->n_value += entry->text_start_address;
  2502.           break;
  2503.         case N_DATA:
  2504.         case N_SETD:
  2505.           /* A symbol whose value is in the data section
  2506.              is present in the input file as if the data section
  2507. ***************
  2508. *** 2952,2958 ****
  2509.   {
  2510.     register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
  2511.   
  2512. !   entry->strings = (char *) alloca (entry->string_size);
  2513.     read_entry_strings (file_open (entry), entry);
  2514.   
  2515.     fprintf (outfile, "\nLocal symbols of ");
  2516. --- 2958,2964 ----
  2517.   {
  2518.     register struct nlist *p, *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
  2519.   
  2520. !   entry->strings = (char *) xmalloc (entry->string_size);
  2521.     read_entry_strings (file_open (entry), entry);
  2522.   
  2523.     fprintf (outfile, "\nLocal symbols of ");
  2524. ***************
  2525. *** 2974,2979 ****
  2526. --- 2980,2986 ----
  2527.       free(nm);
  2528.         }
  2529.   
  2530. +   free (entry->strings);
  2531.     entry->strings = 0;        /* All done with them.  */
  2532.   }
  2533.   
  2534. ***************
  2535. *** 3027,3033 ****
  2536.       {
  2537.         int desc;
  2538.   
  2539. !       entry->strings = (char *) alloca (entry->string_size);
  2540.         desc = file_open (entry);
  2541.         read_entry_strings (desc, entry);
  2542.       }
  2543. --- 3034,3040 ----
  2544.       {
  2545.         int desc;
  2546.   
  2547. !       entry->strings = (char *) xmalloc (entry->string_size);
  2548.         desc = file_open (entry);
  2549.         read_entry_strings (desc, entry);
  2550.       }
  2551. ***************
  2552. *** 3240,3245 ****
  2553. --- 3247,3253 ----
  2554.         }
  2555.     }
  2556.   
  2557. +   free (entry->strings);
  2558.     entry->strings = 0;
  2559.   }
  2560.   /*
  2561. ***************
  2562. *** 3540,3546 ****
  2563.   
  2564.     filemode = statbuf.st_mode;
  2565.   
  2566. ! #ifndef atarist
  2567.     chmod (output_filename, filemode & ~0111);
  2568.   #endif
  2569.   
  2570. --- 3548,3554 ----
  2571.   
  2572.     filemode = statbuf.st_mode;
  2573.   
  2574. ! #if !(defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  2575.     chmod (output_filename, filemode & ~0111);
  2576.   #endif
  2577.   
  2578. ***************
  2579. *** 3566,3572 ****
  2580.   
  2581.     close (outdesc);
  2582.   
  2583. ! #ifndef atarist
  2584.     chmod (output_filename, filemode | 0111);
  2585.   #endif
  2586.   }
  2587. --- 3574,3580 ----
  2588.   
  2589.     close (outdesc);
  2590.   
  2591. ! #if !(defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  2592.     chmod (output_filename, filemode | 0111);
  2593.   #endif
  2594.   }
  2595. ***************
  2596. *** 3648,3658 ****
  2597.       }
  2598.   #endif
  2599.   
  2600. - #if (!(defined(CROSSATARI) || defined(atarist) || defined(atariminix)))
  2601.   #ifdef INITIALIZE_HEADER
  2602.     INITIALIZE_HEADER;
  2603.   #endif
  2604. - #endif
  2605.   
  2606.     if (strip_symbols == STRIP_ALL)
  2607.       nsyms = 0;
  2608. --- 3656,3664 ----
  2609. ***************
  2610. *** 3810,3816 ****
  2611.   
  2612.     /* Allocate space for the file's text section */
  2613.   
  2614. !   bytes = (char *) alloca (entry->header.a_text);
  2615.   
  2616.     /* Deal with relocation information however is appropriate */
  2617.   
  2618. --- 3816,3822 ----
  2619.   
  2620.     /* Allocate space for the file's text section */
  2621.   
  2622. !   bytes = (char *) xmalloc (entry->header.a_text);
  2623.   
  2624.     /* Deal with relocation information however is appropriate */
  2625.   
  2626. ***************
  2627. *** 3822,3828 ****
  2628.       }
  2629.     else
  2630.       {
  2631. !       reloc = (struct relocation_info *) alloca (entry->header.a_trsize);
  2632.         lseek (desc, text_offset (entry) + entry->header.a_text + entry->header.a_data, 0);
  2633.         if (entry->header.a_trsize != read (desc, reloc, entry->header.a_trsize))
  2634.       fatal_with_file ("premature eof in text relocation of ", entry);
  2635. --- 3828,3834 ----
  2636.       }
  2637.     else
  2638.       {
  2639. !       reloc = (struct relocation_info *) xmalloc (entry->header.a_trsize);
  2640.         lseek (desc, text_offset (entry) + entry->header.a_text + entry->header.a_data, 0);
  2641.         if (entry->header.a_trsize != read (desc, reloc, entry->header.a_trsize))
  2642.       fatal_with_file ("premature eof in text relocation of ", entry);
  2643. ***************
  2644. *** 3843,3848 ****
  2645. --- 3849,3858 ----
  2646.     /* Write the relocated text to the output file.  */
  2647.   
  2648.     mywrite (bytes, 1, entry->header.a_text, outdesc);
  2649. +   if (!entry->textrel)
  2650. +     free (reloc);
  2651. +   free (bytes);
  2652.   }
  2653.   
  2654.   /* Relocate the data segment of each input file
  2655. ***************
  2656. *** 3881,3887 ****
  2657.   
  2658.     desc = file_open (entry);
  2659.   
  2660. !   bytes = (char *) alloca (entry->header.a_data);
  2661.   
  2662.     if (entry->datarel) reloc = entry->datarel;
  2663.     else if (relocatable_output)    /* Will need this again */
  2664. --- 3891,3897 ----
  2665.   
  2666.     desc = file_open (entry);
  2667.   
  2668. !   bytes = (char *) xmalloc (entry->header.a_data);
  2669.   
  2670.     if (entry->datarel) reloc = entry->datarel;
  2671.     else if (relocatable_output)    /* Will need this again */
  2672. ***************
  2673. *** 3891,3897 ****
  2674.       }
  2675.     else
  2676.       {
  2677. !       reloc = (struct relocation_info *) alloca (entry->header.a_drsize);
  2678.         lseek (desc, text_offset (entry) + entry->header.a_text
  2679.            + entry->header.a_data + entry->header.a_trsize,
  2680.            0);
  2681. --- 3901,3907 ----
  2682.       }
  2683.     else
  2684.       {
  2685. !       reloc = (struct relocation_info *) xmalloc (entry->header.a_drsize);
  2686.         lseek (desc, text_offset (entry) + entry->header.a_text
  2687.            + entry->header.a_data + entry->header.a_trsize,
  2688.            0);
  2689. ***************
  2690. *** 3907,3912 ****
  2691. --- 3917,3926 ----
  2692.                 entry->header.a_data, reloc, entry->header.a_drsize, entry);
  2693.   
  2694.     mywrite (bytes, 1, entry->header.a_data, outdesc);
  2695. +   if (!entry->datarel)
  2696. +     free (reloc);
  2697. +   free (bytes);
  2698.   }
  2699.   
  2700.   /* Relocate ENTRY's text or data section contents.
  2701. ***************
  2702. *** 4290,4299 ****
  2703.        extra struct for each indirect symbol to hold the extra reference
  2704.        following. */
  2705.     struct nlist *buf
  2706. !     = (struct nlist *) alloca ((defined_global_sym_count
  2707. !                 + undefined_global_sym_count
  2708. !                 + global_indirect_count)
  2709. !                    * sizeof (struct nlist));
  2710.     /* Pointer for storing into BUF.  */
  2711.     register struct nlist *bufp = buf;
  2712.   
  2713. --- 4304,4313 ----
  2714.        extra struct for each indirect symbol to hold the extra reference
  2715.        following. */
  2716.     struct nlist *buf
  2717. !     = (struct nlist *) xmalloc ((defined_global_sym_count
  2718. !                  + undefined_global_sym_count
  2719. !                  + global_indirect_count)
  2720. !                 * sizeof (struct nlist));
  2721.     /* Pointer for storing into BUF.  */
  2722.     register struct nlist *bufp = buf;
  2723.   
  2724. ***************
  2725. *** 4306,4312 ****
  2726.     string_table_len = strtab_size;
  2727.   
  2728.     if (strip_symbols == STRIP_ALL)
  2729. !     return;
  2730.   
  2731.     /* Write the local symbols defined by the various files.  */
  2732.   
  2733. --- 4320,4329 ----
  2734.     string_table_len = strtab_size;
  2735.   
  2736.     if (strip_symbols == STRIP_ALL)
  2737. !     {
  2738. !       free (buf);
  2739. !       return;
  2740. !     }
  2741.   
  2742.     /* Write the local symbols defined by the various files.  */
  2743.   
  2744. ***************
  2745. *** 4319,4328 ****
  2746.        table from the global symbols written so far.  This must include
  2747.        extra space for the references following indirect outputs. */
  2748.   
  2749. !   strtab_vector = (char **) alloca ((num_hash_tab_syms
  2750. !                      + global_indirect_count) * sizeof (char *));
  2751. !   strtab_lens = (int *) alloca ((num_hash_tab_syms
  2752. !                  + global_indirect_count) * sizeof (int));
  2753.     strtab_index = 0;
  2754.   
  2755.     /* Scan the symbol hash table, bucket by bucket.  */
  2756. --- 4336,4345 ----
  2757.        table from the global symbols written so far.  This must include
  2758.        extra space for the references following indirect outputs. */
  2759.   
  2760. !   strtab_vector = (char **) xmalloc ((num_hash_tab_syms
  2761. !                       + global_indirect_count) * sizeof (char *));
  2762. !   strtab_lens = (int *) xmalloc ((num_hash_tab_syms
  2763. !                   + global_indirect_count) * sizeof (int));
  2764.     strtab_index = 0;
  2765.   
  2766.     /* Scan the symbol hash table, bucket by bucket.  */
  2767. ***************
  2768. *** 4436,4441 ****
  2769. --- 4453,4462 ----
  2770.     /* Write the strings for the global symbols.  */
  2771.   
  2772.     write_string_table ();
  2773. +   free (strtab_lens);
  2774. +   free (strtab_vector);
  2775. +   free (buf);
  2776.   }
  2777.   
  2778.   /* Write the local and debugger symbols of file ENTRY.
  2779. ***************
  2780. *** 4455,4461 ****
  2781.     /* Buffer to accumulate all the syms before writing them.
  2782.        It has one extra slot for the local symbol we generate here.  */
  2783.     struct nlist *buf
  2784. !     = (struct nlist *) alloca (entry->header.a_syms + sizeof (struct nlist));
  2785.     register struct nlist *bufp = buf;
  2786.   
  2787.     /* Upper bound on number of syms to be written here.  */
  2788. --- 4476,4482 ----
  2789.     /* Buffer to accumulate all the syms before writing them.
  2790.        It has one extra slot for the local symbol we generate here.  */
  2791.     struct nlist *buf
  2792. !     = (struct nlist *) xmalloc (entry->header.a_syms + sizeof (struct nlist));
  2793.     register struct nlist *bufp = buf;
  2794.   
  2795.     /* Upper bound on number of syms to be written here.  */
  2796. ***************
  2797. *** 4464,4471 ****
  2798.     /* Make tables that record, for each symbol, its name and its name's length.
  2799.        The elements are filled in by `assign_string_table_index'.  */
  2800.   
  2801. !   strtab_vector = (char **) alloca (max_syms * sizeof (char *));
  2802. !   strtab_lens = (int *) alloca (max_syms * sizeof (int));
  2803.     strtab_index = 0;
  2804.   
  2805.     /* Generate a local symbol for the start of this file's text.  */
  2806. --- 4485,4492 ----
  2807.     /* Make tables that record, for each symbol, its name and its name's length.
  2808.        The elements are filled in by `assign_string_table_index'.  */
  2809.   
  2810. !   strtab_vector = (char **) xmalloc (max_syms * sizeof (char *));
  2811. !   strtab_lens = (int *) xmalloc (max_syms * sizeof (int));
  2812.     strtab_index = 0;
  2813.   
  2814.     /* Generate a local symbol for the start of this file's text.  */
  2815. ***************
  2816. *** 4486,4492 ****
  2817.   
  2818.     /* Read the file's string table.  */
  2819.   
  2820. !   entry->strings = (char *) alloca (entry->string_size);
  2821.     read_entry_strings (file_open (entry), entry);
  2822.   
  2823.     for (; p < end; p++)
  2824. --- 4507,4513 ----
  2825.   
  2826.     /* Read the file's string table.  */
  2827.   
  2828. !   entry->strings = (char *) xmalloc (entry->string_size);
  2829.     read_entry_strings (file_open (entry), entry);
  2830.   
  2831.     for (; p < end; p++)
  2832. ***************
  2833. *** 4563,4569 ****
  2834.        using the data in vectors `strtab_vector' and `strtab_lens'.  */
  2835.   
  2836.     write_string_table ();
  2837. !   entry->strings = 0;        /* Since it will dissapear anyway.  */
  2838.   }
  2839.   
  2840.   /* Copy any GDB symbol segments from the input files to the output file.
  2841. --- 4584,4595 ----
  2842.        using the data in vectors `strtab_vector' and `strtab_lens'.  */
  2843.   
  2844.     write_string_table ();
  2845. !   free (entry->strings);
  2846. !   entry->strings = 0;
  2847. !   free (strtab_lens);
  2848. !   free (strtab_vector);
  2849. !   free (buf);
  2850.   }
  2851.   
  2852.   /* Copy any GDB symbol segments from the input files to the output file.
  2853.