X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4A323311.7040407@gmail.com> Date: Fri, 12 Jun 2009 11:50:57 +0100 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: 1.7.0 sem_open References: <94b5b62d0906112150g473b49fao41f95c3a1c6e6014 AT mail DOT gmail DOT com> <20090612084932 DOT GC5039 AT calimero DOT vinschen DOT de> In-Reply-To: <20090612084932.GC5039@calimero.vinschen.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Corinna Vinschen wrote: > On Jun 12 01:50, Pedro Izecksohn wrote: >> Also: gcc4 does not understand the option "-lrt" so it must be removed. > > Even if linking against librt.a would be necessary on Cygwin, which it > isn't, the gcc call is wrong. The libs must always follow the object > files which request symbols from the lib: > > gcc -lfoo need-foo.c <-- wrong > gcc need-foo.c -lfoo <-- right > > That's a restriction of ... I'm not quite sure, either some Windows > rules or in the ld implementation when building PE/COFF files. It's a combination of two things: 1. On all platforms, link order is vital. On all platforms, if you mention the lib first on the link line and only later mention the object that has references to it, those references will be unresolved in the final object. 2. ELF allows undefined symbols in fully-linked objects, because it has dynamic symbol resolution at load time. PE doesn't resolve symbols at load time, every symbol has to be defined at final link time. So therefore the link order only creates a problem on PE because the unresolved symbols it leads to are only a problem on PE. cheers, DaveK -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/