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]

[PATCH] Fix LD test FAIL: application runtime segfault check on Cygwin


    Hi all,

  The cygwin-specific test ld-autoimport/autoimport.exp links a DLL without
supplying a -e option pointing to a suitable DllMain-style init function.  In
its absence, the first exported function in the DLL is taken to be the
entrypoint, which is very wrong in this particular case as it's actually a
test routine that calls printf(..), which doesn't work in early init, so the
test app crashes when the runtime loader tries to start up the test DLL.

  The attached patch fixes that test by pointing the entrypoint at Cygwin's
generic DllMain function, _cygwin_dll_entry().  Tested on Cygwin and it fixes
the test; no other targets affected.

  Ok for head?

ld/testsuite/ChangeLog

	* ld-auto-import/auto-import.exp:  Add missing dll entrypoint.

    cheers,
      DaveK

Index: ld/testsuite/ld-auto-import/auto-import.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-auto-import/auto-import.exp,v
retrieving revision 1.5
diff -p -u -r1.5 auto-import.exp
--- ld/testsuite/ld-auto-import/auto-import.exp	20 Feb 2008 17:51:18 -0000	1.5
+++ ld/testsuite/ld-auto-import/auto-import.exp	14 Mar 2009 17:29:10 -0000
@@ -122,7 +122,7 @@ if [istarget *-pc-cygwin] {
     if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/dll.c $tmpdir/dll.o] {
 	fail "compiling shared lib"
     }
-    if ![ld_special_link "$ld -shared --enable-auto-import --out-implib=$tmpdir/libstandard.dll.a" $tmpdir/dll.dll "$tmpdir/dll.o $MYLIBS"] {
+    if ![ld_special_link "$ld -shared --enable-auto-import -e __cygwin_dll_entry@12 --out-implib=$tmpdir/libstandard.dll.a" $tmpdir/dll.dll "$tmpdir/dll.o $MYLIBS"] {
 	fail "linking shared lib"
     }
 

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