Jacek Caban : makedep: Use -Wl,-delayload option for winebuild delayimports.

Alexandre Julliard julliard at winehq.org
Tue Nov 12 16:56:06 CST 2019


Module: wine
Branch: master
Commit: 4346d68e1b6b2c5a775ce60fdc0b6fdd2fec4943
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4346d68e1b6b2c5a775ce60fdc0b6fdd2fec4943

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 11 19:59:13 2019 +0100

makedep: Use -Wl,-delayload option for winebuild delayimports.

Also fixes winebuild to correctly handle module extensions.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/Makefile.in |  2 +-
 tools/makedep.c           | 20 +++++++++++++++++---
 tools/winebuild/import.c  |  2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in
index ae9bf3dce6..6c31365546 100644
--- a/dlls/setupapi/Makefile.in
+++ b/dlls/setupapi/Makefile.in
@@ -2,7 +2,7 @@ EXTRADEFS = -D_SETUPAPI_
 MODULE    = setupapi.dll
 IMPORTLIB = setupapi
 IMPORTS   = uuid version advapi32 rpcrt4
-DELAYIMPORTS = shell32 wintrust ole32 winspool comdlg32 user32
+DELAYIMPORTS = shell32 wintrust ole32 winspool.drv comdlg32 user32
 
 EXTRADLLFLAGS = -mno-cygwin
 
diff --git a/tools/makedep.c b/tools/makedep.c
index 13c2bd2342..65b36146ed 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -574,6 +574,19 @@ static char *get_extension( char *filename )
 }
 
 
+/*******************************************************************
+ *         get_base_name
+ */
+static const char *get_base_name( const char *name )
+{
+    char *base;
+    if (!strchr( name, '.' )) return name;
+    base = strdup( name );
+    *strrchr( base, '.' ) = 0;
+    return base;
+}
+
+
 /*******************************************************************
  *         replace_extension
  */
@@ -2172,7 +2185,7 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra
 
     for (i = 0; i < imports.count; i++)
     {
-        const char *name = imports.str[i];
+        const char *name = get_base_name( imports.str[i] );
         const char *lib = NULL;
 
         for (j = 0; j < top_makefile->subdirs.count; j++)
@@ -3211,7 +3224,8 @@ static void output_module( struct makefile *make )
         if (*dll_ext)
         {
             for (i = 0; i < make->delayimports.count; i++)
-                strarray_add( &all_libs, strmake( "-Wb,-d%s", make->delayimports.str[i] ));
+                strarray_add( &all_libs, strmake( "-Wl,-delayload,%s%s", make->delayimports.str[i],
+                                                  strchr( make->delayimports.str[i], '.' ) ? "" : ".dll" ));
             strarray_add( &make->all_targets, strmake( "%s%s", make->module, dll_ext ));
             strarray_add( &make->all_targets, strmake( "%s.fake", make->module ));
             add_install_rule( make, make->module, strmake( "%s%s", make->module, dll_ext ),
@@ -4235,7 +4249,7 @@ static void load_sources( struct makefile *make )
 
     if (!*dll_ext || make->is_cross)
         for (i = 0; i < make->delayimports.count; i++)
-            strarray_add_uniq( &delay_import_libs, make->delayimports.str[i] );
+            strarray_add_uniq( &delay_import_libs, get_base_name( make->delayimports.str[i] ));
 }
 
 
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index e2688a058a..c4dc31957d 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -371,7 +371,7 @@ void add_import_dll( const char *name, const char *filename )
     imp->dll_name = spec->file_name ? spec->file_name : dll_name;
     imp->c_name = make_c_identifier( imp->dll_name );
 
-    if (is_delayed_import( dll_name ))
+    if (is_delayed_import( imp->dll_name ))
         list_add_tail( &dll_delayed, &imp->entry );
     else
         list_add_tail( &dll_imports, &imp->entry );




More information about the wine-cvs mailing list