diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index e754a191424..1e02f1a84ce 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -745,7 +745,15 @@ static void build(struct options* opts) for ( j = 0; j < lib_dirs->size; j++ ) strarray_add(link_args, strmake("-L%s", lib_dirs->base[j])); - if (!opts->nostartfiles) add_library(opts, lib_dirs, files, "winecrt0"); + if (!opts->nostartfiles) + { + add_library(opts, lib_dirs, files, "winecrt0"); + if (!opts->nodefaultlibs) + { + add_library(opts, lib_dirs, files, "kernel32"); + add_library(opts, lib_dirs, files, "ntdll"); + } + } if (opts->shared && !opts->nostdlib) add_library(opts, lib_dirs, files, "wine"); if (!opts->shared && opts->use_msvcrt && opts->target_platform == PLATFORM_CYGWIN) add_library(opts, lib_dirs, files, "msvcrt"); @@ -823,10 +831,18 @@ static void build(struct options* opts) } add_library(opts, lib_dirs, files, "advapi32"); add_library(opts, lib_dirs, files, "user32"); - add_library(opts, lib_dirs, files, "kernel32"); } - if (!opts->nostartfiles) add_library(opts, lib_dirs, files, "winecrt0"); + if (!opts->nostartfiles) + { + add_library(opts, lib_dirs, files, "winecrt0"); + if (!opts->nodefaultlibs) + { + if (opts->win16_app) add_library(opts, lib_dirs, files, "kernel"); + add_library(opts, lib_dirs, files, "kernel32"); + add_library(opts, lib_dirs, files, "ntdll"); + } + } if (!opts->nostdlib) add_library(opts, lib_dirs, files, "wine"); /* run winebuild to generate the .spec.o file */