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

Pedro Alves pedro_alves@portugalmail.pt
Fri Dec 15 15:44:00 GMT 2006


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.

Cheers,
Pedro Alves

----
ld/

2006-12-15  Pedro Alves  <pedro_alves@portugalmail.pt>

	* emultempl/pe.em (gld_${EMULATION_NAME}_recognized_file):
	Detect dlls using bfd not the filename extension.

ld/testsuite/

2006-12-15  Pedro Alves  <pedro_alves@portugalmail.pt>

	* ld-pe/direct.exp: New file.
	* ld-pe/direct_client.c: Likewise.
	* ld-pe/direct_dll.c: Likewise.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: direct.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20061215/5434bd2b/attachment.ksh>


More information about the Binutils mailing list