X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 1 Mar 2011 18:39:06 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: ld: fatal error - cmalloc would have returned NULL Message-ID: <20110301173906.GA11632@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4D6D2C41 DOT 5010503 AT emrich-ebersheim DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4D6D2C41.5010503@emrich-ebersheim.de> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mar 1 18:26, Rainer Emrich wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Any news on this issue? > > At the moment it's impossible to build libgcj during bootstrap of gcc! > > I tried 1.7.7-1 and the snapshot 20110227. > > Here some diagnostic: > > 288 117500220 [main] ld 5884 mmap64: 0x600E0000 = mmap() > 4283 117504503 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd > - -1, off 0 > 306 117504809 [main] ld 5884 mmap64: 0x600D0000 = mmap() > 4296 117509105 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd > - -1, off 0 > 290 117509395 [main] ld 5884 mmap64: 0x600C0000 = mmap() > 3883 117513278 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd > - -1, off 0 > 416 117513694 [main] ld 5884 mmap64: 0x600B0000 = mmap() > 4503 117518197 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd > - -1, off 0 This looks like a problem in ld. It uses mmap a lot. In fact it uses mmap so much that the memory allocation (which goes from top to bottom addresses) reaches the end of the Cygwin DLL itself and beyond that. And it doesn't mmap in a few big chunks, but rather in many small chunks. > 490 117518687 [main] ld 5884 seterrno_from_win_error: > /ext/build/netrel/src/cygwin-snapshot-20110227-1/winsup/cygwin/cygheap.cc:145 > windows error 487 > 41 117518728 [main] ld 5884 geterrno_from_win_error: windows error 487 == > errno 22 > 42 117518770 [main] ld 5884 __set_errno: void* creturn(cygheap_types, > cygheap_entry*, unsigned int, const char*):265 val 12 Every mmap call needs space on the cygheap, which is a special heap to keep inforamtion for later fork or exec calls. The cygheap resides at the end of the Cygwin DLL. If it's space is insufficient, the Cygwin DLL tries to extend it. But it can't, because the memory slot is already taken by one of the many mmap calls. > 45 117518815 [main] ld 5884 mmap64: 0xFFFFFFFF = mmap() > 40 117518855 [main] ld 5884 __set_errno: void* sbrk(int):167 val 12 > 36 117518891 [main] ld 5884 __set_errno: void __set_ENOMEM():304 val 12 Therefore, the last mmap call fails and returns MAP_FAILED with errno set to ENOMEM. > - --- Process 5884, exception C0000005 at 0042903A And then ld crashes, because, apparently, it neglects to check the return value of mmap. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple