From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: hillman_97@yahoo.com Cc: binutils@sourceware.cygnus.com Subject: Re: binutils 2.9.1 gas problem (growing frags) Date: Thu, 01 Jul 1999 00:00:00 -0000 Message-id: <19990610185655.6055.qmail@daffy.airs.com> References: <19990610184019.22715.rocketmail@web113.yahoomail.com> <19990610184019.22715.rocketmail@web113.yahoomail.com> X-SW-Source: 1999-q2/msg00207.html Date: Thu, 10 Jun 1999 11:40:19 -0700 (PDT) From: Vaughan Hillman It appears that the assembler is reading in the stab entries from file.s and putting them into an obstack. Initially it allocates a frag with 4096 bytes to start off with. When line 184 of file.s is read in the function frag_grow() is called to see if this line can be read into the current frag. frag_grow is told to grow by 91 bytes. The current obstack has 88 bytes free (chunk_limit-next_free). frag_new() goes and takes care of the allocation by calling frag_alloc(). Here obstack_alloc() is called. It goes and allocates a frag for the stack. Since obstack_alloc is told to allocate SIZEOF_STRUCT_FRAG (which happens to be 84 bytes) bytes, obstack_blank returns saying that there was enough space for the 84 bytes (as we have 88 bytes free) and adds in the new frag header leaving 4 bytes. We return to frag_grow() having not allocated a larger frag and the code calls frag_new() again. This time obstack_blank() allows _obstack_newchunk() to be called since we are asking for 84 bytes and have 4 bytes free. It returns with 168 bytes and the 84 byte header is taken out again leaving us with 84 bytes. The code in frag_grow then exits saying that it was unsucessfull at getting any more memory added to the obstack. I think this problem has been fixed since the 2.9.1 release. Look at the current version of frag_grow in frags.c. If you can't get CVS to work for you, use the cvsweb interface. For example, the current frags.c can be seen at http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/binutils/gas/frags.c?rev=1.1.1.1 &content-type=text/x-cvsweb-markup&cvsroot=binutils Ian