home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1973 < prev    next >
Internet Message Format  |  1990-12-28  |  20KB

  1. From: loic@adesign.uucp (Loic Dachary)
  2. Newsgroups: alt.sources
  3. Subject: gas-1.36 patches for COFF generation
  4. Message-ID: <LOIC.90Oct16093556@adesign.uucp>
  5. Date: 16 Oct 90 08:35:56 GMT
  6.  
  7. *** struc-symbol.h    Fri May 12 19:45:21 1989
  8. --- /lasvegas/spare/usenet/port/gas-1.36/struc-symbol.h    Mon Oct 15 08:41:38 1990
  9. ***************
  10. *** 17,31 ****
  11.   along with GAS; see the file COPYING.  If not, write to
  12.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  13.   
  14. - #ifndef        VMS
  15. - #include "a.out.h"        /* Needed to define struct nlist. Sigh. */
  16. - #else
  17. - #include "a_out.h"
  18. - #endif
  19.   struct symbol            /* our version of an nlist node */
  20.   {
  21. !   struct nlist    sy_nlist;    /* what we write in .o file (if permitted) */
  22.     long unsigned sy_name_offset;    /* 4-origin position of sy_name in symbols */
  23.                   /* part of object file. */
  24.                   /* 0 for (nameless) .stabd symbols. */
  25. --- 17,25 ----
  26.   along with GAS; see the file COPYING.  If not, write to
  27.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  28.   
  29.   struct symbol            /* our version of an nlist node */
  30.   {
  31. !   symbol_type   sy_symbol;      /* what we write in .o file (if permitted) */
  32.     long unsigned sy_name_offset;    /* 4-origin position of sy_name in symbols */
  33.                   /* part of object file. */
  34.                   /* 0 for (nameless) .stabd symbols. */
  35. ***************
  36. *** 34,54 ****
  37.                   /* Symbol numbers start at 0 and are */
  38.                   /* unsigned. */
  39.     struct symbol * sy_next;    /* forward chain, or NULL */
  40.     struct frag *    sy_frag;    /* NULL or -> frag this symbol attaches to. */
  41.     struct symbol *sy_forward;    /* value is really that of this other symbol */
  42.   };
  43.   
  44.   typedef struct symbol symbolS;
  45.   
  46. ! #define sy_name        sy_nlist .n_un. n_name
  47.                   /* Name field always points to a string. */
  48.                   /* 0 means .stabd-like anonymous symbol. */
  49. ! #define sy_type     sy_nlist.    n_type
  50. ! #define sy_other    sy_nlist.    n_other
  51. ! #define sy_desc        sy_nlist.    n_desc
  52. ! #define sy_value    sy_nlist.    n_value
  53.                   /* Value of symbol is this value + object */
  54.                   /* file address of sy_frag. */
  55.   
  56.   typedef unsigned valueT;    /* The type of n_value. Helps casting. */
  57.   
  58. --- 28,71 ----
  59.                   /* Symbol numbers start at 0 and are */
  60.                   /* unsigned. */
  61.     struct symbol * sy_next;    /* forward chain, or NULL */
  62. + #ifdef coff
  63. +   struct symbol * sy_previous;    /* backward chain, or NULL */
  64. + #endif /* coff */
  65.     struct frag *    sy_frag;    /* NULL or -> frag this symbol attaches to. */
  66.     struct symbol *sy_forward;    /* value is really that of this other symbol */
  67. + #ifdef coff
  68. +   unsigned int sy_flags;    /* Internal use only flags (see coff.h) */
  69. +   AUXENT sy_auxent;        /* Auxiliary entry. */
  70. + #endif /* coff */
  71.   };
  72.   
  73.   typedef struct symbol symbolS;
  74.   
  75. ! #ifdef coff
  76. ! #define sy_name        sy_symbol.n_name    /* Symbol name */
  77. ! #define sy_zeroes    sy_symbol.n_zeroes    /* All 0 if pointer to str. */
  78. ! #define sy_offset    sy_symbol.n_offset    /* Offset in string table */
  79. ! #define    sy_value    sy_symbol.n_value    /* Symbol 0 or ptr in file */
  80. ! #define sy_scnum    sy_symbol.n_scnum    /* Section number */
  81. ! #define sy_type        sy_symbol.n_type    /* Type and derived type */
  82. ! #define sy_sclass    sy_symbol.n_sclass    /* Storage class */
  83. ! #define sy_numaux    sy_symbol.n_numaux    /* Number of aux. entries */
  84. ! #else /* coff */
  85. ! #define sy_name        sy_symbol.n_un.n_name
  86.                   /* Name field always points to a string. */
  87.                   /* 0 means .stabd-like anonymous symbol. */
  88. ! #define sy_strx        sy_symbol.n_un.n_strx
  89. ! #define sy_type     sy_symbol.n_type
  90. ! #define sy_other    sy_symbol.n_other
  91. ! #define sy_desc        sy_symbol.n_desc
  92. ! #define sy_value    sy_symbol.n_value
  93.                   /* Value of symbol is this value + object */
  94.                   /* file address of sy_frag. */
  95. + #endif /* coff */
  96.   
  97.   typedef unsigned valueT;    /* The type of n_value. Helps casting. */
  98.   
  99. *** subsegs.c    Wed Mar  1 23:48:46 1989
  100. --- /lasvegas/spare/usenet/port/gas-1.36/subsegs.c    Wed Sep 12 09:28:57 1990
  101. ***************
  102. *** 21,26 ****
  103. --- 21,27 ----
  104.    * Segments & sub-segments.
  105.    */
  106.   
  107. + #include "oformat.h"
  108.   #include "as.h"
  109.   #include "subsegs.h"
  110.   #include "obstack.h"
  111. ***************
  112. *** 33,40 ****
  113. --- 34,95 ----
  114.       *    data0_frchainP;
  115.   
  116.   
  117. + #ifdef coff
  118.   int                /* in: segT   out: N_TYPE bits */
  119.   seg_N_TYPE[] = {
  120. +   C_ABS_SECTION,
  121. +   C_TEXT_SECTION,
  122. +   C_DATA_SECTION,
  123. +   C_BSS_SECTION,
  124. +   C_UNDEF_SECTION,        /* SEG_UNKNOWN */
  125. +   C_UNDEF_SECTION,        /* SEG_NONE */
  126. +   C_UNDEF_SECTION,        /* SEG_PASS1 */
  127. +   C_UNDEF_SECTION,        /* SEG_GOOF */
  128. +   C_UNDEF_SECTION,        /* SEG_BIG */
  129. +   C_UNDEF_SECTION,        /* SEG_DIFFERENCE */
  130. +   C_DEBUG_SECTION,        /* SEG_DEBUG */
  131. +   C_NTV_SECTION,        /* SEG_NTV */
  132. +   C_PTV_SECTION,        /* SEG_PTV */
  133. + };
  134. + char *                /* in: segT   out: char* */
  135. + seg_name[] = {
  136. +   "absolute",
  137. +   "text",
  138. +   "data",
  139. +   "bss",
  140. +   "unknown",
  141. +   "absent",
  142. +   "pass1",
  143. +   "ASSEMBLER-INTERNAL-LOGIC-ERROR!",
  144. +   "bignum/flonum",
  145. +   "difference",
  146. +   "debug",
  147. +   "transfert vector preload",
  148. +   "transfert vector postload",
  149. +   ""
  150. +   };                /* Used by error reporters, dumpers etc. */
  151. + /* Add 4 to the real value to get the index and compensate the negatives */
  152. + segT N_TYPE_seg [32] =
  153. + {
  154. +   SEG_PTV,            /* C_PTV_SECTION    == -4    */
  155. +   SEG_NTV,            /* C_NTV_SECTION    == -3    */
  156. +   SEG_DEBUG,            /* C_DEBUG_SECTION    == -2     */
  157. +   SEG_ABSOLUTE,            /* C_ABS_SECTION    == -1    */
  158. +   SEG_UNKNOWN,            /* C_UNDEF_SECTION    == 0     */
  159. +   SEG_TEXT,            /* C_TEXT_SECTION    == 1    */
  160. +   SEG_DATA,            /* C_DATA_SECTION    == 2    */
  161. +   SEG_BSS,            /* C_BSS_SECTION    == 3    */
  162. +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,
  163. +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,
  164. +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF
  165. + };
  166. + #else /* coff */
  167. + int                /* in: segT   out: N_TYPE bits */
  168. + seg_N_TYPE[] = {
  169.     N_ABS,
  170.     N_TEXT,
  171.     N_DATA,
  172. ***************
  173. *** 78,83 ****
  174. --- 133,139 ----
  175.     SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
  176.     SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF
  177.   };
  178. + #endif /* coff */
  179.   
  180.   void
  181.   subsegs_begin()
  182. *** symbols.c    Fri Apr  6 17:51:22 1990
  183. --- /lasvegas/spare/usenet/port/gas-1.36/symbols.c    Mon Oct 15 10:30:08 1990
  184. ***************
  185. *** 18,23 ****
  186. --- 18,24 ----
  187.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  188.   
  189.   
  190. + #include "oformat.h"
  191.   #include "as.h"
  192.   #include "hash.h"
  193.   #include "obstack.h"        /* For "symbols.h" */
  194. ***************
  195. *** 38,43 ****
  196. --- 39,49 ----
  197.   symbolS * symbol_rootP;
  198.   symbolS * symbol_lastP;
  199.   symbolS    abs_symbol;
  200. + symbolS*        dot_text_symbol;
  201. + symbolS*        dot_data_symbol;
  202. + symbolS*        dot_bss_symbol;
  203.   struct obstack    notes;
  204.   
  205.   
  206. ***************
  207. *** 84,90 ****
  208.     symbol_rootP = NULL;        /* In case we have 0 symbols (!!) */
  209.     sy_hash = hash_new();
  210.     bzero ((char *)(& abs_symbol), sizeof(abs_symbol));
  211. !   abs_symbol . sy_type = N_ABS;    /* Can't initialise a union. Sigh. */
  212.     bzero ((char *)(local_label_counter), sizeof(local_label_counter) );
  213.     local_bss_counter = 0;
  214.   }
  215. --- 90,96 ----
  216.     symbol_rootP = NULL;        /* In case we have 0 symbols (!!) */
  217.     sy_hash = hash_new();
  218.     bzero ((char *)(& abs_symbol), sizeof(abs_symbol));
  219. !   S_SET_ABS(&abs_symbol);    /* Can't initialise a union. Sigh. */
  220.     bzero ((char *)(local_label_counter), sizeof(local_label_counter) );
  221.     local_bss_counter = 0;
  222.   }
  223. ***************
  224. *** 157,162 ****
  225. --- 163,237 ----
  226.    * Changes since 1985: Symbol names may not contain '\0'. Sigh.
  227.    */
  228.   
  229. + #ifdef coff
  230. + symbolS *
  231. + symbol_new (name, segment, value, sclass, frag)
  232. + char*        name;     /* It is copied, the caller can destroy/modify */
  233. + segT        segment;/* Segment identifier (SEG_<something>) */
  234. + long        value;  /* Symbol value */
  235. + short        sclass; /* Symbol storage class */
  236. + fragS*        frag;    /* Associated fragment */
  237. + {
  238. +     register unsigned int    name_length;
  239. +     register char*        name_copy;
  240. +     register symbolS*        symbolP;
  241. +     register char        underscore = 0;      /* Symbol has leading _ */
  242. + #if STRIP_UNDERSCORE
  243. +     /* Remove leading underscore at the beginning of the symbol.
  244. +      * This is to be compatible with the standard librairies.
  245. +      */
  246. +     if(*name == '_') {
  247. +     underscore = 1;
  248. +     name++;
  249. +     } else
  250. +     underscore = 0;
  251. + #endif /* STRIP_UNDERSCORE */
  252. +     name_length = strlen(name) + 1; /* +1 for \0 */
  253. +     obstack_grow(¬es, name, name_length);
  254. +     name_copy = obstack_finish(¬es);
  255. +     symbolP = (symbolS *)obstack_alloc(¬es, sizeof(symbolS));
  256. +     
  257. +     /* Effective symbol */
  258. +     /* Store the pointer in the offset. */
  259. +     symbolP->sy_offset        = (long unsigned)name_copy;
  260. +     symbolP->sy_zeroes        = 0L;
  261. +     symbolP->sy_value        = value;
  262. +     symbolP->sy_scnum        = seg_SEG(segment);
  263. +     symbolP->sy_type        = T_NULL;
  264. +     symbolP->sy_sclass        = sclass;
  265. +     symbolP->sy_numaux        = 0;
  266. +     /* Additional information */
  267. +     symbolP->sy_next        = NULL;
  268. +     symbolP->sy_frag        = frag;
  269. +     symbolP->sy_forward        = NULL;
  270. +     symbolP->sy_name_offset    = ~0;
  271. +     symbolP->sy_number        = ~0;
  272. +     symbolP->sy_flags        = 0;
  273. +     /* Auxiliary entries */
  274. +     memset((char*)&symbolP->sy_auxent, '\0', AUXESZ);
  275. +     if(S_IS_STRING(symbolP))
  276. +     SF_SET_STRING(symbolP);
  277. +     if(!underscore && S_IS_LOCAL(symbolP))
  278. +     SF_SET_LOCAL(symbolP);
  279. +     /*
  280. +      * Link to end of symbol chain .
  281. +      */
  282. +     if (symbol_lastP) {
  283. +     symbol_lastP->sy_next = symbolP;
  284. +     symbolP->sy_previous = symbol_lastP;
  285. +     } else {
  286. +     symbol_rootP = symbolP;
  287. +     }
  288. +     symbol_lastP = symbolP;
  289. +     
  290. +     return (symbolP);
  291. + }
  292. + #else /* coff */
  293.   symbolS *
  294.   symbol_new (name, type, other, desc, value, frag)
  295.        char *        name;    /* We copy this: OK to alter your copy. */
  296. ***************
  297. *** 165,171 ****
  298.        short int        desc;    /* As in <a.out.h>. */
  299.        valueT        value;    /* As in <a.out.h>, often an address. */
  300.                   /* Often used as offset from frag address. */
  301. !      struct frag *    frag;    /* For sy_frag. */
  302.   {
  303.     register symbolS *        symbolP;
  304.     register char *        preserved_copy_of_name;
  305. --- 240,246 ----
  306.        short int        desc;    /* As in <a.out.h>. */
  307.        valueT        value;    /* As in <a.out.h>, often an address. */
  308.                   /* Often used as offset from frag address. */
  309. !      fragS*         frag;    /* For sy_frag. */
  310.   {
  311.     register symbolS *        symbolP;
  312.     register char *        preserved_copy_of_name;
  313. ***************
  314. *** 177,184 ****
  315.     p=obstack_finish(¬es);
  316.     /* obstack_1done( ¬es, name, name_length, &p ); */
  317.     preserved_copy_of_name = p;
  318. !   p=obstack_alloc(¬es,sizeof(struct symbol));
  319. !   /* obstack_1blank( ¬es, sizeof(struct symbol), &p ); */
  320.     symbolP            = (symbolS *) p;
  321.     symbolP -> sy_name        = preserved_copy_of_name;
  322.     symbolP -> sy_type        = type;
  323. --- 252,259 ----
  324.     p=obstack_finish(¬es);
  325.     /* obstack_1done( ¬es, name, name_length, &p ); */
  326.     preserved_copy_of_name = p;
  327. !   p=obstack_alloc(¬es,sizeof(symbolS));
  328. !   /* obstack_1blank( ¬es, sizeof(symbolS), &p ); */
  329.     symbolP            = (symbolS *) p;
  330.     symbolP -> sy_name        = preserved_copy_of_name;
  331.     symbolP -> sy_type        = type;
  332. ***************
  333. *** 207,212 ****
  334. --- 282,289 ----
  335.   
  336.     return (symbolP);
  337.   }
  338. + #endif /* coff */
  339.   
  340.   /*
  341.    *            colon()
  342. ***************
  343. *** 222,228 ****
  344.        register char *  sym_name; /* symbol name, as a cannonical string */
  345.                   /* We copy this string: OK to alter later. */
  346.   {
  347. !   register struct symbol * symbolP; /* symbol we are working with */
  348.   
  349.   #ifdef SUN_ASM_SYNTAX
  350.     /* Sun local labes go out of scope whenever a non-local symbol is
  351. --- 299,305 ----
  352.        register char *  sym_name; /* symbol name, as a cannonical string */
  353.                   /* We copy this string: OK to alter later. */
  354.   {
  355. !   register symbolS * symbolP; /* symbol we are working with */
  356.   
  357.   #ifdef SUN_ASM_SYNTAX
  358.     /* Sun local labes go out of scope whenever a non-local symbol is
  359. ***************
  360. *** 264,270 ****
  361.          *    If the new symbol is .comm AND it has a size of zero,
  362.          *    we ignore it (i.e. the old symbol overrides it)
  363.          */
  364. !       if ((seg_N_TYPE [(int) now_seg] == (N_UNDF | N_EXT)) &&
  365.         ((obstack_next_free(& frags) - frag_now -> fr_literal) == 0))
  366.           return;
  367.         /*
  368. --- 341,347 ----
  369.          *    If the new symbol is .comm AND it has a size of zero,
  370.          *    we ignore it (i.e. the old symbol overrides it)
  371.          */
  372. !       if ((seg_SEG((int) now_seg) == (N_UNDF | N_EXT)) &&
  373.         ((obstack_next_free(& frags) - frag_now -> fr_literal) == 0))
  374.           return;
  375.         /*
  376. ***************
  377. *** 275,281 ****
  378.         (symbolP->sy_value == 0)) {
  379.             symbolP -> sy_frag  = frag_now;
  380.             symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
  381. !           symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
  382.             return;
  383.         }
  384.   #endif    /* VMS */
  385. --- 352,358 ----
  386.         (symbolP->sy_value == 0)) {
  387.             symbolP -> sy_frag  = frag_now;
  388.             symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
  389. !           symbolP -> sy_type |= seg_SEG((int) now_seg); /* keep N_EXT bit */
  390.             return;
  391.         }
  392.   #endif    /* VMS */
  393. ***************
  394. *** 282,297 ****
  395.         /*
  396.          *    Now check for undefined symbols
  397.          */
  398. !       if ((symbolP -> sy_type & N_TYPE) == N_UNDF)
  399.       {
  400. !       if(   symbolP -> sy_other == 0
  401. !          && symbolP -> sy_desc  == 0
  402. !          && symbolP -> sy_value == 0)
  403.           {
  404.             symbolP -> sy_frag  = frag_now;
  405. !           symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
  406. !           know( N_UNDF == 0 );
  407. !           symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
  408.           }
  409.         else
  410.           {
  411. --- 359,382 ----
  412.         /*
  413.          *    Now check for undefined symbols
  414.          */
  415. !       if (!S_IS_DEFINED(symbolP))
  416.       {
  417. !       if(
  418. ! #ifdef aout
  419. !          S_GET_OTHER(symbolP) == 0 &&
  420. !          S_GET_DESC(symbolP)  == 0 &&
  421. ! #endif /* aout */
  422. !          S_GET_VALUE(symbolP) == 0)
  423.           {
  424.             symbolP -> sy_frag  = frag_now;
  425. !           S_SET_VALUE(symbolP, obstack_next_free(& frags) - 
  426. !                        frag_now -> fr_literal);
  427. !           switch(now_seg) {
  428. !         case SEG_TEXT: S_SET_TEXT(symbolP); break;
  429. !         case SEG_DATA: S_SET_DATA(symbolP); break;
  430. !         case SEG_BSS: S_SET_BSS(symbolP); break;
  431. !         case SEG_ABSOLUTE: S_SET_ABS(symbolP); break;
  432. !           }
  433.           }
  434.         else
  435.           {
  436. ***************
  437. *** 303,309 ****
  438.              *        A .comm/.lcomm symbol being redefined with
  439.              *            a larger size is also OK
  440.              */
  441. !           char New_Type = seg_N_TYPE [(int) now_seg];
  442.             if (((symbolP->sy_type == (N_UNDF | N_EXT)) ||
  443.              (symbolP->sy_type == N_BSS)) &&
  444.             (((New_Type & ~N_EXT) == N_DATA) ||
  445. --- 388,394 ----
  446.              *        A .comm/.lcomm symbol being redefined with
  447.              *            a larger size is also OK
  448.              */
  449. !           char New_Type = seg_SEG((int) now_seg);
  450.             if (((symbolP->sy_type == (N_UNDF | N_EXT)) ||
  451.              (symbolP->sy_type == N_BSS)) &&
  452.             (((New_Type & ~N_EXT) == N_DATA) ||
  453. ***************
  454. *** 331,345 ****
  455.                    */
  456.                   symbolP -> sy_frag  = frag_now;
  457.                   symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
  458. !                 symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
  459.               }
  460.             } else {
  461.   #endif    /* VMS */
  462.             as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.%d.%d.",
  463.                 sym_name,
  464. !               seg_name [(int) N_TYPE_seg [symbolP -> sy_type & N_TYPE]],
  465. !               symbolP -> sy_other, symbolP -> sy_desc,
  466. !               symbolP -> sy_value);
  467.   #ifdef    VMS
  468.           }
  469.   #endif    /* VMS */
  470. --- 416,437 ----
  471.                    */
  472.                   symbolP -> sy_frag  = frag_now;
  473.                   symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
  474. !                 symbolP -> sy_type |= seg_SEG((int) now_seg); /* keep N_EXT bit */
  475.               }
  476.             } else {
  477.   #endif    /* VMS */
  478. + #ifdef coff
  479. +           as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.",
  480. +               sym_name,
  481. +               segment_name((int)SEG_seg(S_GET_SEGMENT(symbolP))),
  482. +               S_GET_VALUE(symbolP));
  483. + #else /* coff */
  484.             as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.%d.%d.",
  485.                 sym_name,
  486. !               segment_name((int)SEG_seg(S_GET_SEGMENT(symbolP))),
  487. !               S_GET_OTHER(symbolP), S_GET_DESC(symbolP),
  488. !               S_GET_VALUE(symbolP));
  489. ! #endif /* coff */
  490.   #ifdef    VMS
  491.           }
  492.   #endif    /* VMS */
  493. ***************
  494. *** 352,363 ****
  495.       }
  496.     else
  497.       {
  498.         symbolP = symbol_new (sym_name,
  499. !                 (unsigned char)(seg_N_TYPE [(int) now_seg]),
  500.                   0,
  501.                   0,
  502.                   (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
  503.                   frag_now);
  504.         symbol_table_insert (symbolP);
  505.       }
  506.   }
  507. --- 444,461 ----
  508.       }
  509.     else
  510.       {
  511. + #ifdef coff
  512. +       symbolP = symbol_new (sym_name, now_seg, 
  513. +                 (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
  514. +                 0, frag_now);
  515. + #else /* coff */
  516.         symbolP = symbol_new (sym_name,
  517. !                 (unsigned char)(seg_SEG((int) now_seg)),
  518.                   0,
  519.                   0,
  520.                   (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
  521.                   frag_now);
  522. + #endif /* coff */
  523.         symbol_table_insert (symbolP);
  524.       }
  525.   }
  526. ***************
  527. *** 372,387 ****
  528.   
  529.   void
  530.   symbol_table_insert (symbolP)
  531. !      struct symbol *    symbolP;
  532.   {
  533.     register char *    error_string;
  534.   
  535. !   know( symbolP );
  536. !   know( symbolP -> sy_name );
  537. !   if ( * (error_string = hash_jam (sy_hash, symbolP -> sy_name, (char *)symbolP)))
  538.       {
  539.         as_fatal( "Inserting \"%s\" into symbol table failed: %s",
  540. !           symbolP -> sy_name, error_string);
  541.       }
  542.   }
  543.   
  544. --- 470,487 ----
  545.   
  546.   void
  547.   symbol_table_insert (symbolP)
  548. !      symbolS *    symbolP;
  549.   {
  550.     register char *    error_string;
  551.   
  552. !   know(symbolP);
  553. !   know(S_GET_NAME(symbolP));
  554. !   if ( * (error_string = hash_jam (sy_hash, S_GET_NAME(symbolP),
  555. !                    (char *)symbolP)))
  556.       {
  557.         as_fatal( "Inserting \"%s\" into symbol table failed: %s",
  558. !           S_GET_NAME(symbolP), error_string);
  559.       }
  560.   }
  561.   
  562. ***************
  563. *** 392,409 ****
  564.    * it into the symbol table. Return a pointer to it.
  565.    */
  566.   symbolS *
  567. ! symbol_find_or_make (name)
  568. !      char *    name;
  569.   {
  570. !   register symbolS *    symbolP;
  571.   
  572. !   symbolP = symbol_table_lookup (name);
  573. !   if (symbolP == NULL)
  574. !     {
  575. !       symbolP = symbol_new (name, N_UNDF, 0, 0, 0, & zero_address_frag);
  576. !       symbol_table_insert (symbolP);
  577. !     }
  578. !   return (symbolP);
  579.   }
  580.   
  581.   /*
  582. --- 492,514 ----
  583.    * it into the symbol table. Return a pointer to it.
  584.    */
  585.   symbolS *
  586. !     symbol_find_or_make (name)
  587. ! char *    name;
  588.   {
  589. !     register symbolS *    symbolP;
  590.   
  591. !     symbolP = symbol_table_lookup (name);
  592. !     if (symbolP == NULL)
  593. !     {
  594. ! #ifdef coff 
  595. !         symbolP = symbol_new (name, SEG_UNKNOWN, 0, 0, &zero_address_frag);
  596. ! #else /* coff */
  597. !         symbolP = symbol_new (name, N_UNDF, 0, 0, 0, & zero_address_frag);
  598. ! #endif /* coff */
  599. !         symbol_table_insert (symbolP);
  600. !     }
  601. !     return (symbolP);
  602.   }
  603.   
  604.   /*
  605. ***************
  606. *** 417,426 ****
  607.   
  608.   symbolS *
  609.   symbol_find (name)
  610. !      char *    name;
  611.   {
  612. !   return ( (symbolS *) hash_find( sy_hash, name ));
  613.   }
  614.   
  615.   
  616.   /* end: symbols.c */
  617. --- 522,539 ----
  618.   
  619.   symbolS *
  620.   symbol_find (name)
  621. ! char* name;
  622.   {
  623. !     return symbol_find_base(name, STRIP_UNDERSCORE);
  624.   }
  625.   
  626. + symbolS *
  627. + symbol_find_base (name, strip_underscore)
  628. +      char *    name;
  629. + int strip_underscore;
  630. + {
  631. +     if(strip_underscore && *name == '_') name++;
  632. +     return ( (symbolS *) hash_find( sy_hash, name ));
  633. + }
  634.   
  635.   /* end: symbols.c */
  636. *** symbols.h    Wed Mar  1 23:48:43 1989
  637. --- /lasvegas/spare/usenet/port/gas-1.36/symbols.h    Mon Oct 15 10:29:43 1990
  638. ***************
  639. *** 30,36 ****
  640. --- 30,41 ----
  641.   
  642.   extern symbolS    abs_symbol;
  643.   
  644. + extern symbolS*        dot_text_symbol;
  645. + extern symbolS*        dot_data_symbol;
  646. + extern symbolS*        dot_bss_symbol;
  647.   symbolS *    symbol_find();
  648. + symbolS *    symbol_find_base();
  649.   void        symbol_begin();
  650.   char *        local_label_name();
  651.   void        local_colon();
  652. --
  653. Loic Dachary     loic@adesign.uucp or loic@afp.uucp 
  654. Voice        +33 1 40 35 20 20
  655.