commit 7571fa87df453e404d8b6ca58e2da95340156849
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Aug 24 13:30:12 2020 +0200
makefiles: Don't implicitly import the module itself when
-nodefaultlibs is used.
broke the build on x86 with GCC 9; seen on FreeBSD, but probably not
specific.
The issue is RtlInterlockedCompareExchange64 is missing when buidling
ntdll/unix.
I could fix this by adding dlls/ntdll/large_int.o to the linking of
dlls/ntdll/ntdll.so in the top Makefile, though I don't know how to
do this via Automake.
Here is the successfull invocation:
tools/winegcc/winegcc -o dlls/ntdll/ntdll.so --wine-objdir . -fno-PIC \
-fasynchronous-unwind-tables -munix -shared \
dlls/ntdll/ntdll.spec -nodefaultlibs dlls/ntdll/unix/cdrom.o dlls/ntdll/unix/debug.o \
dlls/ntdll/unix/env.o dlls/ntdll/unix/file.o dlls/ntdll/unix/loader.o dlls/ntdll/unix/process.o \
dlls/ntdll/unix/registry.o dlls/ntdll/unix/security.o dlls/ntdll/unix/serial.o \
dlls/ntdll/unix/server.o dlls/ntdll/unix/signal_arm.o dlls/ntdll/unix/signal_arm64.o \
dlls/ntdll/unix/signal_i386.o dlls/ntdll/unix/signal_x86_64.o dlls/ntdll/unix/sync.o \
dlls/ntdll/unix/system.o dlls/ntdll/unix/tape.o dlls/ntdll/unix/thread.o dlls/ntdll/unix/virtual.o \
dlls/ntdll/unix/version.o dlls/winecrt0/libwinecrt0.a libs/port/libwine_port.a -lpthread \
-L/home/gerald/11-i386/lib -fstack-protector-strong \
-Wl,-rpath=/home/gerald/11-i386/lib/gcc9 -L/home/gerald/11-i386/lib/gcc9 \
dlls/ntdll/large_int.o
The failing invocation (without the addition of large_int.o) ends like
this:
dlls/ntdll/unix/server.o: In function `remove_fd_from_cache':
server.c:(.text+0x2d0): undefined reference to `RtlInterlockedCompareExchange64'
dlls/ntdll/unix/server.o: In function `add_fd_to_cache':
server.c:(.text+0x5da): undefined reference to `RtlInterlockedCompareExchange64'
dlls/ntdll/unix/server.o: In function `server_get_unix_fd':
server.c:(.text+0xafd): undefined reference to `RtlInterlockedCompareExchange64'
server.c:(.text+0xbda): undefined reference to `RtlInterlockedCompareExchange64'
collect2: error: ld returned 1 exit status
winegcc: /home/gerald/11-i386/bin/gcc9 failed
gmake: *** [Makefile:92721: dlls/ntdll/ntdll.so] Error 2
Gerald
On Sat, 29 Aug 2020, Gerald Pfeifer wrote:
> Sadly, after being fine for those two months since
>
> commit 0c14b1a962573ee125940f2008c646befe597226
> Author: Gerald Pfeifer <gerald@pfeifer.com>
> Date: Sun Jun 7 00:38:02 2020 +0200
>
> ntdll: Replicate InterlockedCompareExchange64 to the Unix library.
>
> This fixes the build on FreeBSD/i386 with GCC 9.
>
> Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
>
> went in, this is now broken again with GCC 9. It broke between
> Wine 5.15 and 5.16.
>
> Alexandre, does the following ring a bell?
>
> gcc9 -c -o enum_jobs.o enum_jobs.c -I. -I../../include
> -I../../include/msvcrt -D __WINESRC__ -D_UCRT
> -D_REENTRANT -fno-PIC -fasynchronous-unwind-tables -fno-builtin
> -fshort-wchar -Wall -pipe -fcf-protection=none -fno-stack-protector
> -fno-strict-aliasing -Wdeclaration-after-statement
> -Wempty-body -Wignored-qualifiers -Wno-packed-not-aligned
> -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits
> -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith
> -Wlogical-op -fno-omit-frame-pointer -isystem /home/gerald/11-i386/include
> -O2 -pipe -fstack-protector-strong
> -Wl,-rpath=/home/gerald/11-i386/lib/gcc9
> -isystem /home/gerald/11-i386/include -fno-strict-aliasing
> unix/server.o: In function `remove_fd_from_cache':
> server.c:(.text+0x2d0): undefined reference to `RtlInterlockedCompareExchange64'
> unix/server.o: In function `add_fd_to_cache':
> server.c:(.text+0x5da): undefined reference to `RtlInterlockedCompareExchange64'
> unix/server.o: In function `server_get_unix_fd':
> server.c:(.text+0xae3): undefined reference to `RtlInterlockedCompareExchange64'
> server.c:(.text+0xc00): undefined reference to `RtlInterlockedCompareExchange64'
> collect2: error: ld returned 1 exit status
> winegcc: /home/gerald/11-i386/bin/gcc9 failed
> gmake[2]: *** [Makefile:1454: ntdll.so] Error 2
>
> Gerald
>
> On Sun, 7 Jun 2020, Gerald Pfeifer wrote:
>> Between Wine 5.9 and 5.10 many ntdll functions moved to the Unix
>> library. Make the implementation of InterlockedCompareExchange64 via
>> RtlInterlockedCompareExchange64 available there as well for targets
>> without __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
>>
>> This fixes the build on FreeBSD/i386 with GCC 9.
>>
>> Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
>> ---
>> dlls/ntdll/unix/unix_private.h | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
>> index a422fd825e..a0485b411d 100644
>> --- a/dlls/ntdll/unix/unix_private.h
>> +++ b/dlls/ntdll/unix/unix_private.h
>> @@ -23,6 +23,10 @@
>>
>> #include "unixlib.h"
>>
>> +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
>> +#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
>> +#endif
>> +
>> struct debug_info
>> {
>> unsigned int str_pos; /* current position in strings buffer */