1.7.0 sem_open
Dave Korn
dave.korn.cygwin@googlemail.com
Fri Jun 12 10:39:00 GMT 2009
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/
More information about the Cygwin
mailing list