home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1286 / gas-dbxpch.01
Text File  |  1990-12-28  |  13KB  |  482 lines

  1. *** ../gas-1.35.old/i386.c    Mon Mar  5 20:11:07 1990
  2. --- ./i386.c    Mon May  7 17:29:27 1990
  3. ***************
  4. *** 1042,1046 ****
  5.       /* I caught it failing with obstack_room == 6,
  6.          so I changed to <=   pace */
  7. !     if (obstack_room (&frags) <= 6) frag_new (0);
  8.       p = frag_more (1);
  9.       p[0] = t->base_opcode;
  10. --- 1042,1046 ----
  11.       /* I caught it failing with obstack_room == 6,
  12.          so I changed to <=   pace */
  13. !     if (obstack_room (&frags) <= 6) { frag_wane(frag_now);  frag_new (0); }
  14.       p = frag_more (1);
  15.       p[0] = t->base_opcode;
  16. *** ../gas-1.35.old/msomf.h    Mon May  7 17:26:26 1990
  17. --- ./msomf.h    Tue May  1 10:01:23 1990
  18. ***************
  19. *** 6,10 ****
  20. --- 6,13 ----
  21.   #define SDEF_CONST    3
  22.   #define SDEF_BSS    4
  23. + #define SDEF_SYMBOLS    5
  24. + #define SDEF_TYPES    6
  25.   #define SDEF_SIZE    4
  26. + #define SDEF_G_SIZE    6
  27.   
  28.   #define GDEF_DGROUP    1
  29. *** ../gas-1.35.old/write.c    Mon May  7 17:28:28 1990
  30. --- ./write.c    Tue May  1 16:45:59 1990
  31. ***************
  32. *** 48,51 ****
  33. --- 48,57 ----
  34.   #endif /* M_XENIX */
  35.   
  36. + #if __STDC__
  37. + #include <stddef.h>
  38. + #else
  39. + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  40. + #endif
  41.   void    append();
  42.   
  43. ***************
  44. *** 87,90 ****
  45. --- 93,99 ----
  46.   
  47.   static long int string_byte_count;
  48. + #ifdef M_XENIX
  49. + static long int stab_symbol_count;
  50. + #endif /* M_XENIX */
  51.   
  52.   static char *        the_object_file;
  53. ***************
  54. *** 154,157 ****
  55. --- 163,195 ----
  56.   }
  57.   
  58. + #ifdef M_XENIX
  59. + threads(type, trgt_thrd, frm_thrd)
  60. + int type;
  61. + int *trgt_thrd, *frm_thrd;
  62. + {
  63. +       switch (type)
  64. +       {
  65. +         case PRIVDATA:    *trgt_thrd = DATA_TGT_THREAD;
  66. +                 *frm_thrd = DGROUP_FRAME_THREAD;
  67. +                 break;
  68. +         case PRIVBSS:    *trgt_thrd = BSS_TGT_THREAD;
  69. +                 *frm_thrd = DGROUP_FRAME_THREAD;
  70. +                 break;
  71. +         case PRIVTEXT:    *trgt_thrd = TEXT_TGT_THREAD;
  72. +                 *frm_thrd = TEXT_FRAME_THREAD;
  73. +                 break;
  74. +         case PUBLICDATA:    *trgt_thrd = DATA_TGT_THREAD;
  75. +                 *frm_thrd = DGROUP_FRAME_THREAD;
  76. +                 break;
  77. +         case PUBLICTEXT:    *trgt_thrd = TEXT_TGT_THREAD;
  78. +                 *frm_thrd = TEXT_FRAME_THREAD;
  79. +                 break;
  80. +         default:        *trgt_thrd = CONST_TGT_THREAD;
  81. +                 *frm_thrd = DGROUP_FRAME_THREAD;
  82. +                 break;
  83. +       }
  84. + }
  85. + #endif /* M_XENIX */
  86.   void
  87.   write_object_file()
  88. ***************
  89. *** 377,381 ****
  90.       symbol_number = 0;
  91.   #else /* M_XENIX */
  92. !     symbol_number = 1;
  93.   #endif /* M_XENIX */
  94.   
  95. --- 415,419 ----
  96.       symbol_number = 0;
  97.   #else /* M_XENIX */
  98. !     symbol_number = 1;  stab_symbol_count = 0;
  99.   #endif /* M_XENIX */
  100.   
  101. ***************
  102. *** 409,418 ****
  103.           else
  104.               symbolP -> sy_number = 0;
  105.   #else /* M_XENIX */
  106.           symbolP -> sy_number = symbol_number ++;
  107.   #endif /* M_XENIX */
  108. - #ifndef M_XENIX
  109.   #ifndef    VMS
  110.           if (name)
  111.             {            /* Ordinary case. */
  112.           symbolP -> sy_name_offset = string_byte_count;
  113. --- 447,461 ----
  114.           else
  115.               symbolP -> sy_number = 0;
  116. +         if (symbolP->sy_nlist.n_type&N_STAB)
  117. +         stab_symbol_count++;
  118.   #else /* M_XENIX */
  119.           symbolP -> sy_number = symbol_number ++;
  120.   #endif /* M_XENIX */
  121.   #ifndef    VMS
  122. + #ifndef M_XENIX
  123.           if (name)
  124. + #else /* M_XENIX */
  125. +         if (name && symbolP->sy_nlist.n_type&N_STAB)
  126. + #endif /* M_XENIX */
  127.             {            /* Ordinary case. */
  128.           symbolP -> sy_name_offset = string_byte_count;
  129. ***************
  130. *** 421,425 ****
  131.           else            /* .Stabd case. */
  132.   #endif    /* not VMS */
  133. - #endif /* not M_XENIX */
  134.           symbolP -> sy_name_offset = 0;
  135.           symbolPP = & (symbolP -> sy_next);
  136. --- 464,467 ----
  137. ***************
  138. *** 757,761 ****
  139.     output_file_create (out_file_name);
  140.     omf_initialize_a_out(output_file_desc(), module_name, text_siz, data_siz,
  141. !                (long) local_bss_counter, 0L);
  142.   
  143.   /*  Traverse the symbol chain emitting external symbol definitions
  144. --- 799,805 ----
  145.     output_file_create (out_file_name);
  146.     omf_initialize_a_out(output_file_desc(), module_name, text_siz, data_siz,
  147. !                (long) local_bss_counter, 0L,
  148. !                flagseen['g'], stab_symbol_count * sizeof(struct nlist),
  149. !                string_byte_count);
  150.   
  151.   /*  Traverse the symbol chain emitting external symbol definitions
  152. ***************
  153. *** 783,787 ****
  154.     for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
  155.     {
  156. !       if (PUBLIC(symbolP->sy_type))
  157.       {
  158.           unsigned int group = 0, segment = 0;
  159. --- 827,831 ----
  160.     for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
  161.     {
  162. !     if (PUBLIC(symbolP->sy_type))
  163.       {
  164.           unsigned int group = 0, segment = 0;
  165. ***************
  166. *** 867,891 ****
  167.             int external = EXTDEF(symbolP->sy_type);
  168.   
  169. !           switch (symbolP->sy_type)
  170. !           {
  171. !             case PRIVDATA:    trgt_thrd = DATA_TGT_THREAD;
  172. !                     frm_thrd = DGROUP_FRAME_THREAD;
  173. !                     break;
  174. !             case PRIVBSS:    trgt_thrd = BSS_TGT_THREAD;
  175. !                     frm_thrd = DGROUP_FRAME_THREAD;
  176. !                     break;
  177. !             case PRIVTEXT:    trgt_thrd = TEXT_TGT_THREAD;
  178. !                     frm_thrd = TEXT_FRAME_THREAD;
  179. !                     break;
  180. !             case PUBLICDATA:    trgt_thrd = DATA_TGT_THREAD;
  181. !                     frm_thrd = DGROUP_FRAME_THREAD;
  182. !                     break;
  183. !             case PUBLICTEXT:    trgt_thrd = TEXT_TGT_THREAD;
  184. !                     frm_thrd = TEXT_FRAME_THREAD;
  185. !                     break;
  186. !             default:        trgt_thrd = CONST_TGT_THREAD;
  187. !                     frm_thrd = DGROUP_FRAME_THREAD;
  188. !                     break;
  189. !           }
  190.             if (fixP->fx_pcrel)
  191.               frm_thrd = TEXT_FRAME_THREAD;
  192. --- 911,915 ----
  193.             int external = EXTDEF(symbolP->sy_type);
  194.   
  195. !           threads(symbolP->sy_type, &trgt_thrd, &frm_thrd);
  196.             if (fixP->fx_pcrel)
  197.               frm_thrd = TEXT_FRAME_THREAD;
  198. ***************
  199. *** 959,983 ****
  200.             int external = EXTDEF(symbolP->sy_type);
  201.   
  202. !           switch (symbolP->sy_type)
  203. !           {
  204. !             case PRIVDATA:    trgt_thrd = DATA_TGT_THREAD;
  205. !                     frm_thrd = DGROUP_FRAME_THREAD;
  206. !                     break;
  207. !             case PRIVBSS:    trgt_thrd = BSS_TGT_THREAD;
  208. !                     frm_thrd = DGROUP_FRAME_THREAD;
  209. !                     break;
  210. !             case PRIVTEXT:    trgt_thrd = TEXT_TGT_THREAD;
  211. !                     frm_thrd = TEXT_FRAME_THREAD;
  212. !                     break;
  213. !             case PUBLICDATA:    trgt_thrd = DATA_TGT_THREAD;
  214. !                     frm_thrd = DGROUP_FRAME_THREAD;
  215. !                     break;
  216. !             case PUBLICTEXT:    trgt_thrd = TEXT_TGT_THREAD;
  217. !                     frm_thrd = TEXT_FRAME_THREAD;
  218. !                     break;
  219. !             default:        trgt_thrd = CONST_TGT_THREAD;
  220. !                     frm_thrd = DGROUP_FRAME_THREAD;
  221. !                     break;
  222. !           }
  223.             if (fixP->fx_pcrel)
  224.               frm_thrd = TEXT_FRAME_THREAD;
  225. --- 983,987 ----
  226.             int external = EXTDEF(symbolP->sy_type);
  227.   
  228. !           threads(symbolP->sy_type, &trgt_thrd, &frm_thrd);
  229.             if (fixP->fx_pcrel)
  230.               frm_thrd = TEXT_FRAME_THREAD;
  231. ***************
  232. *** 1004,1007 ****
  233. --- 1008,1140 ----
  234.         }
  235.     }
  236. + /*  Traverse the symbol chain emitting stabs.
  237. +  */
  238. + #define VAL_OFF offsetof(struct nlist, n_value)
  239. +   if (flagseen['g'] && stab_symbol_count)
  240. +   {   
  241. +       long count = 0, ncount = 0;
  242. +       symbolS *last_startP;
  243. +       char *temp;
  244. +       symbolS *fsymP;
  245. +       int i;
  246. +       int start_fixup = 0;
  247. +       omf_start_ledata(I386, SDEF_SYMBOLS, 0);
  248. +       last_startP = symbol_rootP;
  249. +       for (symbolP = symbol_rootP; symbolP; symbolP = symbolP -> sy_next)
  250. +       {
  251. +      if (symbolP->sy_nlist.n_type & N_STAB)
  252. +      {
  253. +             if ((ncount + 1) * sizeof(struct nlist) >= 1016)
  254. +             {
  255. +                omf_end_ledata();
  256. +                /* emit relocations */
  257. +                start_fixup = 0;
  258. +            for (i = 0, fsymP=last_startP; i < ncount; fsymP=fsymP->sy_next)
  259. +            {
  260. +               if (fsymP->sy_nlist.n_type & N_STAB)
  261. +           {
  262. +                      if (fsymP->sy_type & N_TYPE) /* if relocation required */
  263. +              {
  264. +                int trgt_thrd, frm_thrd;
  265. +                int external = EXTDEF(fsymP->sy_type & N_TYPE);
  266. +                threads(fsymP->sy_type & N_TYPE,&trgt_thrd,&frm_thrd);
  267. +                if (!start_fixup)
  268. +                {
  269. +                            omf_start_fixup(I386);
  270. +                start_fixup++;
  271. +                }
  272. +                omf_fixup(I386, 1, /* segment relative */
  273. +                   LOC_OFFSET32, i * sizeof(struct nlist) + VAL_OFF,
  274. +                   external ? 0 : 1,
  275. +                   external ? FRM_TRGT : frm_thrd,
  276. +                   external ? 0 : 1,
  277. +                   external ? TGT_EI : trgt_thrd,
  278. +                   1, /* No offset */
  279. +               0, /* No frame required */
  280. +                   external ? fsymP->sy_number : 0,
  281. +               0);
  282. +              }
  283. +              i++;
  284. +           }
  285. +            }
  286. +            if (start_fixup)
  287. +                   omf_end_fixup();
  288. +                /* start new segment */
  289. +                ncount = 0;  last_startP = symbolP;
  290. +                omf_start_ledata(I386, SDEF_SYMBOLS, count*sizeof(struct nlist));
  291. +             }
  292. +             temp = symbolP->sy_nlist.n_un.n_name;
  293. +             symbolP->sy_nlist.n_un.n_strx = symbolP->sy_name_offset;
  294. +             omf_ledata(&(symbolP->sy_nlist), sizeof(struct nlist));
  295. +             symbolP->sy_nlist.n_un.n_name = temp;
  296. +            ncount++;  count++;
  297. +      }
  298. +       }
  299. +       omf_end_ledata();
  300. +       start_fixup = 0;
  301. +       for (i = 0, fsymP = last_startP; i < ncount; fsymP = fsymP->sy_next)
  302. +       {
  303. +          if (fsymP->sy_nlist.n_type & N_STAB)
  304. +      {
  305. +             if (fsymP->sy_type & N_TYPE) /* if relocation required */
  306. +         {
  307. +           int trgt_thrd, frm_thrd;
  308. +           int external = EXTDEF(fsymP->sy_type & N_TYPE);
  309. +           threads(fsymP->sy_type & N_TYPE,&trgt_thrd,&frm_thrd);
  310. +           if (!start_fixup)
  311. +               {
  312. +                  omf_start_fixup(I386);
  313. +                  start_fixup++;
  314. +               }
  315. +           omf_fixup(I386, 1, /* segment relative */
  316. +              LOC_OFFSET32, i * sizeof(struct nlist) + VAL_OFF,
  317. +              external ? 0 : 1,
  318. +              external ? FRM_TRGT : frm_thrd,
  319. +              external ? 0 : 1,
  320. +              external ? TGT_EI : trgt_thrd,
  321. +              1, /* No offset */
  322. +                   0, /* No frame required */
  323. +              external ? fsymP->sy_number : 0,
  324. +           0);
  325. +         }
  326. +         i++;
  327. +      }
  328. +       }
  329. +       if (start_fixup)
  330. +          omf_end_fixup();
  331. +       count = sizeof(string_byte_count);  ncount = count;
  332. +       omf_start_ledata(I386, SDEF_TYPES, 0);
  333. +       omf_ledata(&string_byte_count, sizeof(string_byte_count));
  334. +       for (symbolP = symbol_rootP; symbolP; symbolP = symbolP -> sy_next)
  335. +       {
  336. +          if (symbolP->sy_nlist.n_type & N_STAB && symbolP -> sy_name)
  337. +      {
  338. +         int len = strlen(symbolP -> sy_name) + 1;
  339. +         if (ncount + len > 1016)
  340. +         {
  341. +            omf_end_ledata();
  342. +                omf_start_ledata(I386, SDEF_TYPES, count);
  343. +            ncount = 0;
  344. +         }
  345. +             omf_ledata(symbolP->sy_name, len);
  346. +         count += len;  ncount += len;
  347. +      }
  348. +       }
  349. +       omf_end_ledata();
  350. +   }
  351. +   
  352.     omf_modend(I386);
  353.     output_file_close (out_file_name);
  354. *** ../gas-1.35.old/xenixomf.c    Mon May  7 17:26:26 1990
  355. --- ./xenixomf.c    Wed May  2 11:03:47 1990
  356. ***************
  357. *** 544,548 ****
  358. --- 544,553 ----
  359.   #define L_UBSS        8
  360.   #define L_BSS        9
  361. + #define L_TYPES        10
  362. + #define L_DEBTYP    11
  363. + #define L_SYMBOLS    12
  364. + #define L_DEBSYM    13
  365.   #define L_TSIZE        9
  366. + #define L_G_TSIZE    13
  367.   
  368.   char *lnames_tab[] = {
  369. ***************
  370. *** 556,560 ****
  371.       "CONST",
  372.       "_BSS",
  373. !     "BSS"
  374.   };
  375.   
  376. --- 561,569 ----
  377.       "CONST",
  378.       "_BSS",
  379. !     "BSS",
  380. !     "$$TYPES",
  381. !     "DEBTYP",
  382. !     "$$SYMBOLS",
  383. !     "DEBSYM"
  384.   };
  385.   
  386. ***************
  387. *** 573,577 ****
  388.       {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UDATA, L_DATA},
  389.       {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_CONST, L_CONST},
  390. !     {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UBSS, L_BSS}
  391.   };
  392.   
  393. --- 582,588 ----
  394.       {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UDATA, L_DATA},
  395.       {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_CONST, L_CONST},
  396. !     {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UBSS, L_BSS},
  397. !     {SD_BYTE|SD_PGRES, 0, L_SYMBOLS, L_DEBSYM},
  398. !     {SD_BYTE|SD_PGRES, 0, L_TYPES, L_DEBTYP}
  399.   };
  400.   
  401. ***************
  402. *** 592,596 ****
  403.   #define NUMFIXEDCOMMENTS 4
  404.   
  405. ! static unsigned char gas_comment[] = "gas-1.34";
  406.   static unsigned char lib_comment[] = "SLIBCE";
  407.   static unsigned char model_comment[] = "3s";
  408. --- 603,607 ----
  409.   #define NUMFIXEDCOMMENTS 4
  410.   
  411. ! static unsigned char gas_comment[] = "gas-1.35c";
  412.   static unsigned char lib_comment[] = "SLIBCE";
  413.   static unsigned char model_comment[] = "3s";
  414. ***************
  415. *** 604,611 ****
  416.   };
  417.   
  418. ! void omf_initialize_a_out(fd, name, text_size, data_size, bss_size, const_size)
  419.   int fd;
  420.   unsigned char *name;
  421.   long text_size, data_size, bss_size, const_size;
  422.   {
  423.       int i;
  424. --- 615,625 ----
  425.   };
  426.   
  427. ! void omf_initialize_a_out(fd, name, text_size, data_size, bss_size, const_size,
  428. !               gdb, syms_size, str_size)
  429.   int fd;
  430.   unsigned char *name;
  431.   long text_size, data_size, bss_size, const_size;
  432. + int gdb;
  433. + long syms_size, str_size;
  434.   {
  435.       int i;
  436. ***************
  437. *** 622,626 ****
  438.   
  439.       omf_start_lnames();
  440. !     for (i = 1; i <= L_TSIZE; i++)
  441.           omf_lnames(lnames_tab[i]);
  442.       omf_end_lnames();
  443. --- 636,640 ----
  444.   
  445.       omf_start_lnames();
  446. !     for (i = 1; i <= (gdb ? L_G_TSIZE : L_TSIZE); i++)
  447.           omf_lnames(lnames_tab[i]);
  448.       omf_end_lnames();
  449. ***************
  450. *** 632,636 ****
  451.       segt[SDEF_BSS].length = bss_size;
  452.       segt[SDEF_CONST].length = const_size;
  453. !     for (i = 1; i <= SDEF_SIZE; i++)
  454.           omf_segdef(I386, segt[i].attrib, 0, 0L, segt[i].length,
  455.                  segt[i].nameindex, segt[i].classindex);
  456. --- 646,655 ----
  457.       segt[SDEF_BSS].length = bss_size;
  458.       segt[SDEF_CONST].length = const_size;
  459. !     if (gdb)
  460. !     {
  461. !         segt[SDEF_SYMBOLS].length = syms_size;
  462. !         segt[SDEF_TYPES].length = str_size;
  463. !     }
  464. !     for (i = 1; i <= (gdb ? SDEF_G_SIZE : SDEF_SIZE); i++)
  465.           omf_segdef(I386, segt[i].attrib, 0, 0L, segt[i].length,
  466.                  segt[i].nameindex, segt[i].classindex);
  467.