Alexandre Julliard : winegcc: Don't link directly to ntdll or ntoskrnl import libraries.
Alexandre Julliard
julliard at winehq.org
Wed Nov 17 16:27:57 CST 2021
Module: wine
Branch: master
Commit: a7074ea2a3ab384a9360979b933e92a078179d0a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a7074ea2a3ab384a9360979b933e92a078179d0a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Nov 17 14:56:38 2021 +0100
winegcc: Don't link directly to ntdll or ntoskrnl import libraries.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winegcc/winegcc.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 38900103a97..940eaeb5279 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1408,18 +1408,28 @@ static void build(struct options* opts)
strarray_add(&link_args, name);
break;
case 'a':
- if (is_pe && !opts->use_msvcrt && !opts->lib_suffix && strchr(name, '/'))
+ if (!opts->use_msvcrt && !opts->lib_suffix && strchr(name, '/'))
{
/* turn the path back into -Ldir -lfoo options
* this makes sure that we use the specified libs even
* when mingw adds its own import libs to the link */
const char *p = get_basename( name );
- if (!strncmp( p, "lib", 3 ) && strcmp( p, "libmsvcrt.a" ))
+ if (is_pe)
{
- strarray_add(&link_args, strmake("-L%s", get_dirname(name) ));
- strarray_add(&link_args, strmake("-l%s", get_basename_noext( p + 3 )));
- break;
+ if (!strncmp( p, "lib", 3 ) && strcmp( p, "libmsvcrt.a" ))
+ {
+ strarray_add(&link_args, strmake("-L%s", get_dirname(name) ));
+ strarray_add(&link_args, strmake("-l%s", get_basename_noext( p + 3 )));
+ break;
+ }
+ }
+ else
+ {
+ /* don't link to ntdll or ntoskrnl in non-msvcrt mode
+ * since they export CRT functions */
+ if (!strcmp( p, "libntdll.a" )) break;
+ if (!strcmp( p, "libntoskrnl.a" )) break;
}
}
strarray_add(&link_args, name);
More information about the wine-cvs
mailing list