winegcc: Use imported crt DLL instead of msvcrt if specified.

Makes winecrt0 use specified crt DLL instead of msvcrt.dll.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-08-06 12:24:19 +02:00 committed by Alexandre Julliard
parent 14e7e331ae
commit b64187c998
1 changed files with 15 additions and 3 deletions

View File

@ -897,6 +897,7 @@ static void build(struct options* opts)
const char *spec_o_name; const char *spec_o_name;
const char *output_name, *spec_file, *lang; const char *output_name, *spec_file, *lang;
int generate_app_loader = 1; int generate_app_loader = 1;
const char* crt_lib = NULL;
int fake_module = 0; int fake_module = 0;
int is_pe = (opts->target_platform == PLATFORM_WINDOWS || opts->target_platform == PLATFORM_CYGWIN); int is_pe = (opts->target_platform == PLATFORM_WINDOWS || opts->target_platform == PLATFORM_CYGWIN);
unsigned int j; unsigned int j;
@ -982,8 +983,15 @@ static void build(struct options* opts)
strarray_add(files, strmake("-o%s", file)); strarray_add(files, strmake("-o%s", file));
break; break;
case file_arh: case file_arh:
strarray_add(files, strmake("-a%s", file)); if (opts->use_msvcrt)
break; {
const char *p = strrchr(file, '/');
if (p) p++;
else p = file;
if (!strncmp(p, "libmsvcr", 8) || !strncmp(p, "libucrt", 7)) crt_lib = file;
}
strarray_add(files, strmake("-a%s", file));
break;
case file_so: case file_so:
strarray_add(files, strmake("-s%s", file)); strarray_add(files, strmake("-s%s", file));
break; break;
@ -1018,8 +1026,12 @@ static void build(struct options* opts)
if (!opts->nodefaultlibs) if (!opts->nodefaultlibs)
{ {
if (opts->use_msvcrt) add_library(opts, lib_dirs, files, "msvcrt");
add_library(opts, lib_dirs, files, "winecrt0"); add_library(opts, lib_dirs, files, "winecrt0");
if (opts->use_msvcrt)
{
if (!crt_lib) add_library(opts, lib_dirs, files, "msvcrt");
else strarray_add(files, strmake("-a%s", crt_lib));
}
if (opts->win16_app) add_library(opts, lib_dirs, files, "kernel"); if (opts->win16_app) add_library(opts, lib_dirs, files, "kernel");
add_library(opts, lib_dirs, files, "kernel32"); add_library(opts, lib_dirs, files, "kernel32");
add_library(opts, lib_dirs, files, "ntdll"); add_library(opts, lib_dirs, files, "ntdll");