From: Jacek Caban Subject: Re: [PATCH] makefiles: Add libntdll.def to the dependencies for native Unix libraries. Message-Id: Date: Sat, 18 Sep 2021 13:10:07 +0200 In-Reply-To: <20210917224433.2051074-1-zfigura@codeweavers.com> References: <20210917224433.2051074-1-zfigura@codeweavers.com> Hi Zebediah, On 9/18/21 12:44 AM, Zebediah Figura wrote: > These require libntdll.def to exist, otherwise -lntdll is not correctly > detected as a DLL with an associated Unix library by winegcc, and is > instead treated as a system dependency. We could change winegcc to not depend on .def file existence instead. How about something like the attached (barely tested) patch? Thanks, Jacek diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 5f8e6c0e086..c76b8158702 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -1088,7 +1088,15 @@ static const char *find_libgcc(const strarray *prefix, const strarray *link_tool /* add specified library to the list of files */ static void add_library( struct options *opts, strarray *lib_dirs, strarray *files, const char *library ) { - char *static_lib, *fullname = 0, *unixlib; + char *static_lib, *fullname = 0; + + if (opts->unix_lib && opts->subsystem && !strcmp(opts->subsystem, "unixlib") && + get_lib_type(opts->target_platform, lib_dirs, library, "", ".so", &fullname) == file_so) + { + strarray_add(files, strmake("-s%s", fullname)); + free(fullname); + return; + } switch(get_lib_type(opts->target_platform, lib_dirs, library, "lib", opts->lib_suffix, &fullname)) { @@ -1096,19 +1104,6 @@ static void add_library( struct options *opts, strarray *lib_dirs, strarray *fil strarray_add(files, strmake("-a%s", fullname)); break; case file_dll: - if (opts->unix_lib && opts->subsystem && !strcmp(opts->subsystem, "unixlib")) - { - if (get_lib_type(opts->target_platform, lib_dirs, library, "", ".so", &unixlib) == file_so) - { - strarray_add(files, strmake("-s%s", unixlib)); - free(unixlib); - } - else - { - strarray_add(files, strmake("-l%s", library)); - } - break; - } strarray_add(files, strmake("-d%s", fullname)); if ((static_lib = find_static_lib(fullname))) {