This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] PE direct linking to dlls, accept any filename.


Pedro Alves
Saturday, 16 December 2006 4:45 a.m.
> Hi all,
> 
> The gdb testsuite in some shared lib tests, builds shared 
> libs with .so 
> or .sl extension uncondicionally,
> and then tries to do a direct link, even on PE platforms 
> (eg:cygwin).  
> That fails to link with current ld.
> I sent a patch there to fix a few cases, by introducing a 
> $SOEXT var in 
> the testsuite.
> But thinking again, I can't see a reason ld doesn't let us do 
> a direct 
> link to a dll with an extension
> other than ".dll" or ".DLL".  The Windows loader is happy to load the 
> dlls, and in fact there are many
> examples of dlls without a ".dll" extension in production.
> 
> The attached patch makes ld be able to direct link any dll without 
> looking at the filename extension.
> 
> Built and regtested on i686-pc-cygwin, and confirmed manually that we 
> identify dlls as dlls no matter
> what the filename is, that we don't mistake exe images with 
> dlls.  Also 
> confirmed linking with msvcrt.dll
> to be sure we can identify a dll built with MSVC as such.
> 
> Please review and commit.
> 

The new direct_dll.sl test fails on mingw32. 

gcc -B/develop/cvs/binutils/build/ld/tmpdir/ld/ -L/mingw/mingw32/lib
-L/mingw/lib -L/usr/local/lib -L/lib -L/usr/lib  -o
tmpdir/direct_client.exe tmpdir/direct_client.o tmpdir/direct_dll.sl
tmpdir/direct_dll.sl: In function `atexit':
C:/develop/cvs/winsup/src/winsup/mingw/dllcrt1.c:161: multiple
definition of `atexit'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32dw2/4.2.0/../../../crt2.o:C:\deve
lop\cvs\winsup\src\winsup\mingw/crt1.c:272: first defined here
tmpdir/direct_dll.sl: In function `onexit':
C:/develop/cvs/winsup/src/winsup/mingw/dllcrt1.c:177: multiple
definition of `_onexit'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32dw2/4.2.0/../../../crt2.o:C:\deve
lop\cvs\winsup\src\winsup\mingw/crt1.c:280: first defined here
tmpdir/direct_dll.sl: In function `onexit':
tmpdir/direct_client.o:direct_client.c:(.text+0x18): undefined reference
to `_imp__dll_func'
collect2: ld returned 1 exit status
FAIL: linking client (.sl)>

Danny



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]