]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
binutils/ChangeLog
authorDave Korn <dave.korn@artimi.com>
Wed, 1 Apr 2009 17:20:19 +0000 (17:20 +0000)
committerDave Korn <dave.korn@artimi.com>
Wed, 1 Apr 2009 17:20:19 +0000 (17:20 +0000)
* dlltool.c (set_dll_name_from_def):  Accept new second arg that
indicates if we are building DLL or EXE, and use it to add a
default suffix to the output filename when none is already present.
(def_name):  Indicate we are building an EXE when calling it.
(def_library):  Indicate we are building a DLL when calling it.

ld/testsuite/ChangeLog

* ld-cygwin/exe-export.exp:  Add "-lkernel32" when linking test exe.
* ld-cygwin/testexe.c (testexe_main):  Indicate whether global_a
was set to correct final value using error return status.
(testexe_dummy):  Dummy function calls an import from kernel32.dll
to ensure it is mapped into the process space at runtime.

binutils/ChangeLog
binutils/dlltool.c
ld/testsuite/ChangeLog
ld/testsuite/ld-cygwin/exe-export.exp
ld/testsuite/ld-cygwin/testexe.c

index fb7bb7fc7bb6b93a0640efbfbf605e10e54a7b73..f047b6041161d2f95c9bbe4c83c13fc341062637 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-01  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * dlltool.c (set_dll_name_from_def):  Accept new second arg that
+       indicates if we are building DLL or EXE, and use it to add a
+       default suffix to the output filename when none is already present.
+       (def_name):  Indicate we are building an EXE when calling it.
+       (def_library):  Indicate we are building a DLL when calling it.
+
 2009-04-01  Jari Aalto  <jari.aalto@cante.net>
 
        PR 9972
index a24a55255ff6ec496874f8ee1fe9db5933d5da51..85ddaacc86dc94b2148959c2227f4db0eb921954 100644 (file)
@@ -782,7 +782,7 @@ static void fill_ordinals (export_type **);
 static void mangle_defs (void);
 static void usage (FILE *, int);
 static void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
-static void set_dll_name_from_def (const char *);
+static void set_dll_name_from_def (const char *name, char is_dll);
 
 static char *
 prefix_encode (char *start, unsigned code)
@@ -1001,13 +1001,22 @@ def_exports (const char *name, const char *internal_name, int ordinal,
 }
 
 static void
-set_dll_name_from_def (const char * name)
+set_dll_name_from_def (const char *name, char is_dll)
 {
-  const charimage_basename = lbasename (name);
+  const char *image_basename = lbasename (name);
   if (image_basename != name)
     non_fatal (_("%s: Path components stripped from image name, '%s'."),
              def_file, name);
-  dll_name = xstrdup (image_basename);
+  /* Append the default suffix, if none specified.  */ 
+  if (strchr (image_basename, '.') == 0)
+    {
+      const char * suffix = is_dll ? ".dll" : ".exe";
+
+      dll_name = xmalloc (strlen (image_basename) + strlen (suffix) + 1);
+      sprintf (dll_name, "%s%s", image_basename, suffix);
+    }
+  else
+    dll_name = xstrdup (image_basename);
 }
 
 void
@@ -1021,8 +1030,8 @@ def_name (const char *name, int base)
 
   /* If --dllname not provided, use the one in the DEF file.
      FIXME: Is this appropriate for executables?  */
-  if (! dll_name)
-    set_dll_name_from_def (name);
+  if (!dll_name)
+    set_dll_name_from_def (name, 0);
   d_is_exe = 1;
 }
 
@@ -1036,8 +1045,8 @@ def_library (const char *name, int base)
     non_fatal (_("Can't have LIBRARY and NAME"));
 
   /* If --dllname not provided, use the one in the DEF file.  */
-  if (! dll_name)
-    set_dll_name_from_def (name);
+  if (!dll_name)
+    set_dll_name_from_def (name, 1);
   d_is_dll = 1;
 }
 
index 209ac9977904eb53b1504ba1434d5122154a19f7..124b11cd53297369a46a477be23ff45ba3768cc2 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-01  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * ld-cygwin/exe-export.exp:  Add "-lkernel32" when linking test exe.
+       * ld-cygwin/testexe.c (testexe_main):  Indicate whether global_a
+       was set to correct final value using error return status.
+       (testexe_dummy):  Dummy function calls an import from kernel32.dll
+       to ensure it is mapped into the process space at runtime.
+
 2009-04-01  Christophe Lyon  <christophe.lyon@st.com>
 
        * ld-arm/arm-elf.exp: BE8 tests expect the same output as the
index 5fd3cf72fbde952d1e32c47a1e0a654f5225801e..b05cbea03f93bc07576f735eae7e02b918c5a133 100644 (file)
@@ -119,7 +119,7 @@ if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/testexe.c $tmpdir/testexe.o] {
     return\r
 }\r
 \r
-if ![ld_special_link "$CC $LDFLAGS $MYLDFLAGS -e _testexe_main@16" $tmpdir/testexe.exe "$tmpdir/testexe.o $srcdir/$subdir/testexe.def $tmpdir/testdll.lib"] {\r
+if ![ld_special_link "$CC $LDFLAGS $MYLDFLAGS -e _testexe_main@16" $tmpdir/testexe.exe "$tmpdir/testexe.o $srcdir/$subdir/testexe.def $tmpdir/testdll.lib -lkernel32"] {\r
     fail "linking executable"\r
     return\r
 } \r
index 333c3892265b881175f4302f1c7f771af79a972d..50a980beca9be02bf57643b04db0c822963c985e 100644 (file)
@@ -12,5 +12,20 @@ int _stdcall
 testexe_main (void* p1, void *p2, char* p3, int p4)
 {
   dllwrite ();
-  return 0;
+  /* We can't print or assert in a minimal app like this,
+     so use the return status to indicate if global_a
+     ended up with the correct expected value.  */
+  return 1 - global_a;
 }
+
+/* We have to import something, anything at all, from 
+   kernel32, in order to have the thread and process
+   base thunk routines loaded when we start running!.  */
+extern __attribute((dllimport)) void _stdcall Sleep (unsigned int duration);
+
+int _stdcall
+testexe_dummy (unsigned int foobar)
+{
+  Sleep (foobar);
+}
+